QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
26 class QDomElement;
27 
33 {
34  public:
35  QgsMultiBandColorRenderer( QgsRasterInterface *input, int redBand, int greenBand, int blueBand,
36  QgsContrastEnhancement *redEnhancement = nullptr, QgsContrastEnhancement *greenEnhancement = nullptr,
37  QgsContrastEnhancement *blueEnhancement = nullptr );
38  ~QgsMultiBandColorRenderer() override;
39 
44 
46 
47  static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
48 
49  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
50 
51  int redBand() const { return mRedBand; }
52  void setRedBand( int band ) { mRedBand = band; }
53  int greenBand() const { return mGreenBand; }
54  void setGreenBand( int band ) { mGreenBand = band; }
55  int blueBand() const { return mBlueBand; }
56  void setBlueBand( int band ) { mBlueBand = band; }
57 
65  const QgsContrastEnhancement *redContrastEnhancement() const { return mRedContrastEnhancement; }
66 
76  void setRedContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
77 
85  const QgsContrastEnhancement *greenContrastEnhancement() const { return mGreenContrastEnhancement; }
86 
96  void setGreenContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
97 
105  const QgsContrastEnhancement *blueContrastEnhancement() const { return mBlueContrastEnhancement; }
106 
116  void setBlueContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
117 
118  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
119 
120  QList<int> usesBands() const override;
121  QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
122 
123  void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
124 
125  private:
126 #ifdef SIP_RUN
129 #endif
130 
131  int mRedBand;
132  int mGreenBand;
133  int mBlueBand;
134 
135  QgsContrastEnhancement *mRedContrastEnhancement = nullptr;
136  QgsContrastEnhancement *mGreenContrastEnhancement = nullptr;
137  QgsContrastEnhancement *mBlueContrastEnhancement = nullptr;
138 
139 };
140 
141 #endif // QGSMULTIBANDCOLORRENDERER_H
QgsRasterRenderer::block
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override=0
Read block of data using given extent and size.
QgsRasterInterface::writeXml
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Definition: qgsrasterinterface.h:494
QgsMultiBandColorRenderer::redContrastEnhancement
const QgsContrastEnhancement * redContrastEnhancement() const
Returns the contrast enhancement to use for the red channel.
Definition: qgsmultibandcolorrenderer.h:65
QgsMultiBandColorRenderer::setRedBand
void setRedBand(int band)
Definition: qgsmultibandcolorrenderer.h:52
QgsMultiBandColorRenderer::greenContrastEnhancement
const QgsContrastEnhancement * greenContrastEnhancement() const
Returns the contrast enhancement to use for the green channel.
Definition: qgsmultibandcolorrenderer.h:85
qgsrasterrenderer.h
QgsRasterRenderer::usesBands
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
Definition: qgsrasterrenderer.h:151
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:40
QgsMultiBandColorRenderer::blueBand
int blueBand() const
Definition: qgsmultibandcolorrenderer.h:55
QgsMultiBandColorRenderer::redBand
int redBand() const
Definition: qgsmultibandcolorrenderer.h:51
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition: qgslayertreelayer.h:43
QgsMultiBandColorRenderer::blueContrastEnhancement
const QgsContrastEnhancement * blueContrastEnhancement() const
Returns the contrast enhancement to use for the blue channel.
Definition: qgsmultibandcolorrenderer.h:105
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsRasterRenderer::toSld
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.
Definition: qgsrasterrenderer.cpp:209
QgsMultiBandColorRenderer::greenBand
int greenBand() const
Definition: qgsmultibandcolorrenderer.h:53
QgsMultiBandColorRenderer
Renderer for multiband images with the color components.
Definition: qgsmultibandcolorrenderer.h:32
QgsContrastEnhancement
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
Definition: qgscontrastenhancement.h:42
QgsRasterRenderer::clone
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:135
QgsMultiBandColorRenderer::setBlueBand
void setBlueBand(int band)
Definition: qgsmultibandcolorrenderer.h:56
QgsRasterBlockFeedback
Feedback object tailored for raster block reading.
Definition: qgsrasterinterface.h:41
QgsRasterRenderer::operator=
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsMultiBandColorRenderer::setGreenBand
void setGreenBand(int band)
Definition: qgsmultibandcolorrenderer.h:54
QgsRasterRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgsrasterrenderer.cpp:110
QgsRasterBlock
Raster data container.
Definition: qgsrasterblock.h:36