* This class is considered CRITICAL and any change MUST be accompanied with
@@ -44,6 +45,7 @@ class CORE_EXPORT QgsStatisticalSummary
enum Statistic
{
Count = 1, //!< Count
CountMissing = 32770, //!< Number of missing (null) values
Sum = 2, //!< Sum of values
Mean = 4, //!< Mean of values
Median = 8, //!< Median of values
@@ -58,7 +60,7 @@ class CORE_EXPORT QgsStatisticalSummary
FirstQuartile = 4096, //!< First quartile
ThirdQuartile = 8192, //!< Third quartile
InterQuartileRange = 16384, //!< Inter quartile range (IQR)
All = Count | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange
All = Count | CountMissing | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | FirstQuartile | ThirdQuartile | InterQuartileRange
};
Q_DECLARE_FLAGS( Statistics, Statistic )
@@ -101,13 +103,33 @@ class CORE_EXPORT QgsStatisticalSummary
* @note finalize() must be called after adding the final value and before
* retrieving calculated statistics.
* @see calculate()
* @see addVariant()
* @see finalize()
* @note added in QGIS 2.16
*/
voidaddValue( double value );
/** Adds a single value to the statistics calculation. Calling this method
* allows values to be added to the calculation one at a time. For large
* quantities of values this may be more efficient then first adding all the
* values to a list and calling calculate().
* @param value variant containing to add. Non-numeric values are treated as null.
* @note call reset() before adding the first value using this method
* to clear the results from any previous calculations
* @note finalize() must be called after adding the final value and before
* retrieving calculated statistics.
* @see addValue()
* @see calculate()
* @see finalize()
* @note added in QGIS 2.16
*/
voidaddVariant( const QVariant& value );
/** Must be called after adding all values with addValues() and before retrieving
* any calculated statistics.
* @see addValue()
* @see addVariant()
* @note added in QGIS 2.16
*/
voidfinalize();
@@ -121,6 +143,10 @@ class CORE_EXPORT QgsStatisticalSummary
*/
intcount() const { returnmCount; }
/** Returns the number of missing (null) values
*/
intcountMissing() const { returnmMissing; }
/** Returns calculated sum of values
*/
doublesum() const { returnmSum; }
@@ -209,6 +235,7 @@ class CORE_EXPORT QgsStatisticalSummary