QGIS API Documentation 3.43.0-Master (e7e1311472a)
qgsmultibandcolorrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmultibandcolorrenderer.h
3 ---------------------------
4 begin : December 2011
5 copyright : (C) 2011 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 QGSMULTIBANDCOLORRENDERER_H
19#define QGSMULTIBANDCOLORRENDERER_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsrasterrenderer.h"
24
26class QDomElement;
27
33{
34 public:
35
46 QgsMultiBandColorRenderer( QgsRasterInterface *input, int redBand, int greenBand, int blueBand,
47 QgsContrastEnhancement *redEnhancement SIP_TRANSFER = nullptr,
48 QgsContrastEnhancement *greenEnhancement SIP_TRANSFER = nullptr,
49 QgsContrastEnhancement *blueEnhancement SIP_TRANSFER = nullptr );
51
56
58 Qgis::RasterRendererFlags flags() const override;
59
60 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
61
62 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
63
69 int redBand() const { return mRedBand; }
70
76 void setRedBand( int band ) { mRedBand = band; }
77
83 int greenBand() const { return mGreenBand; }
84
90 void setGreenBand( int band ) { mGreenBand = band; }
91
97 int blueBand() const { return mBlueBand; }
98
104 void setBlueBand( int band ) { mBlueBand = band; }
105
113 const QgsContrastEnhancement *redContrastEnhancement() const;
114
124 void setRedContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
125
133 const QgsContrastEnhancement *greenContrastEnhancement() const;
134
144 void setGreenContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
145
153 const QgsContrastEnhancement *blueContrastEnhancement() const;
154
164 void setBlueContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
165
166 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
167
168 QList<int> usesBands() const override;
169 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
170
171 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override SIP_DEPRECATED;
172 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
173
188 bool refresh( const QgsRectangle &extent, const QList<double> &min, const QList<double> &max, bool forceRefresh = false ) override SIP_SKIP;
189
190 private:
191#ifdef SIP_RUN
194#endif
195
196 int mRedBand = 1;
197 int mGreenBand = 1;
198 int mBlueBand = 1;
199
200 std::unique_ptr< QgsContrastEnhancement > mRedContrastEnhancement;
201 std::unique_ptr< QgsContrastEnhancement > mGreenContrastEnhancement;
202 std::unique_ptr< QgsContrastEnhancement > mBlueContrastEnhancement;
203
204};
205
206#endif // QGSMULTIBANDCOLORRENDERER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:54
Handles contrast enhancement and clipping.
Layer tree node points to a map layer.
Renderer for multiband images with the color components.
QgsMultiBandColorRenderer(const QgsMultiBandColorRenderer &)=delete
QgsMultiBandColorRenderer cannot be copied. Use clone() instead.
void setRedBand(int band)
Sets the band number for the red channel.
void setGreenBand(int band)
Sets the band number for the green channel.
const QgsMultiBandColorRenderer & operator=(const QgsMultiBandColorRenderer &)=delete
QgsMultiBandColorRenderer cannot be copied. Use clone() instead.
int blueBand() const
Returns the band number for the blue channel.
~QgsMultiBandColorRenderer() override
void setBlueBand(int band)
Sets the band number for the blue channel.
int greenBand() const
Returns the band number for the green channel.
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 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.
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
A rectangle specified with double values.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76