QGIS/python/analysis/vector/qgszonalstatistics.sip
Nyall Dawson c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00

44 lines
1.5 KiB
Plaintext

/** \ingroup analysis
* The QGis class that calculates raster statistics (count, sum, mean) for
* a polygon or multipolygon layer and appends the results as attributes
*/
class QgsZonalStatistics
{
%TypeHeaderCode
#include <qgszonalstatistics.h>
%End
public:
//! Enumeration of flags that specify statistics to be calculated
enum Statistic
{
Count, //!< Pixel count
Sum, //!< Sum of pixel values
Mean, //!< Mean of pixel values
Median, //!< Median of pixel values
StDev, //!< Standard deviation of pixel values
Min, //!< Min of pixel values
Max, //!< Max of pixel values
Range, //!< Range of pixel values (max - min)
Minority, //!< Minority of pixel values
Majority, //!< Majority of pixel values
Variety, //!< Variety (count of distinct) pixel values
All
};
typedef QFlags<QgsZonalStatistics::Statistic> Statistics;
QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QString& rasterFile, const QString& attributePrefix = "", int rasterBand = 1,
const QgsZonalStatistics::Statistics& stats = QgsZonalStatistics::Statistics( QgsZonalStatistics::Count | QgsZonalStatistics::Sum | QgsZonalStatistics::Mean) );
~QgsZonalStatistics();
/** Starts the calculation
@return 0 in case of success*/
int calculateStatistics( QProgressDialog* p );
};
QFlags<QgsZonalStatistics::Statistic> operator|(QgsZonalStatistics::Statistic f1, QFlags<QgsZonalStatistics::Statistic> f2);