QGIS API Documentation 3.39.0-Master (f549811d78c)
|
Calculator for summary statistics and aggregates for a list of datetimes. More...
#include <qgsdatetimestatisticalsummary.h>
Public Member Functions | |
QgsDateTimeStatisticalSummary (Qgis::DateTimeStatistics stats=Qgis::DateTimeStatistic::All) | |
Constructor for QgsDateTimeStatisticalSummary. | |
void | addValue (const QVariant &value) |
Adds a single datetime to the statistics calculation. | |
void | calculate (const QVariantList &values) |
Calculates summary statistics for a list of variants. | |
int | count () const |
Returns the calculated count of values. | |
int | countDistinct () const |
Returns the number of distinct datetime values. | |
int | countMissing () const |
Returns the number of missing (null) datetime values. | |
QSet< QDateTime > | distinctValues () const |
Returns the set of distinct datetime values. | |
void | finalize () |
Must be called after adding all datetimes with addValue() and before retrieving any calculated datetime statistics. | |
QDateTime | max () const |
Returns the maximum (latest) non-null datetime value. | |
QDateTime | min () const |
Returns the minimum (earliest) non-null datetime value. | |
QgsInterval | range () const |
Returns the range (interval between earliest and latest non-null datetime values). | |
void | reset () |
Resets the calculated values. | |
void | setStatistics (Qgis::DateTimeStatistics stats) |
Sets flags which specify which statistics will be calculated. | |
QVariant | statistic (Qgis::DateTimeStatistic stat) const |
Returns the value of a specified statistic. | |
Qgis::DateTimeStatistics | statistics () const |
Returns flags which specify which statistics will be calculated. | |
Static Public Member Functions | |
static QString | displayName (Qgis::DateTimeStatistic statistic) |
Returns the friendly display name for a statistic. | |
Calculator for summary statistics and aggregates for a list of datetimes.
Statistics are calculated by calling calculate() and passing a list of datetimes. The individual statistics can then be retrieved using the associated methods. Note that not all statistics are calculated by default. Statistics which require slower computations are only calculated by specifying the statistic in the constructor or via setStatistics().
Definition at line 44 of file qgsdatetimestatisticalsummary.h.
QgsDateTimeStatisticalSummary::QgsDateTimeStatisticalSummary | ( | Qgis::DateTimeStatistics | stats = Qgis::DateTimeStatistic::All | ) |
Constructor for QgsDateTimeStatisticalSummary.
stats | flags for statistics to calculate |
Definition at line 32 of file qgsdatetimestatisticalsummary.cpp.
void QgsDateTimeStatisticalSummary::addValue | ( | const QVariant & | value | ) |
Adds a single datetime to the statistics calculation.
Calling this method allows datetimes to be added to the calculation one at a time. For large quantities of dates this may be more efficient then first adding all the variants to a list and calling calculate().
value | datetime to add. Any non-datetime variants will be ignored. |
Definition at line 60 of file qgsdatetimestatisticalsummary.cpp.
void QgsDateTimeStatisticalSummary::calculate | ( | const QVariantList & | values | ) |
Calculates summary statistics for a list of variants.
Any non-datetime variants will be ignored.
values | list of variants |
Definition at line 48 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Returns the calculated count of values.
Definition at line 114 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the number of distinct datetime values.
Definition at line 119 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the number of missing (null) datetime values.
Definition at line 129 of file qgsdatetimestatisticalsummary.h.
|
static |
Returns the friendly display name for a statistic.
statistic | statistic to return name for |
Definition at line 165 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Returns the set of distinct datetime values.
Definition at line 124 of file qgsdatetimestatisticalsummary.h.
void QgsDateTimeStatisticalSummary::finalize | ( | ) |
Must be called after adding all datetimes with addValue() and before retrieving any calculated datetime statistics.
Definition at line 89 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Returns the maximum (latest) non-null datetime value.
Definition at line 139 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the minimum (earliest) non-null datetime value.
Definition at line 134 of file qgsdatetimestatisticalsummary.h.
QgsInterval QgsDateTimeStatisticalSummary::range | ( | ) | const |
Returns the range (interval between earliest and latest non-null datetime values).
Definition at line 156 of file qgsdatetimestatisticalsummary.cpp.
void QgsDateTimeStatisticalSummary::reset | ( | ) |
Resets the calculated values.
Definition at line 38 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Sets flags which specify which statistics will be calculated.
Some statistics are always calculated (e.g., count).
stats | flags for statistics to calculate |
Definition at line 67 of file qgsdatetimestatisticalsummary.h.
QVariant QgsDateTimeStatisticalSummary::statistic | ( | Qgis::DateTimeStatistic | stat | ) | const |
Returns the value of a specified statistic.
stat | statistic to return |
Definition at line 130 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Returns flags which specify which statistics will be calculated.
Some statistics are always calculated (e.g., count).
Definition at line 59 of file qgsdatetimestatisticalsummary.h.