QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 
48  enum Limits
49  {
50  None SIP_PYNAME( None_ ),
53  CumulativeCut
54  };
55 
57  enum Extent
58  {
64  UpdatedCanvas
65  };
66 
69  {
73  Estimated
74  };
75 
78 
80  bool operator ==( const QgsRasterMinMaxOrigin &other ) const;
81 
83 
85  QgsRasterMinMaxOrigin::Limits limits() const { return mLimits; }
86 
88  QgsRasterMinMaxOrigin::Extent extent() const { return mExtent; }
89 
91  QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const { return mAccuracy; }
92 
94  double cumulativeCutLower() const { return mCumulativeCutLower; }
95 
97  double cumulativeCutUpper() const { return mCumulativeCutUpper; }
98 
100  double stdDevFactor() const { return mStdDevFactor; }
101 
103 
105  void setLimits( QgsRasterMinMaxOrigin::Limits limits ) { mLimits = limits; }
106 
108  void setExtent( QgsRasterMinMaxOrigin::Extent extent ) { mExtent = extent; }
109 
111  void setStatAccuracy( QgsRasterMinMaxOrigin::StatAccuracy accuracy ) { mAccuracy = accuracy; }
112 
114  void setCumulativeCutLower( double val ) { mCumulativeCutLower = val; }
115 
117  void setCumulativeCutUpper( double val ) { mCumulativeCutUpper = val; }
118 
120  void setStdDevFactor( double val ) { mStdDevFactor = val; }
121 
123 
125  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
126 
128  void readXml( const QDomElement &elem );
129 
131 
133  static QString limitsString( Limits limits );
134 
136  static Limits limitsFromString( const QString &limits );
137 
139  static QString extentString( QgsRasterMinMaxOrigin::Extent extent );
140 
142  static QgsRasterMinMaxOrigin::Extent extentFromString( const QString &extent );
143 
145  static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy accuracy );
146 
148  static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString &accuracy );
149 
150  private:
151 
152  Limits mLimits = None;
153  Extent mExtent = WholeRaster;
154  StatAccuracy mAccuracy = Estimated;
155  double mCumulativeCutLower;
156  double mCumulativeCutUpper;
157  double mStdDevFactor;
158 };
159 
160 #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:74