22 #include <QDomDocument>    23 #include <QDomElement>    30     , mClassificationMin( std::numeric_limits<double>::quiet_NaN() )
    31     , mClassificationMax( std::numeric_limits<double>::quiet_NaN() )
    61     if ( origColorRampShader )
    66       colorRampShader->
setClip( origColorRampShader->clip() );
    93   if ( !rasterShaderElem.
isNull() )
    96     shader->
readXML( rasterShaderElem );
   112   return block2( bandNo, extent, width, height );
   120   if ( !
mInput || !mShader )
   127   if ( !inputBlock || inputBlock->
isEmpty() )
   141     if ( !alphaBlock || alphaBlock->
isEmpty() )
   150     alphaBlock = inputBlock;
   166       outputBlock->
setColor( i, myDefaultColor );
   169     double val = inputBlock->
value( i );
   170     int red, green, blue, alpha;
   171     if ( !mShader->
shade( val, &red, &green, &blue, &alpha ) )
   173       outputBlock->
setColor( i, myDefaultColor );
   180       red *= ( alpha / 255.0 );
   181       blue *= ( alpha / 255.0 );
   182       green *= ( alpha / 255.0 );
   185     if ( !hasTransparency )
   187       outputBlock->
setColor( i, qRgba( red, green, blue, alpha ) );
   199         currentOpacity *= alphaBlock->
value( i ) / 255.0;
   202       outputBlock->
setColor( i, qRgba( currentOpacity * red, currentOpacity * green, currentOpacity * blue, currentOpacity * alpha ) );
   217   if ( parentElem.
isNull() )
   227     mShader->
writeXML( doc, rasterRendererElem ); 
   241     if ( shaderFunction )
 virtual int bandCount() const =0
Get number of bands. 
 
A rectangle specified with double values. 
 
Interface for all raster shaders. 
 
static QString printValue(double value)
Print double value with all necessary significant digits. 
 
void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const override
Get symbology items if provided by renderer. 
 
QDomNode appendChild(const QDomNode &newChild)
 
QgsSingleBandPseudoColorRenderer * clone() const override
Clone itself, create deep copy. 
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
A ramp shader will color a raster pixel based on a list of values ranges in a ramp. 
 
QString attribute(const QString &name, const QString &defValue) const
 
int alphaValue(double, int theGlobalTransparency=255) const
Returns the transparency value for a single value Pixel. 
 
void setClassificationMinMaxOrigin(int origin)
 
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)
 
void setColorRampItemList(const QList< QgsColorRampShader::ColorRampItem > &theList)
Set custom colormap. 
 
void setClip(bool clip)
Sets whether the shader should not render values out of range. 
 
double toDouble(bool *ok) const
 
virtual void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const
 
QgsRasterShader * shader()
 
void setClassificationMax(double max)
 
bool isNoData(int row, int column)
Check if value at position is no data. 
 
void writeXML(QDomDocument &doc, QDomElement &parent) const
 
void setShader(QgsRasterShader *shader)
Takes ownership of the shader. 
 
void readXML(const QDomElement &rendererElem) override
Sets base class members from xml. 
 
void writeXML(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml. 
 
virtual QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using given extent and size. 
 
QgsRasterTransparency * mRasterTransparency
Raster transparency per color or value. 
 
bool setColor(int row, int column, QRgb color)
Set color on position. 
 
static const QRgb NODATA_COLOR
 
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied. 
 
QgsSingleBandPseudoColorRenderer(QgsRasterInterface *input, int band, QgsRasterShader *shader)
Note: takes ownership of QgsRasterShader. 
 
void setAttribute(const QString &name, const QString &value)
 
int toInt(bool *ok, int base) const
 
QgsRasterShaderFunction * rasterShaderFunction()
 
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height) override
Read block of data using given extent and size. 
 
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
 
double maximumValue()
Return the maximum value for the raster shader. 
 
Raster renderer pipe for single band pseudocolor. 
 
bool usesTransparency() const
 
bool shade(double, int *, int *, int *, int *)
generates and new RGBA value based on one input value 
 
bool isEmpty() const
Returns true if block is empty, i.e. 
 
void _writeXML(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXML method of subclasses) ...
 
QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size. 
 
int mAlphaBand
Read alpha value from band. 
 
QList< int > usesBands() const override
Returns a list of band numbers used by the renderer. 
 
void setRasterShaderFunction(QgsRasterShaderFunction *)
A public method that allows the user to set their own shader function. 
 
Base class for processing filters like renderers, reprojector, resampler etc. 
 
void setColorRampType(QgsColorRampShader::ColorRamp_TYPE theColorRampType)
Set the color ramp type. 
 
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
 
bool reset(QGis::DataType theDataType, int theWidth, int theHeight)
Reset block. 
 
~QgsSingleBandPseudoColorRenderer()
 
virtual QgsRectangle extent()
Get the extent of the interface. 
 
void setClassificationMin(double min)
 
QDomElement firstChildElement(const QString &tagName) const
 
static QString minMaxOriginName(int theOrigin)
 
double minimumValue()
Return the minimum value for the raster shader. 
 
double value(int row, int column) const
Read a single value if type of block is numeric. 
 
void setBand(int bandNo)
Sets the band used by the renderer. 
 
double mOpacity
Global alpha value (0-1) 
 
void readXML(const QDomElement &elem)
 
QDomElement createElement(const QString &tagName)
 
QgsRasterInterface * mInput
 
Feedback object tailored for raster block reading. 
 
Raster renderer pipe that applies colors to a raster. 
 
int band() const
Returns the band used by the renderer.