Class: QgsAbstractTerrainSettings

Base class for all terrain settings classes.

QgsAbstractTerrainSettings subclasses are responsible for storing the configuration of terrain generators.

Warning

This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings as a tech preview only.

Added in version 3.42.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: clone(), equals(), readXml(), type(), writeXml()

Class Hierarchy

Inheritance diagram of qgis._3d.QgsAbstractTerrainSettings

Subclasses

QgsDemTerrainSettings

Terrain settings for a terrain generator that uses a raster DEM layer to build terrain.

QgsFlatTerrainSettings

Terrain settings for a simple flat area terrain.

QgsMeshTerrainSettings

Terrain settings for a terrain generator that uses the Z values of a mesh layer to build a terrain.

QgsOnlineDemTerrainSettings

Terrain settings for a terrain generator that uses an online DEM to build terrain.

QgsQuantizedMeshTerrainSettings

Terrain settings for a terrain generator that uses a quantized mesh tile layer to build a terrain.

Abstract Methods

clone

Returns a copy of the terrain settings.

equals

Returns True if this settings is exactly equal to another other settings.

readXml

Reads settings from a DOM element.

type

Returns the unique type name for the terrain generator.

writeXml

Writes settings to a DOM element.

Methods

elevationOffset

Returns the elevation offset of the terrain (used to move the terrain up or down).

mapTileResolution

Returns the resolution (in pixels) of the texture of a terrain tile.

maximumGroundError

Returns the maximum ground error of terrain tiles in world units.

maximumScreenError

Returns the maximum allowed screen error of terrain tiles in pixels.

setElevationOffset

Sets the terrain elevation offset (used to move the terrain up or down).

setMapTileResolution

Sets the resolution (in pixels) of the texture of a terrain tile

setMaximumGroundError

Sets the maximum ground error of terrain tiles in world units.

setMaximumScreenError

Sets the maximum allowed screen error of terrain tiles in pixels.

setVerticalScale

Sets the vertical scale (exaggeration) for terrain.

verticalScale

Returns the vertical scale (exaggeration) for terrain.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsAbstractTerrainSettings. See the FAQ for more details.

resolveReferences

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

class qgis._3d.QgsAbstractTerrainSettings[source]

Bases: object

abstract clone(self) QgsAbstractTerrainSettings | None[source]

Returns a copy of the terrain settings.

Return type:

Optional[QgsAbstractTerrainSettings]

elevationOffset(self) float[source]

Returns the elevation offset of the terrain (used to move the terrain up or down).

Return type:

float

abstract equals(self, other: QgsAbstractTerrainSettings | None) bool[source]

Returns True if this settings is exactly equal to another other settings.

Parameters:

other (Optional[QgsAbstractTerrainSettings])

Return type:

bool

mapTileResolution(self) int[source]

Returns the resolution (in pixels) of the texture of a terrain tile.

This parameter influences how many zoom levels for terrain tiles there will be (together with maxTerrainGroundError())

Return type:

int

maximumGroundError(self) float[source]

Returns the maximum ground error of terrain tiles in world units.

This parameter influences how many zoom levels there will be (together with mapTileResolution()). This value tells that when the given ground error is reached (e.g. 10 meters), it makes no sense to further split terrain tiles into finer ones because they will not add extra details anymore.

Return type:

float

maximumScreenError(self) float[source]

Returns the maximum allowed screen error of terrain tiles in pixels.

This parameter decides how aggressively less detailed terrain tiles are swapped to more detailed ones as camera gets closer. Each tile has its error defined in world units - this error gets projected to screen pixels according to camera view and if the tile’s error is greater than the allowed error, it will be swapped by more detailed tiles with lower error.

see setMaximumScreenError()

Return type:

float

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

Reads settings from a DOM element.

Subclasses should take care to call readCommonProperties() to read common properties from the element.

See also

writeXml()

Parameters:
virtual resolveReferences(self, project: QgsProject | None)[source]

After reading settings from XML, resolves references to any layers in a project that have been read as layer IDs.

See also

readXml()

Parameters:

project (Optional[QgsProject])

setElevationOffset(self, offset: float)[source]

Sets the terrain elevation offset (used to move the terrain up or down).

Parameters:

offset (float)

setMapTileResolution(self, resolution: int)[source]

Sets the resolution (in pixels) of the texture of a terrain tile

Parameters:

resolution (int)

setMaximumGroundError(self, error: float)[source]

Sets the maximum ground error of terrain tiles in world units.

Parameters:

error (float)

setMaximumScreenError(self, error: float)[source]

Sets the maximum allowed screen error of terrain tiles in pixels.

Parameters:

error (float)

setVerticalScale(self, scale: float)[source]

Sets the vertical scale (exaggeration) for terrain.

(1 = true scale, > 1 = hills get more pronounced)

See also

verticalScale()

Parameters:

scale (float)

abstract type(self) str[source]

Returns the unique type name for the terrain generator.

Return type:

str

verticalScale(self) float[source]

Returns the vertical scale (exaggeration) for terrain.

(1 = true scale, > 1 = hills get more pronounced)

Return type:

float

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

Writes settings to a DOM element.

Subclasses should take care to call writeCommonProperties() to write common properties to the element.

See also

readXml()

Parameters: