21 #include <QCoreApplication> 22 #include <QDomDocument> 23 #include <QDomElement> 32 , mType( type ), mOpacity( 1.0 ), mRasterTransparency( nullptr )
65 if ( !input )
return false;
74 for (
int i = 1; i <= input->
bandCount(); i++ )
102 if ( rasterRendererElem.
isNull() )
119 if ( rendererElem.
isNull() )
129 if ( !rasterTransparencyElem.
isNull() )
165 name +=
"CumulativeCut";
174 name +=
"FullExtent";
196 return tr(
"Unknown" );
200 return tr(
"User defined" );
210 est_exact = tr(
"Estimated" );
214 est_exact = tr(
"Exact" );
219 values = tr(
"min / max" );
223 values = tr(
"cumulative cut" );
227 values = tr(
"standard deviation" );
232 extent = tr(
"full extent" );
236 extent = tr(
"sub extent" );
240 "min/max origin label in raster properties, where %1 - estimated/exact, %2 - values (min/max, stddev, etc.), %3 - extent" )
249 if ( theName.
contains(
"Unknown" ) )
253 else if ( theName.
contains(
"User" ) )
264 else if ( theName.
contains(
"CumulativeCut" ) )
268 else if ( theName.
contains(
"StdDev" ) )
273 if ( theName.
contains(
"FullExtent" ) )
277 else if ( theName.
contains(
"SubExtent" ) )
282 if ( theName.
contains(
"Estimated" ) )
286 else if ( theName.
contains(
"Exact" ) )
virtual int bandCount() const =0
Get number of bands.
bool isEmpty() const
True if there are no entries in the pixel lists except the nodata value.
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.
virtual QgsRasterInterface * input() const
Current input.
void copyCommonProperties(const QgsRasterRenderer *other)
Copies common properties like opacity / transparency data from other renderer.
static int minMaxOriginFromName(const QString &theName)
double toDouble(bool *ok) const
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
const QgsRasterTransparency * rasterTransparency() const
void readXML(const QDomElement &rendererElem) override
Sets base class members from xml.
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 usesTransparency() const
void _writeXML(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXML method of subclasses) ...
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.
void setAlphaBand(int band)
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)
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)
void writeXML(QDomDocument &doc, QDomElement &parentElem) const
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
void setOpacity(double opacity)
QgsRasterInterface * mInput
void setRasterTransparency(QgsRasterTransparency *t)
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Raster renderer pipe that applies colors to a raster.
virtual QGis::DataType dataType(int bandNo) const override
Returns data type for the band specified by number.