18 #ifndef QGSZONALSTATISTICS_H
19 #define QGSZONALSTATISTICS_H
27 #include "qgis_analysis.h"
62 All = Count | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety | Variance
64 Q_DECLARE_FLAGS( Statistics, Statistic )
76 const QString &attributePrefix = QString(),
109 double rasterUnitsPerPixelX,
110 double rasterUnitsPerPixelY,
111 const QString &attributePrefix = QString(),
141 FeatureStats(
bool storeValues =
false,
bool storeValueCounts =
false )
142 : mStoreValues( storeValues )
143 , mStoreValueCounts( storeValueCounts )
151 max = std::numeric_limits<double>::lowest();
152 min = std::numeric_limits<double>::max();
157 void addValue(
double value,
double weight = 1.0 )
161 sum += value * weight;
169 min = std::min( min, value );
170 max = std::max( max, value );
171 if ( mStoreValueCounts )
172 valueCount.insert( value, valueCount.value( value, 0 ) + 1 );
174 values.append( value );
178 double max = std::numeric_limits<double>::lowest();
179 double min = std::numeric_limits<double>::max();
180 QMap< double, int > valueCount;
181 QList< double > values;
184 bool mStoreValues =
false;
185 bool mStoreValueCounts =
false;
188 QString getUniqueFieldName(
const QString &fieldName,
const QList<QgsField> &newFields );
193 double mCellSizeX = 0;
194 double mCellSizeY = 0;
199 QString mAttributePrefix;
203 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsZonalStatistics::Statistics )
207 #endif // QGSZONALSTATISTICS_H