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