21 #include <QCoreApplication>
22 #include <QDomDocument>
23 #include <QDomElement>
27 #define tr( sourceText ) QCoreApplication::translate ( "QgsRasterRenderer", sourceText )
34 , mType( type ), mOpacity( 1.0 ), mRasterTransparency( 0 )
66 if ( !input )
return false;
75 for (
int i = 1; i <= input->
bandCount(); i++ )
103 if ( rasterRendererElem.isNull() )
108 rasterRendererElem.setAttribute(
"type",
mType );
109 rasterRendererElem.setAttribute(
"opacity", QString::number(
mOpacity ) );
110 rasterRendererElem.setAttribute(
"alphaBand",
mAlphaBand );
120 if ( rendererElem.isNull() )
125 mType = rendererElem.attribute(
"type" );
126 mOpacity = rendererElem.attribute(
"opacity",
"1.0" ).toDouble();
127 mAlphaBand = rendererElem.attribute(
"alphaBand",
"-1" ).toInt();
129 QDomElement rasterTransparencyElem = rendererElem.firstChildElement(
"rasterTransparency" );
130 if ( !rasterTransparencyElem.isNull() )
156 name +=
"CumulativeCut";
165 name +=
"FullExtent";
187 return tr(
"Unknown" );
191 return tr(
"User defined" );
201 est_exact =
tr(
"Estimated" );
205 est_exact =
tr(
"Exact" );
210 values =
tr(
"min / max" );
214 values =
tr(
"cumulative cut" );
218 values =
tr(
"standard deviation" );
223 extent =
tr(
"full extent" );
227 extent =
tr(
"sub extent" );
230 label = QCoreApplication::translate(
"QgsRasterRenderer",
"%1 %2 of %3.",
231 "min/max origin label in raster properties, where %1 - estimated/exact, %2 - values (min/max, stddev, etc.), %3 - extent" )
240 if ( theName.contains(
"Unknown" ) )
244 else if ( theName.contains(
"User" ) )
251 if ( theName.contains(
"MinMax" ) )
255 else if ( theName.contains(
"CumulativeCut" ) )
259 else if ( theName.contains(
"StdDev" ) )
264 if ( theName.contains(
"FullExtent" ) )
268 else if ( theName.contains(
"SubExtent" ) )
273 if ( theName.contains(
"Estimated" ) )
277 else if ( theName.contains(
"Exact" ) )