QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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"
24 #include <memory>
25 
27 class QDomElement;
28 
34 {
35  public:
36  enum Gradient
37  {
39  WhiteToBlack
40  };
41 
42  QgsSingleBandGrayRenderer( QgsRasterInterface *input, int grayBand );
43 
48 
50 
51  static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
52 
53  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
54 
55  int grayBand() const { return mGrayBand; }
56  void setGrayBand( int band ) { mGrayBand = band; }
57  const QgsContrastEnhancement *contrastEnhancement() const { return mContrastEnhancement.get(); }
59  void setContrastEnhancement( QgsContrastEnhancement *ce SIP_TRANSFER );
60 
61  void setGradient( Gradient gradient ) { mGradient = gradient; }
62  Gradient gradient() const { return mGradient; }
63 
64  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
65 
66  void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems SIP_OUT ) const override;
67 
68  QList<int> usesBands() const override;
69 
70  void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props = QgsStringMap() ) const override;
71 
72  private:
73 #ifdef SIP_RUN
76 #endif
77 
78  int mGrayBand;
79  Gradient mGradient;
80  std::unique_ptr< QgsContrastEnhancement > mContrastEnhancement;
81 
82 };
83 
84 #endif // QGSSINGLEBANDGRAYRENDERER_H
QgsSingleBandGrayRenderer::BlackToWhite
@ BlackToWhite
Definition: qgssinglebandgrayrenderer.h:38
QgsRasterInterface::writeXml
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Definition: qgsrasterinterface.h:461
SIP_OUT
#define SIP_OUT
Definition: qgis_sip.h:58
QgsSingleBandGrayRenderer
Raster renderer pipe for single band gray.
Definition: qgssinglebandgrayrenderer.h:34
QgsSingleBandGrayRenderer::gradient
Gradient gradient() const
Definition: qgssinglebandgrayrenderer.h:62
qgsrasterrenderer.h
QgsRasterRenderer::toSld
virtual void toSld(QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
Definition: qgsrasterrenderer.cpp:175
QgsRasterRenderer::usesBands
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
Definition: qgsrasterrenderer.h:133
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsSingleBandGrayRenderer::contrastEnhancement
const QgsContrastEnhancement * contrastEnhancement() const
Definition: qgssinglebandgrayrenderer.h:57
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:39
QgsSingleBandGrayRenderer::setGrayBand
void setGrayBand(int band)
Definition: qgssinglebandgrayrenderer.h:56
qgis_sip.h
QgsSingleBandGrayRenderer::QgsSingleBandGrayRenderer
QgsSingleBandGrayRenderer(const QgsSingleBandGrayRenderer &)=delete
QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsContrastEnhancement
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range...
Definition: qgscontrastenhancement.h:43
QgsRasterRenderer::clone
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
QgsStringMap
QMap< QString, QString > QgsStringMap
Definition: qgis.h:758
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:117
QgsRasterRenderer::legendSymbologyItems
virtual void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const
Gets symbology items if provided by renderer.
Definition: qgsrasterrenderer.h:120
QgsSingleBandGrayRenderer::Gradient
Gradient
Definition: qgssinglebandgrayrenderer.h:37
QgsRasterBlockFeedback
Feedback object tailored for raster block reading.
Definition: qgsrasterinterface.h:41
QgsSingleBandGrayRenderer::setGradient
void setGradient(Gradient gradient)
Definition: qgssinglebandgrayrenderer.h:61
QgsRasterRenderer::operator=
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterBlock
Raster data container.
Definition: qgsrasterblock.h:37
QgsSingleBandGrayRenderer::operator=
const QgsSingleBandGrayRenderer & operator=(const QgsSingleBandGrayRenderer &)=delete
QgsSingleBandGrayRenderer cannot be copied. Use clone() instead.