21 #include <QCoreApplication> 22 #include <QDomDocument> 23 #include <QDomElement> 27 #define tr( sourceText ) QCoreApplication::translate ( "QgsRasterRenderer", sourceText ) 34 , mType( type ), mOpacity( 1.0 ), mRasterTransparency( nullptr )
67 if ( !input )
return false;
76 for (
int i = 1; i <= input->
bandCount(); i++ )
104 if ( rasterRendererElem.
isNull() )
121 if ( rendererElem.
isNull() )
131 if ( !rasterTransparencyElem.
isNull() )
157 name +=
"CumulativeCut";
166 name +=
"FullExtent";
188 return tr(
"Unknown" );
192 return tr(
"User defined" );
202 est_exact =
tr(
"Estimated" );
206 est_exact =
tr(
"Exact" );
211 values =
tr(
"min / max" );
215 values =
tr(
"cumulative cut" );
219 values =
tr(
"standard deviation" );
224 extent =
tr(
"full extent" );
228 extent =
tr(
"sub extent" );
232 "min/max origin label in raster properties, where %1 - estimated/exact, %2 - values (min/max, stddev, etc.), %3 - extent" )
241 if ( theName.
contains(
"Unknown" ) )
245 else if ( theName.
contains(
"User" ) )
256 else if ( theName.
contains(
"CumulativeCut" ) )
260 else if ( theName.
contains(
"StdDev" ) )
265 if ( theName.
contains(
"FullExtent" ) )
269 else if ( theName.
contains(
"SubExtent" ) )
274 if ( theName.
contains(
"Estimated" ) )
278 else if ( theName.
contains(
"Exact" ) )
virtual int bandCount() const =0
Get number of bands.
Unknown or unspecified type.
QString attribute(const QString &name, const QString &defValue) const
static bool typeIsNumeric(QGis::DataType type)
Returns true if data type is numeric.
static int minMaxOriginFromName(const QString &theName)
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)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
#define QgsDebugMsgLevel(str, level)
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)
QgsRasterRenderer(QgsRasterInterface *input=nullptr, const QString &type="")
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.