21 #include <QDomDocument>
22 #include <QDomElement>
26 : mCumulativeCutLower( CUMULATIVE_CUT_LOWER )
27 , mCumulativeCutUpper( CUMULATIVE_CUT_UPPER )
28 , mStdDevFactor( DEFAULT_STDDEV_FACTOR )
38 return mLimits == other.mLimits &&
39 mExtent == other.mExtent &&
40 mAccuracy == other.mAccuracy &&
41 std::fabs( mCumulativeCutLower - other.mCumulativeCutLower ) < 1e-5 &&
42 std::fabs( mCumulativeCutUpper - other.mCumulativeCutUpper ) < 1e-5 &&
43 std::fabs( mStdDevFactor - other.mStdDevFactor ) < 1e-5;
51 return QStringLiteral(
"MinMax" );
53 return QStringLiteral(
"StdDev" );
55 return QStringLiteral(
"CumulativeCut" );
59 return QStringLiteral(
"None" );
64 if (
limits == QLatin1String(
"MinMax" ) )
68 else if (
limits == QLatin1String(
"StdDev" ) )
72 else if (
limits == QLatin1String(
"CumulativeCut" ) )
81 switch ( minMaxExtent )
84 return QStringLiteral(
"WholeRaster" );
86 return QStringLiteral(
"CurrentCanvas" );
88 return QStringLiteral(
"UpdatedCanvas" );
90 return QStringLiteral(
"WholeRaster" );
95 if (
extent == QLatin1String(
"WholeRaster" ) )
99 else if (
extent == QLatin1String(
"CurrentCanvas" ) )
103 else if (
extent == QLatin1String(
"UpdatedCanvas" ) )
115 if ( accuracy ==
Exact )
116 return QStringLiteral(
"Exact" );
117 return QStringLiteral(
"Estimated" );
122 if ( accuracy == QLatin1String(
"Exact" ) )
130 QDomElement limitsElem = doc.createElement( QStringLiteral(
"limits" ) );
131 QDomText limitsText = doc.createTextNode(
limitsString( mLimits ) );
132 limitsElem.appendChild( limitsText );
133 parentElem.appendChild( limitsElem );
136 QDomElement extentElem = doc.createElement( QStringLiteral(
"extent" ) );
137 QDomText extentText = doc.createTextNode(
extentString( mExtent ) );
138 extentElem.appendChild( extentText );
139 parentElem.appendChild( extentElem );
142 QDomElement statAccuracyElem = doc.createElement( QStringLiteral(
"statAccuracy" ) );
144 statAccuracyElem.appendChild( statAccuracyText );
145 parentElem.appendChild( statAccuracyElem );
148 QDomElement cumulativeCutLowerElem = doc.createElement( QStringLiteral(
"cumulativeCutLower" ) );
149 QDomText cumulativeCutLowerText = doc.createTextNode( QString::number( mCumulativeCutLower ) );
150 cumulativeCutLowerElem.appendChild( cumulativeCutLowerText );
151 parentElem.appendChild( cumulativeCutLowerElem );
154 QDomElement cumulativeCutUpperElem = doc.createElement( QStringLiteral(
"cumulativeCutUpper" ) );
155 QDomText cumulativeCutUpperText = doc.createTextNode( QString::number( mCumulativeCutUpper ) );
156 cumulativeCutUpperElem.appendChild( cumulativeCutUpperText );
157 parentElem.appendChild( cumulativeCutUpperElem );
160 QDomElement stdDevFactorElem = doc.createElement( QStringLiteral(
"stdDevFactor" ) );
161 QDomText stdDevFactorText = doc.createTextNode( QString::number( mStdDevFactor ) );
162 stdDevFactorElem.appendChild( stdDevFactorText );
163 parentElem.appendChild( stdDevFactorElem );
168 QDomElement limitsElem = elem.firstChildElement( QStringLiteral(
"limits" ) );
169 if ( !limitsElem.isNull() )
174 QDomElement extentElem = elem.firstChildElement( QStringLiteral(
"extent" ) );
175 if ( !extentElem.isNull() )
180 QDomElement statAccuracyElem = elem.firstChildElement( QStringLiteral(
"statAccuracy" ) );
181 if ( !statAccuracyElem.isNull() )
186 QDomElement cumulativeCutLowerElem = elem.firstChildElement( QStringLiteral(
"cumulativeCutLower" ) );
187 if ( !cumulativeCutLowerElem.isNull() )
189 mCumulativeCutLower = cumulativeCutLowerElem.text().toDouble();
192 QDomElement cumulativeCutUpperElem = elem.firstChildElement( QStringLiteral(
"cumulativeCutUpper" ) );
193 if ( !cumulativeCutUpperElem.isNull() )
195 mCumulativeCutUpper = cumulativeCutUpperElem.text().toDouble();
198 QDomElement stdDevFactorElem = elem.firstChildElement( QStringLiteral(
"stdDevFactor" ) );
199 if ( !stdDevFactorElem.isNull() )
201 mStdDevFactor = stdDevFactorElem.text().toDouble();