QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgssinglebandgrayrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssinglebandgrayrenderer.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 QGSSINGLEBANDGRAYRENDERER_H
19#define QGSSINGLEBANDGRAYRENDERER_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
23#include "qgsrasterrenderer.h"
25
26#include <memory>
27
29class QDomElement;
30
36{
37 public:
39 {
41 WhiteToBlack
42 };
43
44 QgsSingleBandGrayRenderer( QgsRasterInterface *input, int grayBand );
45
50
52 Qgis::RasterRendererFlags flags() const override;
53
54 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
55
56 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
57
58 int grayBand() const { return mGrayBand; }
59 void setGrayBand( int band ) { mGrayBand = band; }
60 const QgsContrastEnhancement *contrastEnhancement() const { return mContrastEnhancement.get(); }
62 void setContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
63
64 void setGradient( Gradient gradient ) { mGradient = gradient; }
65 Gradient gradient() const { return mGradient; }
66
67 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
68
69 QList< QPair< QString, QColor > > legendSymbologyItems() const override;
70 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
71
72 QList<int> usesBands() const override;
73
74 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
75
82 const QgsColorRampLegendNodeSettings *legendSettings() const;
83
92 void setLegendSettings( QgsColorRampLegendNodeSettings *settings SIP_TRANSFER );
93
94 private:
95#ifdef SIP_RUN
98#endif
99
100 int mGrayBand;
101 Gradient mGradient;
102 std::unique_ptr< QgsContrastEnhancement > mContrastEnhancement;
103 std::unique_ptr< QgsColorRampLegendNodeSettings > mLegendSettings;
104};
105
106#endif // QGSSINGLEBANDGRAYRENDERER_H
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:55
Settings for a color ramp legend node.
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
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 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 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.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
Raster renderer pipe for single band gray.
const QgsContrastEnhancement * contrastEnhancement() const
const QgsSingleBandGrayRenderer & operator=(const QgsSingleBandGrayRenderer &)=delete
QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.
QgsSingleBandGrayRenderer(const QgsSingleBandGrayRenderer &)=delete
QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.
void setGradient(Gradient gradient)
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76