18 #ifndef QGSZONALSTATISTICS_H 19 #define QGSZONALSTATISTICS_H 47 All = Count | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety
52 const Statistics& stats = Statistics( Count | Sum | Mean ) );
64 FeatureStats(
bool storeValues =
false,
bool storeValueCounts =
false )
65 : mStoreValues( storeValues )
66 , mStoreValueCounts( storeValueCounts )
70 void reset() { sum = 0; count = 0;
max = FLT_MIN;
min = FLT_MAX; valueCount.clear(); values.clear(); }
71 void addValue(
float value,
double weight = 1.0 )
75 sum += value * weight;
85 if ( mStoreValueCounts )
86 valueCount.insert( value, valueCount.value( value, 0 ) + 1 );
88 values.append( value );
99 bool mStoreValueCounts;
104 int cellInfoForBBox(
const QgsRectangle& rasterBBox,
const QgsRectangle& featureBBox,
double cellSizeX,
double cellSizeY,
105 int& offsetX,
int& offsetY,
int& nCellsX,
int& nCellsY )
const;
108 void statisticsFromMiddlePointTest(
void* band,
const QgsGeometry* poly,
int pixelOffsetX,
int pixelOffsetY,
int nCellsX,
int nCellsY,
109 double cellSizeX,
double cellSizeY,
const QgsRectangle& rasterBBox, FeatureStats& stats );
112 void statisticsFromPreciseIntersection(
void* band,
const QgsGeometry* poly,
int pixelOffsetX,
int pixelOffsetY,
int nCellsX,
int nCellsY,
113 double cellSizeX,
double cellSizeY,
const QgsRectangle& rasterBBox, FeatureStats& stats );
116 bool validPixel(
float value )
const;
126 float mInputNodataValue;
127 Statistics mStatistics;
130 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsZonalStatistics::Statistics )
132 #endif // QGSZONALSTATISTICS_H A rectangle specified with double values.
Statistic
Enumeration of flags that specify statistics to be calculated.
A geometry is the spatial representation of a feature.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
A class that calculates raster statistics (count, sum, mean) for a polygon or multipolygon layer and ...
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
Represents a vector layer which manages a vector based data sets.