Class: QgsElevationShadingRenderer

Renders elevation shading on an image with different methods (eye dome lighting, hillshading, …).

An instance of this class supports the following settings:

  • activate/deactivate elevation shading

  • activate/deactivate a particular shading method

  • parameters of each shading method

To render shading on image the caller call renderShading() with the image and an elevation map (see QgsElevationMap()) as parameters. The shading is applied on the image in place. Elevation map and image must have same sizes.

Added in version 3.30.

class qgis.core.QgsElevationShadingRenderer[source]

Bases: object

combinedElevationMethod(self) Qgis.ElevationMapCombineMethod[source]

Returns the method used when conbining different elevation sources.

Return type:

Qgis.ElevationMapCombineMethod

eyeDomeLightingDistance(self) float[source]

Returns the distance of the eye dome lighting method, that is the distance where the effect is apply from the source elevation.

Return type:

float

eyeDomeLightingDistanceUnit(self) Qgis.RenderUnit[source]

Returns the unit of the distance of the eye dome lighting method returned by eyeDomeLightingDistance().

Return type:

Qgis.RenderUnit

eyeDomeLightingStrength(self) float[source]

Returns the strength of the eye dome lighting method.

Return type:

float

hillshadingZFactor(self) float[source]

Returns the z factor used by the hill shading method.

Return type:

float

isActive(self) bool[source]

Returns whether this shading renderer is active.

Return type:

bool

isActiveEyeDomeLighting(self) bool[source]

Returns whether eye-dome lighting shading method is active

Return type:

bool

isActiveHillshading(self) bool[source]

Returns whether the hillshading is active

Return type:

bool

isHillshadingMultidirectional(self) bool[source]

Returns whether the hill shading method is multidirectional.

Return type:

bool

lightAltitude(self) float[source]

Returns the altitude of the light (degree) that can be used by some methods (e.g. hill shading).

Return type:

float

lightAzimuth(self) float[source]

Returns the azimuth of the light (degree) that can be used by some methods (e.g. hill shading).

Return type:

float

readXml(self, element: QDomElement, context: QgsReadWriteContext)[source]

Reads configuration from a DOM element

Parameters:
renderShading(self, elevation: QgsElevationMap, image: QImage, context: QgsRenderContext)[source]

Render shading on image condidering the elevation map elevation and the renderer context context If elevation map and the image don’t have same sizes, nothing happens.

Parameters:
setActive(self, active: bool)[source]

Sets whether this shading renderer is active.

Parameters:

active (bool)

setActiveEyeDomeLighting(self, active: bool)[source]

Sets active the eye-dome lighting shading method.

Parameters:

active (bool)

setActiveHillshading(self, active: bool)[source]

Sets active the hillshading

Parameters:

active (bool)

setCombinedElevationMethod(self, method: Qgis.ElevationMapCombineMethod)[source]

Sets the method used when conbining different elevation sources.

Parameters:

method (Qgis.ElevationMapCombineMethod)

setEyeDomeLightingDistance(self, distance: float)[source]

Sets the distance of the eye dome lighting method, that is the distance where the effect is apply from the source elevation.

Parameters:

distance (float)

setEyeDomeLightingDistanceUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit of the distance of the eye dome lighting method set by setEyeDomeLightingDistance().

Parameters:

unit (Qgis.RenderUnit)

setEyeDomeLightingStrength(self, strength: float)[source]

Sets the strength of the eye dome lighting method.

Parameters:

strength (float)

setHillshadingMultidirectional(self, multiDirectional: bool)[source]

Sets whether the hill shading method is multidirectional.

Parameters:

multiDirectional (bool)

setHillshadingZFactor(self, zFactor: float)[source]

Sets the z factor used by the hill shading method.

Parameters:

zFactor (float)

setLightAltitude(self, lightAltitude: float)[source]

Sets the altitude of the light (degree) that can be used by some methods (e.g. hill shading).

Parameters:

lightAltitude (float)

setLightAzimuth(self, lightAzimuth: float)[source]

Sets the azimuth of the light (degree) that can be used by some methods (e.g. hill shading).

See also

lightAzimuth()

Parameters:

lightAzimuth (float)

writeXml(self, elem: QDomElement, context: QgsReadWriteContext)[source]

Writes configuration on a DOM element

Parameters: