Class: QgsAbstractTerrainProvider¶
Abstract base class for terrain providers.
Added in version 3.26.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: clone()
, crs()
, equals()
, heightAt()
, prepare()
, readXml()
, type()
, writeXml()
Class Hierarchy¶
Subclasses¶
A terrain provider where the terrain is a simple flat surface. |
|
A terrain provider that uses the Z values of a mesh layer to build a terrain surface. |
|
A terrain provider where the terrain source is a raster DEM layer. |
Abstract Methods
Creates a clone of the provider and returns the new object. |
|
Returns the native coordinate reference system of the terrain provider. |
|
Returns |
|
Returns the height at the point (x,y) in the terrain provider's native |
|
Called on the main thread prior to accessing the provider from a background thread. |
|
Reads the terrain provider state from a DOM element. |
|
Returns the unique type ID string for the provider. |
|
Returns a DOM element representing the state of the terrain provider. |
Methods
Returns the vertical offset value, used for adjusting the heights from the terrain provider. |
|
Reads common properties from a DOM element. |
|
Returns the vertical scale factor, which can be used to exaggerate vertical heights. |
|
Returns the vertical offset value, used for adjusting the heights from the terrain provider |
|
Sets the vertical scale factor, which can be used to exaggerate vertical heights. |
|
Writes common properties to a DOM element. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsAbstractTerrainProvider. See the FAQ for more details.
Resolves reference to layers from stored layer ID (if it has not been resolved already) |
- class qgis.core.QgsAbstractTerrainProvider[source]¶
Bases:
object
- abstract clone(self) QgsAbstractTerrainProvider | None [source]¶
Creates a clone of the provider and returns the new object.
Ownership is transferred to the caller.
- Return type:
Optional[QgsAbstractTerrainProvider]
- abstract crs(self) QgsCoordinateReferenceSystem [source]¶
Returns the native coordinate reference system of the terrain provider.
- Return type:
- abstract equals(self, other: QgsAbstractTerrainProvider | None) bool [source]¶
Returns
True
if the provider is equal toother
.- Parameters:
other (Optional[QgsAbstractTerrainProvider])
- Return type:
bool
- abstract heightAt(self, x: float, y: float) float [source]¶
Returns the height at the point (x,y) in the terrain provider’s native
crs()
.Returns NaN if the height could not be obtained at the specified point.
- Parameters:
x (float)
y (float)
- Return type:
float
- offset(self) float [source]¶
Returns the vertical offset value, used for adjusting the heights from the terrain provider.
See also
See also
- Return type:
float
- abstract prepare(self)[source]¶
Called on the main thread prior to accessing the provider from a background thread.
Subclasses must implement suitable logic in order to prepare for thread-safe calculation of terrain heights on background threads.
- readCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)[source]¶
Reads common properties from a DOM
element
.- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- abstract readXml(self, element: QDomElement, context: QgsReadWriteContext) bool [source]¶
Reads the terrain provider state from a DOM
element
.See also
- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- Return type:
bool
- virtual resolveReferences(self, project: QgsProject | None)[source]¶
Resolves reference to layers from stored layer ID (if it has not been resolved already)
- Parameters:
project (Optional[QgsProject])
- scale(self) float [source]¶
Returns the vertical scale factor, which can be used to exaggerate vertical heights.
See also
See also
- Return type:
float
- setOffset(self, offset: float)[source]¶
Returns the vertical
offset
value, used for adjusting the heights from the terrain providerSee also
See also
- Parameters:
offset (float)
- setScale(self, scale: float)[source]¶
Sets the vertical
scale
factor, which can be used to exaggerate vertical heights.See also
See also
- Parameters:
scale (float)
- abstract type(self) str [source]¶
Returns the unique type ID string for the provider.
- Return type:
str
- writeCommonProperties(self, element: QDomElement, context: QgsReadWriteContext)[source]¶
Writes common properties to a DOM
element
.- Parameters:
element (QDomElement)
context (QgsReadWriteContext)
- abstract writeXml(self, document: QDomDocument, context: QgsReadWriteContext) QDomElement [source]¶
Returns a DOM element representing the state of the terrain provider.
See also
- Parameters:
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
QDomElement