QGIS API Documentation  3.20.0-Odense (decaadbb31)
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:
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
Layer tree node points to a map layer.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:30
Feedback object tailored for raster block reading.
Raster data container.
Raster renderer that generates contours on the fly for a source raster band.
QgsLineSymbol * contourIndexSymbol() const
Returns the symbol of index contour lines.
void setDownscale(double scale)
Sets by how much the renderer will scale down the request to the data provider.
const QgsRasterContourRenderer & operator=(const QgsRasterContourRenderer &)=delete
QgsRasterContourRenderer cannot be copied. Use clone() instead.
void setContourInterval(double interval)
Sets the interval of contour lines generation.
QgsRasterContourRenderer(const QgsRasterContourRenderer &)=delete
QgsRasterContourRenderer cannot be copied. Use clone() instead.
~QgsRasterContourRenderer() override
double downscale() const
Returns by how much the renderer will scale down the request to the data provider.
void setContourIndexInterval(double interval)
Sets the interval of index contour lines (index contour lines are typical further apart and with a wi...
void setInputBand(int band)
Sets the number of the input raster band.
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...
QgsLineSymbol * contourSymbol() const
Returns the symbol used for contour lines.
Base class for processing filters like renderers, reprojector, resampler etc.
Raster renderer pipe that applies colors to a raster.
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.
Definition: qgsrectangle.h:42
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76