QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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
SIP_PYNAME
#define SIP_PYNAME(name)
Definition: qgis_sip.h:81
QgsRasterMinMaxOrigin::setStdDevFactor
void setStdDevFactor(double val)
Sets the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ].
Definition: qgsrasterminmaxorigin.h:131
operator==
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Definition: qgsfeatureiterator.h:400
QgsRasterMinMaxOrigin::Limits
Limits
This enumerator describes the limits used to compute min/max values.
Definition: qgsrasterminmaxorigin.h:59
QgsRasterMinMaxOrigin::setStatAccuracy
void setStatAccuracy(QgsRasterMinMaxOrigin::StatAccuracy accuracy)
Sets the statistics accuracy.
Definition: qgsrasterminmaxorigin.h:122
QgsRasterMinMaxOrigin::stdDevFactor
double stdDevFactor() const
Returns the factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ].
Definition: qgsrasterminmaxorigin.h:111
QgsRasterMinMaxOrigin::StatAccuracy
StatAccuracy
This enumerator describes the accuracy used to compute statistics.
Definition: qgsrasterminmaxorigin.h:80
QgsRasterMinMaxOrigin::WholeRaster
@ WholeRaster
Whole raster is used to compute statistics.
Definition: qgsrasterminmaxorigin.h:71
QgsRasterMinMaxOrigin
This class describes the origin of min/max values.
Definition: qgsrasterminmaxorigin.h:34
QgsRasterMinMaxOrigin::MinMax
@ MinMax
Real min-max values.
Definition: qgsrasterminmaxorigin.h:61
QgsRasterMinMaxOrigin::Exact
@ Exact
Exact statistics.
Definition: qgsrasterminmaxorigin.h:82
QgsRasterMinMaxOrigin::cumulativeCutLower
double cumulativeCutLower() const
Returns the lower bound of cumulative cut method (between 0 and 1).
Definition: qgsrasterminmaxorigin.h:105
qgis_sip.h
QgsRasterMinMaxOrigin::StdDev
@ StdDev
Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ].
Definition: qgsrasterminmaxorigin.h:62
QgsRasterMinMaxOrigin::setLimits
void setLimits(QgsRasterMinMaxOrigin::Limits limits)
Sets the limits.
Definition: qgsrasterminmaxorigin.h:116
QgsRasterMinMaxOrigin::statAccuracy
QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const
Returns the raster statistic accuracy.
Definition: qgsrasterminmaxorigin.h:102
QgsRasterMinMaxOrigin::setCumulativeCutUpper
void setCumulativeCutUpper(double val)
Sets the upper bound of cumulative cut method (between 0 and 1).
Definition: qgsrasterminmaxorigin.h:128
QgsRasterMinMaxOrigin::setExtent
void setExtent(QgsRasterMinMaxOrigin::Extent extent)
Sets the extent.
Definition: qgsrasterminmaxorigin.h:119
QgsRasterMinMaxOrigin::Extent
Extent
This enumerator describes the extent used to compute min/max values.
Definition: qgsrasterminmaxorigin.h:69
QgsRasterMinMaxOrigin::None
@ None
User defined.
Definition: qgsrasterminmaxorigin.h:60
QgsRasterMinMaxOrigin::CurrentCanvas
@ CurrentCanvas
Current extent of the canvas (at the time of computation) is used to compute statistics.
Definition: qgsrasterminmaxorigin.h:73
QgsRasterMinMaxOrigin::extent
QgsRasterMinMaxOrigin::Extent extent() const
Returns the raster extent.
Definition: qgsrasterminmaxorigin.h:99
QgsRasterMinMaxOrigin::limits
QgsRasterMinMaxOrigin::Limits limits() const
Returns the raster limits.
Definition: qgsrasterminmaxorigin.h:96
QgsRasterMinMaxOrigin::setCumulativeCutLower
void setCumulativeCutLower(double val)
Sets the lower bound of cumulative cut method (between 0 and 1).
Definition: qgsrasterminmaxorigin.h:125
QgsRasterMinMaxOrigin::cumulativeCutUpper
double cumulativeCutUpper() const
Returns the upper bound of cumulative cut method (between 0 and 1).
Definition: qgsrasterminmaxorigin.h:108