QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
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 "qgscolorrampshader.h"
25#include "qgsrasterrenderer.h"
26#include "qgsrectangle.h"
27
28class QDomElement;
29class QgsRasterShader;
30
36{
37
38 public:
39
41 QgsSingleBandPseudoColorRenderer( QgsRasterInterface *input, int band = -1, QgsRasterShader *shader SIP_TRANSFER = nullptr );
42
47
49 Qgis::RasterRendererFlags flags() const override;
50 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
51
52 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
53
55 void setShader( QgsRasterShader *shader SIP_TRANSFER );
56
58 QgsRasterShader *shader() { return mShader.get(); }
59
61 const QgsRasterShader *shader() const SIP_PYNAME( constShader ) { return mShader.get(); }
62
63 bool canCreateRasterAttributeTable( ) const override;
64
74 void createShader( QgsColorRamp *colorRamp SIP_TRANSFER = nullptr,
77 int classes = 0,
78 bool clip = false,
79 const QgsRectangle &extent = QgsRectangle() );
80
81 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
82 QList< QPair< QString, QColor > > legendSymbologyItems() const override;
83 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
84 QList<int> usesBands() const override;
85 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
86 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
87
92 int band() const { return mBand; }
93
99 void setBand( int bandNo );
100
101 double classificationMin() const { return mClassificationMin; }
102 double classificationMax() const { return mClassificationMax; }
103 void setClassificationMin( double min );
104 void setClassificationMax( double max );
105
106 private:
107#ifdef SIP_RUN
110#endif
111
112 std::unique_ptr< QgsRasterShader > mShader;
113 int mBand;
114
115 // Minimum and maximum values used for automatic classification, these
116 // values are not used by renderer in rendering process
117 double mClassificationMin;
118 double mClassificationMax;
119
120};
121
122#endif // QGSSINGLEBANDPSEUDOCOLORRENDERER_H
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:54
ClassificationMode
Classification modes used to create the color ramp shader.
@ Continuous
Uses breaks from color palette.
Type
Supported methods for color interpolation.
@ Interpolated
Interpolates the color between two class breaks linearly.
Abstract base class for color ramps.
Definition: qgscolorramp.h:30
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 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 bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
virtual 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.
Definition: qgsrectangle.h:42
Raster renderer pipe for single band pseudocolor.
int band() const
Returns the band used by the renderer.
const QgsSingleBandPseudoColorRenderer & operator=(const QgsSingleBandPseudoColorRenderer &)=delete
QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.
QgsSingleBandPseudoColorRenderer(const QgsSingleBandPseudoColorRenderer &)=delete
QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.
An interface for classes which can visit style entity (e.g.
#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