QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgshillshaderenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshillshaderenderer.cpp
3 ---------------------------------
4 begin : May 2016
5 copyright : (C) 2016 by Nathan Woodrow
6 email : woodrow dot nathan at gmail dot com
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 QGSHILLSHADERENDERER_H
19#define QGSHILLSHADERENDERER_H
20
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgsrasterrenderer.h"
25
26class QgsRasterBlock;
27class QgsRectangle;
29
30
35class CORE_EXPORT QgsHillshadeRenderer : public QgsRasterRenderer
36{
37 public:
38
46 QgsHillshadeRenderer( QgsRasterInterface *input, int band, double lightAzimuth, double lightAltitude );
47
48 QgsHillshadeRenderer *clone() const override SIP_FACTORY;
49 Qgis::RasterRendererFlags flags() const override;
50
57 static QgsRasterRenderer *create( const QDomElement &elem, QgsRasterInterface *input ) SIP_FACTORY;
58
59 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
60
61 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
62
63 QList<int> usesBands() const override;
64 int inputBand() const override;
65
66 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
67
73 Q_DECL_DEPRECATED int band() const SIP_DEPRECATED { return mBand; }
74
81 Q_DECL_DEPRECATED void setBand( int bandNo ) SIP_DEPRECATED;
82 bool setInputBand( int band ) override;
83
88 double azimuth() const { return mLightAzimuth; }
89
94 double altitude() const { return mLightAngle; }
95
100 double zFactor() const { return mZFactor; }
101
106 bool multiDirectional() const { return mMultiDirectional; }
107
113 void setAzimuth( double azimuth ) { mLightAzimuth = azimuth; }
114
120 void setAltitude( double altitude ) { mLightAngle = altitude; }
121
127 void setZFactor( double zfactor ) { mZFactor = zfactor; }
128
134 void setMultiDirectional( bool isMultiDirectional ) { mMultiDirectional = isMultiDirectional; }
135
136 private:
137 int mBand = 1;
138 double mZFactor = 1;
139 double mLightAngle = 45;
140 double mLightAzimuth = 315;
141 bool mMultiDirectional = false;
142
143};
144
145#endif // QGSHILLSHADERENDERER_H
QFlags< RasterRendererFlag > RasterRendererFlags
Flags which control behavior of raster renderers.
Definition qgis.h:1404
A renderer for generating live hillshade models.
bool multiDirectional() const
Returns true if the renderer is using multi-directional hillshading.
void setZFactor(double zfactor)
Set the Z scaling factor of the result image.
Q_DECL_DEPRECATED int band() const
Returns the band used by the renderer.
double azimuth() const
Returns the direction of the light over the raster between 0-360.
void setAltitude(double altitude)
Set the altitude of the light source.
void setAzimuth(double azimuth)
Set the azimuth of the light source.
void setMultiDirectional(bool isMultiDirectional)
Sets whether to render using a multi-directional hillshade algorithm.
double altitude() const
Returns the angle of the light source over the raster.
double zFactor() const
Returns the Z scaling factor.
Feedback object tailored for raster block reading.
Raster data container.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual void writeXml(QDomDocument &doc, QDomElement &parentElem) const
Write base class members to xml.
Raster renderer pipe that applies colors to a raster.
virtual int inputBand() const
Returns the input band for the renderer, or -1 if no input band is available.
virtual bool setInputBand(int band)
Attempts to set the input band for the renderer.
virtual Qgis::RasterRendererFlags flags() const
Returns flags which dictate renderer behavior.
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.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
A rectangle specified with double values.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_FACTORY
Definition qgis_sip.h:76