QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgselevationshadingrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgselevationshadingrenderer.h - QgsElevationShadingRenderer
3
4 ---------------------
5 begin : 4.12.2022
6 copyright : (C) 2022 by Vincent Cloarec
7 email : vcloarec at gmail dot com
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSELEVATIONSHADINGRENDERER_H
17#define QGSELEVATIONSHADINGRENDERER_H
18
19#include "qgis.h"
20#include "qgis_sip.h"
21#include "qgselevationmap.h"
22
23class QImage;
24class QgsElevationMap;
26class QgsMapSettings;
27class QDomDocument;
29class QDomElement;
30
48{
49 public:
51
56 void renderShading( const QgsElevationMap &elevation, QImage &image, const QgsRenderContext &context ) const;
57
59 void setActive( bool active );
60
62 bool isActive() const;
63
65 void setActiveEyeDomeLighting( bool active );
66
68 bool isActiveEyeDomeLighting() const;
69
75 double eyeDomeLightingStrength() const;
76
82 void setEyeDomeLightingStrength( double strength );
83
90 double eyeDomeLightingDistance() const;
91
98 void setEyeDomeLightingDistance( double distance );
99
106
113
115 void setActiveHillshading( bool active );
116
118 bool isActiveHillshading() const;
119
125 double hillshadingZFactor() const;
126
132 void setHillshadingZFactor( double zFactor );
133
140
146 void setHillshadingMultidirectional( bool multiDirectional );
147
153 double lightAltitude() const;
154
160 void setLightAltitude( double lightAltitude );
161
167 double lightAzimuth() const;
168
174 void setLightAzimuth( double lightAzimuth );
175
177 void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
178
180 void readXml( const QDomElement &element, const QgsReadWriteContext &context );
181
188
195
196 private:
197 bool mIsActive = false;
198
200
201 bool mRenderEdl = true;
202 double mEyeDomeLightingStrength = 1000.0;
203 double mEyeDomeLightingDistance = 0.5;
204 Qgis::RenderUnit mEyeDomeLightingDistanceUnit = Qgis::RenderUnit::Millimeters;
205
206 bool mRenderHillshading = false;
207 double mLightAltitude = 45.0;
208 double mLightAzimuth = 315.0;
209 double mHillshadingZFactor = 1.0;
210 bool mHillshadingMultiDir = false;
211
212 void renderEdl( const QgsElevationMap &elevation, QImage &image, const QgsRenderContext &context ) const;
213 void renderHillshading( const QgsElevationMap &elevation, QImage &image, const QgsRenderContext &context ) const;
214};
215
216#endif // QGSELEVATIONSHADINGRENDERER_H
ElevationMapCombineMethod
Methods used to select the elevation when two elevation maps are combined.
Definition qgis.h:4915
@ HighestElevation
Keep the highest elevation if it is not null.
Definition qgis.h:4916
RenderUnit
Rendering size units.
Definition qgis.h:5183
@ Millimeters
Millimeters.
Definition qgis.h:5184
Stores a digital elevation model in a raster image which may get updated as a part of the map layer r...
Qgis::ElevationMapCombineMethod combinedElevationMethod() const
Returns the method used when conbining different elevation sources.
bool isActiveHillshading() const
Returns whether the hillshading is active.
void setCombinedElevationMethod(Qgis::ElevationMapCombineMethod method)
Sets the method used when conbining different elevation sources.
bool isActive() const
Returns whether this shading renderer is active.
void setActive(bool active)
Sets whether this shading renderer is active.
double hillshadingZFactor() const
Returns the z factor used by the hill shading method.
double eyeDomeLightingStrength() const
Returns the strength of the eye dome lighting method.
void setLightAzimuth(double lightAzimuth)
Sets the azimuth of the light (degree) that can be used by some methods (e.g.
double lightAltitude() const
Returns the altitude of the light (degree) that can be used by some methods (e.g.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const
Writes configuration on a DOM element.
void setHillshadingMultidirectional(bool multiDirectional)
Sets whether the hill shading method is multidirectional.
double eyeDomeLightingDistance() const
Returns the distance of the eye dome lighting method, that is the distance where the effect is apply ...
void setLightAltitude(double lightAltitude)
Sets the altitude of the light (degree) that can be used by some methods (e.g.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads configuration from a DOM element.
void renderShading(const QgsElevationMap &elevation, QImage &image, const QgsRenderContext &context) const
Render shading on image condidering the elevation map elevation and the renderer context context If e...
void setEyeDomeLightingStrength(double strength)
Sets the strength of the eye dome lighting method.
void setEyeDomeLightingDistanceUnit(Qgis::RenderUnit unit)
Sets the unit of the distance of the eye dome lighting method set by setEyeDomeLightingDistance().
void setActiveHillshading(bool active)
Sets active the hillshading.
bool isHillshadingMultidirectional() const
Returns whether the hill shading method is multidirectional.
void setHillshadingZFactor(double zFactor)
Sets the z factor used by the hill shading method.
bool isActiveEyeDomeLighting() const
Returns whether eye-dome lighting shading method is active.
void setEyeDomeLightingDistance(double distance)
Sets the distance of the eye dome lighting method, that is the distance where the effect is apply fro...
void setActiveEyeDomeLighting(bool active)
Sets active the eye-dome lighting shading method.
double lightAzimuth() const
Returns the azimuth of the light (degree) that can be used by some methods (e.g.
Qgis::RenderUnit eyeDomeLightingDistanceUnit() const
Returns the unit of the distance of the eye dome lighting method returned by eyeDomeLightingDistance(...
Contains configuration for rendering maps.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.