|
| 1 | +/** \class QgsRasterMinMaxOrigin |
| 2 | + * This class describes the origin of min/max values. It does not store by |
| 3 | + * itself the min/max values. |
| 4 | + */ |
| 5 | + |
| 6 | +class QgsRasterMinMaxOrigin |
| 7 | +{ |
| 8 | +%TypeHeaderCode |
| 9 | +#include <qgsrasterminmaxorigin.h> |
| 10 | +%End |
| 11 | + public: |
| 12 | + //! \brief Default cumulative cut lower limit |
| 13 | + static const double CUMULATIVE_CUT_LOWER; |
| 14 | + |
| 15 | + //! \brief Default cumulative cut upper limit |
| 16 | + static const double CUMULATIVE_CUT_UPPER; |
| 17 | + |
| 18 | + //! \brief Default standard deviation factor |
| 19 | + static const double DEFAULT_STDDEV_FACTOR; |
| 20 | + |
| 21 | + //! \brief This enumerator describes the limits used to compute min/max values |
| 22 | + enum Limits |
| 23 | + { |
| 24 | + //! User defined. |
| 25 | + None /PyName=None_/, |
| 26 | + //! Real min-max values |
| 27 | + MinMax, |
| 28 | + //! Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ] |
| 29 | + StdDev, |
| 30 | + //! Range is [ min + cumulativeCutLower() * (max - min), min + cumulativeCutUpper() * (max - min) ] |
| 31 | + CumulativeCut |
| 32 | + }; |
| 33 | + |
| 34 | + //! \brief This enumerator describes the extent used to compute min/max values |
| 35 | + enum Extent |
| 36 | + { |
| 37 | + //! Whole raster is used to compute statistics. |
| 38 | + WholeRaster, |
| 39 | + //! Current extent of the canvas (at the time of computation) is used to compute statistics. |
| 40 | + CurrentCanvas, |
| 41 | + //! Constantly updated extent of the canvas is used to compute statistics. |
| 42 | + UpdatedCanvas |
| 43 | + }; |
| 44 | + |
| 45 | + //! \brief This enumerator describes the accuracy used to compute statistics. |
| 46 | + enum StatAccuracy |
| 47 | + { |
| 48 | + //! Exact statistics. |
| 49 | + Exact, |
| 50 | + //! Approximated statistics. |
| 51 | + Estimated |
| 52 | + }; |
| 53 | + |
| 54 | + //! \brief Default constructor. |
| 55 | + QgsRasterMinMaxOrigin(); |
| 56 | + |
| 57 | + //! \brief Equality operator. |
| 58 | + bool operator ==( const QgsRasterMinMaxOrigin& other ) const; |
| 59 | + |
| 60 | + //////// Getter methods ///////////////////// |
| 61 | + |
| 62 | + //! \brief Return limits. |
| 63 | + QgsRasterMinMaxOrigin::Limits limits() const; |
| 64 | + |
| 65 | + //! \brief Return extent. |
| 66 | + QgsRasterMinMaxOrigin::Extent extent() const; |
| 67 | + |
| 68 | + //! \brief Return statistic accuracy. |
| 69 | + QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const; |
| 70 | + |
| 71 | + //! \brief Return lower bound of cumulative cut method (between 0 and 1). |
| 72 | + double cumulativeCutLower() const; |
| 73 | + |
| 74 | + //! \brief Return upper bound of cumulative cut method (between 0 and 1). |
| 75 | + double cumulativeCutUpper() const; |
| 76 | + |
| 77 | + //! \brief Return factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ] |
| 78 | + double stdDevFactor() const; |
| 79 | + |
| 80 | + //////// Setter methods ///////////////////// |
| 81 | + |
| 82 | + //! \brief Set limits. |
| 83 | + void setLimits(QgsRasterMinMaxOrigin::Limits theLimits); |
| 84 | + |
| 85 | + //! \brief Set extent. |
| 86 | + void setExtent(QgsRasterMinMaxOrigin::Extent theExtent); |
| 87 | + |
| 88 | + //! \brief Set statistics accuracy. |
| 89 | + void setStatAccuracy(QgsRasterMinMaxOrigin::StatAccuracy theAccuracy); |
| 90 | + |
| 91 | + //! \brief Set lower bound of cumulative cut method (between 0 and 1). |
| 92 | + void setCumulativeCutLower(double val); |
| 93 | + |
| 94 | + //! \brief Set upper bound of cumulative cut method (between 0 and 1). |
| 95 | + void setCumulativeCutUpper(double val); |
| 96 | + |
| 97 | + //! \brief Set factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ] |
| 98 | + void setStdDevFactor(double val); |
| 99 | + |
| 100 | + //////// XML serialization ///////////////////// |
| 101 | + |
| 102 | + //! \brief Serialize object. |
| 103 | + void writeXml( QDomDocument& doc, QDomElement& parentElem ) const; |
| 104 | + |
| 105 | + //! \brief Deserialize object. |
| 106 | + void readXml( const QDomElement& elem ); |
| 107 | + |
| 108 | + //////// Static methods ///////////////////// |
| 109 | + |
| 110 | + //! \brief Return a string to serialize Limits |
| 111 | + static QString limitsString( QgsRasterMinMaxOrigin::Limits theLimits ); |
| 112 | + |
| 113 | + //! \brief Deserialize Limits |
| 114 | + static QgsRasterMinMaxOrigin::Limits limitsFromString( const QString& theLimits ); |
| 115 | + |
| 116 | + //! \brief Return a string to serialize Extent |
| 117 | + static QString extentString( QgsRasterMinMaxOrigin::Extent theExtent ); |
| 118 | + |
| 119 | + //! \brief Deserialize Extent |
| 120 | + static QgsRasterMinMaxOrigin::Extent extentFromString( const QString& theExtent ); |
| 121 | + |
| 122 | + //! \brief Return a string to serialize StatAccuracy |
| 123 | + static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy theAccuracy ); |
| 124 | + |
| 125 | + //! \brief Deserialize StatAccuracy |
| 126 | + static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString& theAccuracy ); |
| 127 | +}; |
0 commit comments