QGIS API Documentation 3.43.0-Master (7a94ac641b4)
qgssinglebandpseudocolorrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssinglebandpseudocolorrenderer.h
3 ----------------------------------
4 begin : January 2012
5 copyright : (C) 2012 by Marco Hugentobler
6 email : marco at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSINGLEBANDPSEUDOCOLORRENDERER_H
19#define QGSSINGLEBANDPSEUDOCOLORRENDERER_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgscolorramp.h"
24#include "qgsrasterrenderer.h"
25#include "qgsrectangle.h"
26
27class QDomElement;
28class QgsRasterShader;
29
35{
36
37 public:
38
40 QgsSingleBandPseudoColorRenderer( QgsRasterInterface *input, int band = -1, QgsRasterShader *shader SIP_TRANSFER = nullptr );
41
46
48 Qgis::RasterRendererFlags flags() const override;
49 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
50
51 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
52
54 void setShader( QgsRasterShader *shader SIP_TRANSFER );
55
57 QgsRasterShader *shader() { return mShader.get(); }
58
60 const QgsRasterShader *shader() const SIP_PYNAME( constShader ) { return mShader.get(); }
61
62 bool canCreateRasterAttributeTable( ) const override;
63
73 void createShader( QgsColorRamp *colorRamp SIP_TRANSFER = nullptr,
76 int classes = 0,
77 bool clip = false,
78 const QgsRectangle &extent = QgsRectangle() );
79
80 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
81 QList< QPair< QString, QColor > > legendSymbologyItems() const override;
82 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
83 QList<int> usesBands() const override;
84 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override SIP_DEPRECATED;
85 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
86 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
87
93 Q_DECL_DEPRECATED int band() const SIP_DEPRECATED { return mBand; }
94
101 Q_DECL_DEPRECATED void setBand( int bandNo ) SIP_DEPRECATED;
102
103 int inputBand() const override;
104 bool setInputBand( int band ) override;
105
106 double classificationMin() const { return mClassificationMin; }
107 double classificationMax() const { return mClassificationMax; }
108 void setClassificationMin( double min );
109 void setClassificationMax( double max );
110
121 bool refresh( const QgsRectangle &extent, const QList<double> &min, const QList<double> &max, bool forceRefresh = false ) override SIP_SKIP;
122
123 private:
124#ifdef SIP_RUN
127#endif
128
129 std::unique_ptr< QgsRasterShader > mShader;
130 int mBand;
131
132 // Minimum and maximum values used for automatic classification, these
133 // values are not used by renderer in rendering process
134 double mClassificationMin;
135 double mClassificationMax;
136
137};
138
139#endif // QGSSINGLEBANDPSEUDOCOLORRENDERER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:54
ShaderInterpolationMethod
Color ramp shader interpolation methods.
Definition qgis.h:1388
@ Linear
Interpolates the color between two class breaks linearly.
ShaderClassificationMethod
Color ramp shader classification methods.
Definition qgis.h:1403
@ Continuous
Uses breaks from color palette.
Abstract base class for color ramps.
Layer tree node points to a map layer.
Feedback object tailored for raster block reading.
Raster data container.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Raster renderer pipe that applies colors to a raster.
virtual bool canCreateRasterAttributeTable() const
Returns true if the renderer is suitable for attribute table creation.
virtual int inputBand() const
Returns the input band for the renderer, or -1 if no input band is available.
virtual bool setInputBand(int band)
Attempts to set the input band for the renderer.
virtual bool refresh(const QgsRectangle &extent, const QList< double > &min, const QList< double > &max, bool forceRefresh=false)
Refreshes the renderer according to the min and max values associated with the extent.
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
virtual Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
virtual QList< QPair< QString, QColor > > legendSymbologyItems() const
Returns symbology items if provided by renderer.
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
Interface for all raster shaders.
A rectangle specified with double values.
Raster renderer pipe for single band pseudocolor.
const QgsSingleBandPseudoColorRenderer & operator=(const QgsSingleBandPseudoColorRenderer &)=delete
QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.
QgsSingleBandPseudoColorRenderer(const QgsSingleBandPseudoColorRenderer &)=delete
QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.
const QgsRasterShader * shader() const
Returns the raster shader.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
An interface for classes which can visit style entity (e.g.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_PYNAME(name)
Definition qgis_sip.h:81
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76