QGIS API Documentation  3.17.0-Master (df2c9ff931)
qgsrastercontourrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrastercontourrenderer.h
3  --------------------------------------
4  Date : March 2020
5  Copyright : (C) 2020 by Martin Dobias
6  Email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSRASTERCONTOURRENDERER_H
17 #define QGSRASTERCONTOURRENDERER_H
18 
19 
20 #include "qgsrasterrenderer.h"
21 
22 class QgsLineSymbol;
23 
30 class CORE_EXPORT QgsRasterContourRenderer : public QgsRasterRenderer
31 {
32  public:
35  ~QgsRasterContourRenderer() override;
36 
41 
42  QgsRasterContourRenderer *clone() const override SIP_FACTORY;
43 
45  static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
46 
47  void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
48 
49  QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
50 
51  QList<int> usesBands() const override;
52  QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) SIP_FACTORY override;
53 
54  //
55 
57  int inputBand() const { return mInputBand; }
59  void setInputBand( int band ) { mInputBand = band; }
60 
62  double contourInterval() const { return mContourInterval; }
64  void setContourInterval( double interval ) { mContourInterval = interval; }
65 
67  QgsLineSymbol *contourSymbol() const { return mContourSymbol.get(); }
69  void setContourSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
70 
72  double contourIndexInterval() const { return mContourIndexInterval; }
74  void setContourIndexInterval( double interval ) { mContourIndexInterval = interval; }
75 
77  QgsLineSymbol *contourIndexSymbol() const { return mContourIndexSymbol.get(); }
79  void setContourIndexSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
80 
87  double downscale() const { return mDownscale; }
88 
93  void setDownscale( double scale ) { mDownscale = scale; }
94 
95  private:
96 
97 #ifdef SIP_RUN
100 #endif
101 
102  std::unique_ptr<QgsLineSymbol> mContourSymbol; // should not be null
103  std::unique_ptr<QgsLineSymbol> mContourIndexSymbol; // may be null
104  double mDownscale = 8.;
105  double mContourInterval = 100.;
106  double mContourIndexInterval = 0.;
107  int mInputBand = 1;
108 };
109 
110 
111 #endif // QGSRASTERCONTOURRENDERER_H
A rectangle specified with double values.
Definition: qgsrectangle.h:41
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override=0
Read block of data using given extent and size.
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
QgsLineSymbol * contourIndexSymbol() const
Returns the symbol of index contour lines.
void setContourInterval(double interval)
Sets the interval of contour lines generation.
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgssymbol.h:1192
Raster data container.
QgsLineSymbol * contourSymbol() const
Returns the symbol used for contour lines.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Raster renderer that generates contours on the fly for a source raster band.
#define SIP_FACTORY
Definition: qgis_sip.h:76
void setDownscale(double scale)
Sets by how much the renderer will scale down the request to the data provider.
Base class for processing filters like renderers, reprojector, resampler etc.
void setContourIndexInterval(double interval)
Sets the interval of index contour lines (index contour lines are typical further apart and with a wi...
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
double contourInterval() const
Returns the interval of contour lines generation.
double contourIndexInterval() const
Returns the interval of index contour lines (index contour lines are typical further apart and with a...
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
int inputBand() const
Returns the number of the input raster band.
double downscale() const
Returns by how much the renderer will scale down the request to the data provider.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Feedback object tailored for raster block reading.
void setInputBand(int band)
Sets the number of the input raster band.
Raster renderer pipe that applies colors to a raster.
Layer tree node points to a map layer.
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.