QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
Calculator for summary statistics and aggregates for a list of datetimes. More...
#include <qgsdatetimestatisticalsummary.h>
Public Types | |
enum | Statistic { Count = 1 , CountDistinct = 2 , CountMissing = 4 , Min = 8 , Max = 16 , Range = 32 , All = Count | CountDistinct | CountMissing | Min | Max | Range } |
Enumeration of flags that specify statistics to be calculated. More... | |
Public Member Functions | |
QgsDateTimeStatisticalSummary (QgsDateTimeStatisticalSummary::Statistics stats=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 (Statistics stats) |
Sets flags which specify which statistics will be calculated. | |
QVariant | statistic (QgsDateTimeStatisticalSummary::Statistic stat) const |
Returns the value of a specified statistic. | |
Statistics | statistics () const |
Returns flags which specify which statistics will be calculated. | |
Static Public Member Functions | |
static QString | displayName (QgsDateTimeStatisticalSummary::Statistic 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 45 of file qgsdatetimestatisticalsummary.h.
Enumeration of flags that specify statistics to be calculated.
Definition at line 50 of file qgsdatetimestatisticalsummary.h.
QgsDateTimeStatisticalSummary::QgsDateTimeStatisticalSummary | ( | QgsDateTimeStatisticalSummary::Statistics | stats = 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 128 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the number of distinct datetime values.
Definition at line 133 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the number of missing (null) datetime values.
Definition at line 143 of file qgsdatetimestatisticalsummary.h.
|
static |
Returns the friendly display name for a statistic.
statistic | statistic to return name for |
Definition at line 152 of file qgsdatetimestatisticalsummary.cpp.
|
inline |
Returns the set of distinct datetime values.
Definition at line 138 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 153 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the minimum (earliest) non-null datetime value.
Definition at line 148 of file qgsdatetimestatisticalsummary.h.
|
inline |
Returns the range (interval between earliest and latest non-null datetime values).
Definition at line 158 of file qgsdatetimestatisticalsummary.h.
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 81 of file qgsdatetimestatisticalsummary.h.
QVariant QgsDateTimeStatisticalSummary::statistic | ( | QgsDateTimeStatisticalSummary::Statistic | 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 73 of file qgsdatetimestatisticalsummary.h.