QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
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:
47 int redBand,
48 int greenBand,
49 int blueBand,
50 QgsContrastEnhancement *redEnhancement SIP_TRANSFER = nullptr,
51 QgsContrastEnhancement *greenEnhancement SIP_TRANSFER = nullptr,
52 QgsContrastEnhancement *blueEnhancement SIP_TRANSFER = nullptr
53 );
55
60
62 Qgis::RasterRendererFlags flags() const override;
63
64 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
65
66 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
67
73 int redBand() const { return mRedBand; }
74
80 void setRedBand( int band ) { mRedBand = band; }
81
87 int greenBand() const { return mGreenBand; }
88
94 void setGreenBand( int band ) { mGreenBand = band; }
95
101 int blueBand() const { return mBlueBand; }
102
108 void setBlueBand( int band ) { mBlueBand = band; }
109
117 const QgsContrastEnhancement *redContrastEnhancement() const;
118
128 void setRedContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
129
137 const QgsContrastEnhancement *greenContrastEnhancement() const;
138
148 void setGreenContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
149
157 const QgsContrastEnhancement *blueContrastEnhancement() const;
158
168 void setBlueContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
169
170 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
171
172 QList<int> usesBands() const override;
173 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
174
175 Q_DECL_DEPRECATED void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override SIP_DEPRECATED;
176 bool toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const override;
177
192 bool refresh( const QgsRectangle &extent, const QList<double> &min, const QList<double> &max, bool forceRefresh = false ) override SIP_SKIP;
193
194 private:
195#ifdef SIP_RUN
198#endif
199
200 int mRedBand = 1;
201 int mGreenBand = 1;
202 int mBlueBand = 1;
203
204 std::unique_ptr< QgsContrastEnhancement > mRedContrastEnhancement;
205 std::unique_ptr< QgsContrastEnhancement > mGreenContrastEnhancement;
206 std::unique_ptr< QgsContrastEnhancement > mBlueContrastEnhancement;
207};
208
209#endif // QGSMULTIBANDCOLORRENDERER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
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.
QgsMultiBandColorRenderer(QgsRasterInterface *input, int redBand, int greenBand, int blueBand, QgsContrastEnhancement *redEnhancement=nullptr, QgsContrastEnhancement *greenEnhancement=nullptr, QgsContrastEnhancement *blueEnhancement=nullptr)
Constructor for QgsMultiBandColorRenderer.
void setRedBand(int band)
Sets the band number for the red channel.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
void setGreenBand(int band)
Sets the band number for the green channel.
Qgis::RasterRendererFlags flags() const override
Returns flags which dictate renderer behavior.
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.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
int redBand() const
Returns the band number for the red channel.
int greenBand() const
Returns the band number for the green channel.
Feedback object tailored for raster block reading.
Raster data container.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
virtual QgsRasterInterface * input() const
Current input.
QgsRasterRenderer(QgsRasterInterface *input=nullptr, const QString &type=QString())
Constructor for QgsRasterRenderer.
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:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83