QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgssinglebandpseudocolorrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglebandpseudocolorrenderer.h
3  ----------------------------------
4  begin : January 2012
5  copyright : (C) 2012 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 QGSSINGLEBANDPSEUDOCOLORRENDERER_H
19 #define QGSSINGLEBANDPSEUDOCOLORRENDERER_H
20 
21 #include "qgsrasterrenderer.h"
22 
23 class QDomElement;
24 class QgsRasterShader;
25 
30 {
31  public:
35  QgsSingleBandPseudoColorRenderer * clone() const override;
36 
37  static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
38 
39  QgsRasterBlock* block( int bandNo, const QgsRectangle & extent, int width, int height ) override;
40  QgsRasterBlock* block2( int bandNo, const QgsRectangle & extent, int width, int height, QgsRasterBlockFeedback* feedback = nullptr ) override;
41 
43  void setShader( QgsRasterShader* shader );
44  QgsRasterShader* shader() { return mShader; }
46  const QgsRasterShader* shader() const { return mShader; }
47 
48  void writeXML( QDomDocument& doc, QDomElement& parentElem ) const override;
49 
50  void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const override;
51 
52  QList<int> usesBands() const override;
53 
57  int band() const { return mBand; }
58 
63  void setBand( int bandNo );
64 
65  double classificationMin() const { return mClassificationMin; }
66  double classificationMax() const { return mClassificationMax; }
67  void setClassificationMin( double min ) { mClassificationMin = min; }
68  void setClassificationMax( double max ) { mClassificationMax = max; }
69  int classificationMinMaxOrigin() const { return mClassificationMinMaxOrigin; }
70  void setClassificationMinMaxOrigin( int origin ) { mClassificationMinMaxOrigin = origin; }
71 
72  private:
73  QgsRasterShader* mShader;
74  int mBand;
75 
76  // Minimum and maximum values used for automatic classification, these
77  // values are not used by renderer in rendering process
78  double mClassificationMin;
79  double mClassificationMax;
80 
81  int mClassificationMinMaxOrigin;
82 
85 };
86 
87 #endif // QGSSINGLEBANDPSEUDOCOLORRENDERER_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Interface for all raster shaders.
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
virtual QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using given extent and size.
double ANALYSIS_EXPORT max(double x, double y)
Returns the maximum of two doubles or the first argument if both are equal.
Raster data container.
virtual void writeXML(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Raster renderer pipe for single band pseudocolor.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
double ANALYSIS_EXPORT min(double x, double y)
Returns the minimum of two doubles or the first argument if both are equal.
virtual void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const
Get symbology items if provided by renderer.
Feedback object tailored for raster block reading.
Raster renderer pipe that applies colors to a raster.
int band() const
Returns the band used by the renderer.