QGIS API Documentation  3.13.0-Master (b0e71a822e)
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 
33 class CORE_EXPORT QgsRasterMinMaxOrigin
34 {
35 
36  public:
37 
39  static constexpr double CUMULATIVE_CUT_LOWER = 0.02;
40 
42  static constexpr double CUMULATIVE_CUT_UPPER = 0.98;
43 
45  static constexpr double DEFAULT_STDDEV_FACTOR = 2.0;
46 
47 #ifdef SIP_RUN
48  enum Limits
50  {
51  None SIP_PYNAME( None_ ),
52  MinMax,
53  StdDev,
54  CumulativeCut
55  };
56 #else
57  enum Limits
59  {
60  None,
63  CumulativeCut
64  };
65 #endif
66 
68  enum Extent
69  {
75  UpdatedCanvas
76  };
77 
80  {
84  Estimated
85  };
86 
89 
91  bool operator ==( const QgsRasterMinMaxOrigin &other ) const;
92 
94 
96  QgsRasterMinMaxOrigin::Limits limits() const { return mLimits; }
97 
99  QgsRasterMinMaxOrigin::Extent extent() const { return mExtent; }
100 
102  QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const { return mAccuracy; }
103 
105  double cumulativeCutLower() const { return mCumulativeCutLower; }
106 
108  double cumulativeCutUpper() const { return mCumulativeCutUpper; }
109 
111  double stdDevFactor() const { return mStdDevFactor; }
112 
114 
116  void setLimits( QgsRasterMinMaxOrigin::Limits limits ) { mLimits = limits; }
117 
119  void setExtent( QgsRasterMinMaxOrigin::Extent extent ) { mExtent = extent; }
120 
122  void setStatAccuracy( QgsRasterMinMaxOrigin::StatAccuracy accuracy ) { mAccuracy = accuracy; }
123 
125  void setCumulativeCutLower( double val ) { mCumulativeCutLower = val; }
126 
128  void setCumulativeCutUpper( double val ) { mCumulativeCutUpper = val; }
129 
131  void setStdDevFactor( double val ) { mStdDevFactor = val; }
132 
134 
136  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
137 
139  void readXml( const QDomElement &elem );
140 
142 
144  static QString limitsString( Limits limits );
145 
147  static Limits limitsFromString( const QString &limits );
148 
150  static QString extentString( QgsRasterMinMaxOrigin::Extent extent );
151 
153  static QgsRasterMinMaxOrigin::Extent extentFromString( const QString &extent );
154 
156  static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy accuracy );
157 
159  static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString &accuracy );
160 
161  private:
162 
163  Limits mLimits = None;
164  Extent mExtent = WholeRaster;
165  StatAccuracy mAccuracy = Estimated;
166  double mCumulativeCutLower;
167  double mCumulativeCutUpper;
168  double mStdDevFactor;
169 };
170 
171 #endif // QGSRASTERMINMAXORIGIN_H
QgsRasterMinMaxOrigin::Limits limits() const
Returns the raster limits.
QgsRasterMinMaxOrigin::Extent extent() const
Returns the raster extent.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Extent
This enumerator describes the extent used to compute min/max values.
StatAccuracy
This enumerator describes the accuracy used to compute statistics.
Current extent of the canvas (at the time of computation) is used to compute statistics.
void setExtent(QgsRasterMinMaxOrigin::Extent extent)
Sets the extent.
double cumulativeCutLower() const
Returns the lower bound of cumulative cut method (between 0 and 1).
This class describes the origin of min/max values.
double cumulativeCutUpper() const
Returns the upper bound of cumulative cut method (between 0 and 1).
Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ].
void setStdDevFactor(double val)
Sets the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]...
Limits
This enumerator describes the limits used to compute min/max values.
void setCumulativeCutLower(double val)
Sets the lower bound of cumulative cut method (between 0 and 1).
void setLimits(QgsRasterMinMaxOrigin::Limits limits)
Sets the limits.
void setStatAccuracy(QgsRasterMinMaxOrigin::StatAccuracy accuracy)
Sets the statistics accuracy.
Whole raster is used to compute statistics.
QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const
Returns the raster statistic accuracy.
void setCumulativeCutUpper(double val)
Sets the upper bound of cumulative cut method (between 0 and 1).
double stdDevFactor() const
Returns the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]...
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81