18 #ifndef QGSZONALSTATISTICS_H 19 #define QGSZONALSTATISTICS_H 48 All = Count | Sum | Mean | Median | StDev | Max | Min | Range | Minority | Majority | Variety
53 const Statistics& stats = Statistics( Count | Sum | Mean ) );
65 FeatureStats(
bool storeValues =
false,
bool storeValueCounts =
false )
66 : mStoreValues( storeValues )
67 , mStoreValueCounts( storeValueCounts )
71 void reset() { sum = 0; count = 0;
max = -FLT_MAX;
min = FLT_MAX; valueCount.clear(); values.clear(); }
72 void addValue(
float value,
double weight = 1.0 )
76 sum += value * weight;
86 if ( mStoreValueCounts )
87 valueCount.insert( value, valueCount.value( value, 0 ) + 1 );
89 values.append( value );
100 bool mStoreValueCounts;
105 int cellInfoForBBox(
const QgsRectangle& rasterBBox,
const QgsRectangle& featureBBox,
double cellSizeX,
double cellSizeY,
106 int& offsetX,
int& offsetY,
int& nCellsX,
int& nCellsY )
const;
109 void statisticsFromMiddlePointTest(
void* band,
const QgsGeometry* poly,
int pixelOffsetX,
int pixelOffsetY,
int nCellsX,
int nCellsY,
110 double cellSizeX,
double cellSizeY,
const QgsRectangle& rasterBBox, FeatureStats& stats );
113 void statisticsFromPreciseIntersection(
void* band,
const QgsGeometry* poly,
int pixelOffsetX,
int pixelOffsetY,
int nCellsX,
int nCellsY,
114 double cellSizeX,
double cellSizeY,
const QgsRectangle& rasterBBox, FeatureStats& stats );
117 bool validPixel(
float value )
const;
127 float mInputNodataValue;
128 Statistics mStatistics;
131 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsZonalStatistics::Statistics )
133 #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.