QGIS API Documentation 3.41.0-Master (3440c17df1d)
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
87
88 bool operator ==( const QgsRasterMinMaxOrigin &other ) const;
89
91
93 QgsRasterMinMaxOrigin::Limits limits() const { return mLimits; }
94
96 QgsRasterMinMaxOrigin::Extent extent() const { return mExtent; }
97
100
102 double cumulativeCutLower() const { return mCumulativeCutLower; }
103
105 double cumulativeCutUpper() const { return mCumulativeCutUpper; }
106
108 double stdDevFactor() const { return mStdDevFactor; }
109
111
113 void setLimits( QgsRasterMinMaxOrigin::Limits limits ) { mLimits = limits; }
114
116 void setExtent( QgsRasterMinMaxOrigin::Extent extent ) { mExtent = extent; }
117
119 void setStatAccuracy( QgsRasterMinMaxOrigin::StatAccuracy accuracy ) { mAccuracy = accuracy; }
120
122 void setCumulativeCutLower( double val ) { mCumulativeCutLower = val; }
123
125 void setCumulativeCutUpper( double val ) { mCumulativeCutUpper = val; }
126
128 void setStdDevFactor( double val ) { mStdDevFactor = val; }
129
131
133 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
134
136 void readXml( const QDomElement &elem );
137
139
141 static QString limitsString( Limits limits );
142
144 static Limits limitsFromString( const QString &limits );
145
147 static QString extentString( QgsRasterMinMaxOrigin::Extent extent );
148
150 static QgsRasterMinMaxOrigin::Extent extentFromString( const QString &extent );
151
153 static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy accuracy );
154
156 static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString &accuracy );
157
158 private:
159
160 Limits mLimits = None;
161 Extent mExtent = WholeRaster;
162 StatAccuracy mAccuracy = Estimated;
163 double mCumulativeCutLower;
164 double mCumulativeCutUpper;
165 double mStdDevFactor;
166};
167
168#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)