QGIS API Documentation
3.6.0-Noosa (5873452)
|
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. More... | |
void | addValue (const QVariant &value) |
Adds a single datetime to the statistics calculation. More... | |
void | calculate (const QVariantList &values) |
Calculates summary statistics for a list of variants. More... | |
int | count () const |
Returns the calculated count of values. More... | |
int | countDistinct () const |
Returns the number of distinct datetime values. More... | |
int | countMissing () const |
Returns the number of missing (null) datetime values. More... | |
QSet< QDateTime > | distinctValues () const |
Returns the set of distinct datetime values. More... | |
void | finalize () |
Must be called after adding all datetimes with addValue() and before retrieving any calculated datetime statistics. More... | |
QDateTime | max () const |
Returns the maximum (latest) non-null datetime value. More... | |
QDateTime | min () const |
Returns the minimum (earliest) non-null datetime value. More... | |
QgsInterval | range () const |
Returns the range (interval between earliest and latest non-null datetime values). More... | |
void | reset () |
Resets the calculated values. More... | |
void | setStatistics (Statistics stats) |
Sets flags which specify which statistics will be calculated. More... | |
QVariant | statistic (QgsDateTimeStatisticalSummary::Statistic stat) const |
Returns the value of a specified statistic. More... | |
Statistics | statistics () const |
Returns flags which specify which statistics will be calculated. More... | |
Static Public Member Functions | |
static QString | displayName (QgsDateTimeStatisticalSummary::Statistic statistic) |
Returns the friendly display name for a statistic. More... | |
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 31 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 58 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 47 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 148 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 85 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 37 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 126 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.