24#include <QDomDocument>
40 return mLimits == other.mLimits &&
41 mExtent == other.mExtent &&
42 mAccuracy == other.mAccuracy &&
43 std::fabs( mCumulativeCutLower - other.mCumulativeCutLower ) < 1e-5 &&
44 std::fabs( mCumulativeCutUpper - other.mCumulativeCutUpper ) < 1e-5 &&
45 std::fabs( mStdDevFactor - other.mStdDevFactor ) < 1e-5;
53 return QStringLiteral(
"MinMax" );
55 return QStringLiteral(
"StdDev" );
57 return QStringLiteral(
"CumulativeCut" );
61 return QStringLiteral(
"None" );
66 if (
limits == QLatin1String(
"MinMax" ) )
70 else if (
limits == QLatin1String(
"StdDev" ) )
74 else if (
limits == QLatin1String(
"CumulativeCut" ) )
83 switch ( minMaxExtent )
86 return QStringLiteral(
"WholeRaster" );
88 return QStringLiteral(
"CurrentCanvas" );
90 return QStringLiteral(
"UpdatedCanvas" );
92 return QStringLiteral(
"WholeRaster" );
97 if (
extent == QLatin1String(
"WholeRaster" ) )
101 else if (
extent == QLatin1String(
"CurrentCanvas" ) )
105 else if (
extent == QLatin1String(
"UpdatedCanvas" ) )
120 return QStringLiteral(
"Exact" );
122 return QStringLiteral(
"Estimated" );
129 if ( accuracy == QLatin1String(
"Exact" ) )
137 QDomElement limitsElem = doc.createElement( QStringLiteral(
"limits" ) );
138 const QDomText limitsText = doc.createTextNode(
limitsString( mLimits ) );
139 limitsElem.appendChild( limitsText );
140 parentElem.appendChild( limitsElem );
143 QDomElement extentElem = doc.createElement( QStringLiteral(
"extent" ) );
144 const QDomText extentText = doc.createTextNode(
extentString( mExtent ) );
145 extentElem.appendChild( extentText );
146 parentElem.appendChild( extentElem );
149 QDomElement statAccuracyElem = doc.createElement( QStringLiteral(
"statAccuracy" ) );
150 const QDomText statAccuracyText = doc.createTextNode(
statAccuracyString( mAccuracy ) );
151 statAccuracyElem.appendChild( statAccuracyText );
152 parentElem.appendChild( statAccuracyElem );
155 QDomElement cumulativeCutLowerElem = doc.createElement( QStringLiteral(
"cumulativeCutLower" ) );
156 const QDomText cumulativeCutLowerText = doc.createTextNode( QString::number( mCumulativeCutLower ) );
157 cumulativeCutLowerElem.appendChild( cumulativeCutLowerText );
158 parentElem.appendChild( cumulativeCutLowerElem );
161 QDomElement cumulativeCutUpperElem = doc.createElement( QStringLiteral(
"cumulativeCutUpper" ) );
162 const QDomText cumulativeCutUpperText = doc.createTextNode( QString::number( mCumulativeCutUpper ) );
163 cumulativeCutUpperElem.appendChild( cumulativeCutUpperText );
164 parentElem.appendChild( cumulativeCutUpperElem );
167 QDomElement stdDevFactorElem = doc.createElement( QStringLiteral(
"stdDevFactor" ) );
168 const QDomText stdDevFactorText = doc.createTextNode( QString::number( mStdDevFactor ) );
169 stdDevFactorElem.appendChild( stdDevFactorText );
170 parentElem.appendChild( stdDevFactorElem );
175 const QDomElement limitsElem = elem.firstChildElement( QStringLiteral(
"limits" ) );
176 if ( !limitsElem.isNull() )
181 const QDomElement extentElem = elem.firstChildElement( QStringLiteral(
"extent" ) );
182 if ( !extentElem.isNull() )
187 const QDomElement statAccuracyElem = elem.firstChildElement( QStringLiteral(
"statAccuracy" ) );
188 if ( !statAccuracyElem.isNull() )
193 const QDomElement cumulativeCutLowerElem = elem.firstChildElement( QStringLiteral(
"cumulativeCutLower" ) );
194 if ( !cumulativeCutLowerElem.isNull() )
196 mCumulativeCutLower = cumulativeCutLowerElem.text().toDouble();
199 const QDomElement cumulativeCutUpperElem = elem.firstChildElement( QStringLiteral(
"cumulativeCutUpper" ) );
200 if ( !cumulativeCutUpperElem.isNull() )
202 mCumulativeCutUpper = cumulativeCutUpperElem.text().toDouble();
205 const QDomElement stdDevFactorElem = elem.firstChildElement( QStringLiteral(
"stdDevFactor" ) );
206 if ( !stdDevFactorElem.isNull() )
208 mStdDevFactor = stdDevFactorElem.text().toDouble();
RasterRangeLimit
Describes the limits used to compute raster ranges (min/max values).
@ CumulativeCut
Range is [ min + cumulativeCutLower() * (max - min), min + cumulativeCutUpper() * (max - min) ].
@ StdDev
Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ].
@ MinimumMaximum
Real min-max values.
RasterRangeAccuracy
Describes the accuracy used to compute raster ranges (min/max values).
@ Estimated
Approximated statistics.
RasterRangeExtent
Describes the extent used to compute raster ranges (min/max values).
@ UpdatedCanvas
Constantly updated extent of the canvas is used to compute statistics.
@ WholeRaster
Whole raster is used to compute statistics.
@ FixedCanvas
Current extent of the canvas (at the time of computation) is used to compute statistics.
static QString limitsString(Qgis::RasterRangeLimit limits)
Returns a string to serialize Limits.
Qgis::RasterRangeExtent extent() const
Returns the raster extent.
static Qgis::RasterRangeAccuracy statAccuracyFromString(const QString &accuracy)
Deserialize StatAccuracy.
static constexpr double CUMULATIVE_CUT_UPPER
Default cumulative cut upper limit.
static QString statAccuracyString(Qgis::RasterRangeAccuracy accuracy)
Returns a string to serialize StatAccuracy.
static constexpr double DEFAULT_STDDEV_FACTOR
Default standard deviation factor.
static QString extentString(Qgis::RasterRangeExtent extent)
Returns a string to serialize Extent.
bool operator==(const QgsRasterMinMaxOrigin &other) const
static constexpr double CUMULATIVE_CUT_LOWER
Default cumulative cut lower limit.
void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Serialize object.
void readXml(const QDomElement &elem)
Deserialize object.
static Qgis::RasterRangeLimit limitsFromString(const QString &limits)
Deserialize Limits.
Qgis::RasterRangeLimit limits() const
Returns the raster limits.
static Qgis::RasterRangeExtent extentFromString(const QString &extent)
Deserialize Extent.
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
#define BUILTIN_UNREACHABLE