QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
61 Q_DECL_DEPRECATED int grayBand() const SIP_DEPRECATED { return mGrayBand; }
62
66 Q_DECL_DEPRECATED void setGrayBand( int band ) SIP_DEPRECATED;
67
68 int inputBand() const override;
69 bool setInputBand( int band ) override;
70
71 const QgsContrastEnhancement *contrastEnhancement() const { return mContrastEnhancement.get(); }
73 void setContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
74
75 void setGradient( Gradient gradient ) { mGradient = gradient; }
76 Gradient gradient() const { return mGradient; }
77
78 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
79
80 QList< QPair< QString, QColor > > legendSymbologyItems() const override;
81 QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
82
83 QList<int> usesBands() const override;
84
85 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
86
93 const QgsColorRampLegendNodeSettings *legendSettings() const;
94
103 void setLegendSettings( QgsColorRampLegendNodeSettings *settings SIP_TRANSFER );
104
114 bool refresh( const QgsRectangle &extent, const QList<double> &min, const QList<double> &max, bool forceRefresh = false ) override SIP_SKIP;
115
116 private:
117#ifdef SIP_RUN
120#endif
121
122 int mGrayBand;
123 Gradient mGradient;
124 std::unique_ptr< QgsContrastEnhancement > mContrastEnhancement;
125 std::unique_ptr< QgsColorRampLegendNodeSettings > mLegendSettings;
126};
127
128#endif // QGSSINGLEBANDGRAYRENDERER_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
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 int inputBand() const
Returns the input band for the renderer, or -1 if no input band is available.
virtual bool setInputBand(int band)
Attempts to set the input band for the renderer.
virtual bool refresh(const QgsRectangle &extent, const QList< double > &min, const QList< double > &max, bool forceRefresh=false)
Refreshes the renderer according to the min and max values associated with the extent.
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.
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_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