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() )
120 if ( rendererElem.
isNull() )
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" );
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" ) )
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" ) )
virtual int bandCount() const =0
Get number of bands.
static int minMaxOriginFromName(QString theName)
QString attribute(const QString &name, const QString &defValue) const
static bool typeIsNumeric(QGis::DataType type)
Returns true if data type is numeric.
QgsRasterRenderer(QgsRasterInterface *input=0, const QString &type="")
virtual QgsRasterInterface * input() const
Current input.
double toDouble(bool *ok) const
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
void readXML(const QDomElement &rendererElem) override
Sets base class members from xml.
bool usesTransparency() const
QgsRasterTransparency * mRasterTransparency
Raster transparency per color or value.
static const QRgb NODATA_COLOR
virtual bool setInput(QgsRasterInterface *input) override
Set input.
QString number(int n, int base)
void setAttribute(const QString &name, const QString &value)
int toInt(bool *ok, int base) const
static QString minMaxOriginLabel(int theOrigin)
bool isEmpty() const
True if there are no entries in the pixel lists except the nodata value.
virtual ~QgsRasterRenderer()
int mAlphaBand
Read alpha value from band.
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual int bandCount() const override
Get number of bands.
Base class for processing filters like renderers, reprojector, resampler etc.
bool contains(QChar ch, Qt::CaseSensitivity cs) const
virtual QgsRectangle extent()
Get the extent of the interface.
QDomElement firstChildElement(const QString &tagName) const
QString translate(const char *context, const char *sourceText, const char *disambiguation, Encoding encoding)
void writeXML(QDomDocument &doc, QDomElement &parentElem) const
static QString minMaxOriginName(int theOrigin)
DataType
Raster data types.
void readXML(const QDomElement &elem)
double mOpacity
Global alpha value (0-1)
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
void _writeXML(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXML method of subclasses) ...
QgsRasterInterface * mInput
void setRasterTransparency(QgsRasterTransparency *t)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
virtual QGis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.