QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
QgsRasterRenderer::block
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.
QgsRasterContourRenderer::setInputBand
void setInputBand(int band)
Sets the number of the input raster band.
Definition: qgsrastercontourrenderer.h:59
QgsRasterContourRenderer::setDownscale
void setDownscale(double scale)
Sets by how much the renderer will scale down the request to the data provider.
Definition: qgsrastercontourrenderer.h:93
QgsRasterInterface::writeXml
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Definition: qgsrasterinterface.h:494
QgsRasterContourRenderer::contourSymbol
QgsLineSymbol * contourSymbol() const
Returns the symbol used for contour lines.
Definition: qgsrastercontourrenderer.h:67
QgsRasterContourRenderer::contourInterval
double contourInterval() const
Returns the interval of contour lines generation.
Definition: qgsrastercontourrenderer.h:62
qgsrasterrenderer.h
QgsRasterContourRenderer::setContourIndexInterval
void setContourIndexInterval(double interval)
Sets the interval of index contour lines (index contour lines are typical further apart and with a wi...
Definition: qgsrastercontourrenderer.h:74
QgsRasterRenderer::usesBands
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
Definition: qgsrasterrenderer.h:151
QgsRasterContourRenderer::inputBand
int inputBand() const
Returns the number of the input raster band.
Definition: qgsrastercontourrenderer.h:57
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:41
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsRasterContourRenderer::contourIndexSymbol
QgsLineSymbol * contourIndexSymbol() const
Returns the symbol of index contour lines.
Definition: qgsrastercontourrenderer.h:77
QgsRasterContourRenderer::setContourInterval
void setContourInterval(double interval)
Sets the interval of contour lines generation.
Definition: qgsrastercontourrenderer.h:64
QgsRasterRenderer
Raster renderer pipe that applies colors to a raster.
Definition: qgsrasterrenderer.h:40
QgsRasterContourRenderer
Raster renderer that generates contours on the fly for a source raster band.
Definition: qgsrastercontourrenderer.h:30
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition: qgslayertreelayer.h:43
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsLineSymbol
A line symbol type, for rendering LineString and MultiLineString geometries.
Definition: qgslinesymbol.h:29
QgsRasterRenderer::clone
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
QgsRasterContourRenderer::downscale
double downscale() const
Returns by how much the renderer will scale down the request to the data provider.
Definition: qgsrastercontourrenderer.h:87
QgsRasterInterface
Base class for processing filters like renderers, reprojector, resampler etc.
Definition: qgsrasterinterface.h:135
QgsRasterBlockFeedback
Feedback object tailored for raster block reading.
Definition: qgsrasterinterface.h:41
QgsRasterRenderer::operator=
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterContourRenderer::contourIndexInterval
double contourIndexInterval() const
Returns the interval of index contour lines (index contour lines are typical further apart and with a...
Definition: qgsrastercontourrenderer.h:72
QgsRasterRenderer::createLegendNodes
virtual QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer)
Creates a set of legend nodes representing the renderer.
Definition: qgsrasterrenderer.cpp:110
QgsRasterBlock
Raster data container.
Definition: qgsrasterblock.h:36