QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsrasterminmaxorigin.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrasterminmaxorigin.h - Origin of min/max values
3 --------------------------------------
4 Date : Dec 2016
5 Copyright : (C) 2016 by Even Rouault
6 email : even.rouault at spatialys.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSRASTERMINMAXORIGIN_H
19#define QGSRASTERMINMAXORIGIN_H
20
21#include <QDomDocument>
22#include "qgis_sip.h"
23#include <QDomElement>
24
25#include "qgis_core.h"
26
32class CORE_EXPORT QgsRasterMinMaxOrigin
33{
34
35 public:
36
38 static constexpr double CUMULATIVE_CUT_LOWER = 0.02;
39
41 static constexpr double CUMULATIVE_CUT_UPPER = 0.98;
42
44 static constexpr double DEFAULT_STDDEV_FACTOR = 2.0;
45
46#ifdef SIP_RUN
48 enum Limits
49 {
50 None SIP_PYNAME( None_ ),
51 MinMax,
52 StdDev,
53 CumulativeCut
54 };
55#else
57 enum Limits
58 {
62 CumulativeCut
63 };
64#endif
65
67 enum Extent
68 {
74 UpdatedCanvas
75 };
76
79 {
83 Estimated
84 };
85
88
90 bool operator ==( const QgsRasterMinMaxOrigin &other ) const;
91
93
95 QgsRasterMinMaxOrigin::Limits limits() const { return mLimits; }
96
98 QgsRasterMinMaxOrigin::Extent extent() const { return mExtent; }
99
102
104 double cumulativeCutLower() const { return mCumulativeCutLower; }
105
107 double cumulativeCutUpper() const { return mCumulativeCutUpper; }
108
110 double stdDevFactor() const { return mStdDevFactor; }
111
113
115 void setLimits( QgsRasterMinMaxOrigin::Limits limits ) { mLimits = limits; }
116
118 void setExtent( QgsRasterMinMaxOrigin::Extent extent ) { mExtent = extent; }
119
121 void setStatAccuracy( QgsRasterMinMaxOrigin::StatAccuracy accuracy ) { mAccuracy = accuracy; }
122
124 void setCumulativeCutLower( double val ) { mCumulativeCutLower = val; }
125
127 void setCumulativeCutUpper( double val ) { mCumulativeCutUpper = val; }
128
130 void setStdDevFactor( double val ) { mStdDevFactor = val; }
131
133
135 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
136
138 void readXml( const QDomElement &elem );
139
141
143 static QString limitsString( Limits limits );
144
146 static Limits limitsFromString( const QString &limits );
147
149 static QString extentString( QgsRasterMinMaxOrigin::Extent extent );
150
152 static QgsRasterMinMaxOrigin::Extent extentFromString( const QString &extent );
153
155 static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy accuracy );
156
158 static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString &accuracy );
159
160 private:
161
162 Limits mLimits = None;
163 Extent mExtent = WholeRaster;
164 StatAccuracy mAccuracy = Estimated;
165 double mCumulativeCutLower;
166 double mCumulativeCutUpper;
167 double mStdDevFactor;
168};
169
170#endif // QGSRASTERMINMAXORIGIN_H
This class describes the origin of min/max values.
void setExtent(QgsRasterMinMaxOrigin::Extent extent)
Sets the extent.
QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const
Returns the raster statistic accuracy.
double cumulativeCutLower() const
Returns the lower bound of cumulative cut method (between 0 and 1).
StatAccuracy
This enumerator describes the accuracy used to compute statistics.
QgsRasterMinMaxOrigin::Limits limits() const
Returns the raster limits.
double stdDevFactor() const
Returns the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ].
void setLimits(QgsRasterMinMaxOrigin::Limits limits)
Sets the limits.
void setStatAccuracy(QgsRasterMinMaxOrigin::StatAccuracy accuracy)
Sets the statistics accuracy.
Extent
This enumerator describes the extent used to compute min/max values.
@ CurrentCanvas
Current extent of the canvas (at the time of computation) is used to compute statistics.
@ WholeRaster
Whole raster is used to compute statistics.
void setCumulativeCutUpper(double val)
Sets the upper bound of cumulative cut method (between 0 and 1).
void setStdDevFactor(double val)
Sets the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ].
double cumulativeCutUpper() const
Returns the upper bound of cumulative cut method (between 0 and 1).
void setCumulativeCutLower(double val)
Sets the lower bound of cumulative cut method (between 0 and 1).
Limits
This enumerator describes the limits used to compute min/max values.
@ StdDev
Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ].
@ MinMax
Real min-max values.
QgsRasterMinMaxOrigin::Extent extent() const
Returns the raster extent.
#define SIP_PYNAME(name)
Definition qgis_sip.h:81
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)