Class Quick3DTerrainProvider
ClassList > Quick3DTerrainProvider
#include <quick3dterrainprovider.h>
Inherits the following classes: QObject
Public Properties
| Type | Name |
|---|---|
| property QgsRectangle | extent Geographic extent used for terrain data. |
| property bool | forceSquareSize Whether the extent's shorter side will be expanded to form a square terrain. |
| property QSize | gridSize Grid dimensions (width x height) for terrain sampling. |
| property bool | isLoading Whether terrain data is currently being loaded. |
| property QgsQuickMapSettings * | mapSettings The map settings from which to get extent for terrain generation. |
| property QVariantList | normalizedData Normalized height data array [0.0-1.0] for terrain mesh generation. |
| property QgsProject * | project The project from which to read the terrain configuration and DEM layer. |
| property QSizeF | size Size of the terrain. |
Public Signals
| Type | Name |
|---|---|
| signal void | extentChanged |
| signal void | forceSquareSizeChanged |
| signal void | gridSizeChanged |
| signal void | isLoadingChanged |
| signal void | mapSettingsChanged |
| signal void | normalizedDataChanged |
| signal void | projectChanged |
| signal void | terrainDataReady Emitted when terrain data has been successfully loaded and is ready for use. |
Public Functions
| Type | Name |
|---|---|
| Quick3DTerrainProvider (QObject * parent=nullptr) Creates a new terrain provider. |
|
| Q_INVOKABLE double | calculateVisualExaggeration () const |
| QgsRectangle | extent () const Returns the geographic extent for terrain data retrieval. |
| bool | forceSquareSize () const |
| Q_INVOKABLE QVector3D | geoTo3D (double geoX, double geoY, float heightOffset=0.0f) const |
| QSize | gridSize () const Returns the grid dimensions for terrain sampling. |
| Q_INVOKABLE double | heightAt (double x, double y) const |
| bool | isLoading () const Returns TRUE if terrain data is currently being loaded. |
| QgsQuickMapSettings * | mapSettings () const Returns the map settings. |
| QVariantList | normalizedData () const Returns the normalized height data array [0.0-1.0]. |
| Q_INVOKABLE double | normalizedHeightAt (double x, double y) const |
| QgsProject * | project () const Returns the project from which to read terrain configuration and DEM layer. |
| void | setForceSquareSize (bool forceSquareSize) |
| void | setMapSettings (QgsQuickMapSettings * mapSettings) Sets the map settings. |
| void | setProject (QgsProject * project) Sets the project. |
| QSizeF | size () const Returns the size of the terrain. |
| ~Quick3DTerrainProvider () override |
Detailed Description
Provides terrain elevation data for 3D visualization from DEM raster layers or online elevation services.
This class handles elevation data retrieval from either a project's DEM raster layer or falls back to QGIS terrain providers (e.g., online Terrarium tiles) when no DEM is available. The data is normalized and provided as height samples for terrain mesh generation in Qt Quick 3D.
Note:
QML Type: Quick3DTerrainProvider
Public Properties Documentation
property extent [1/2]
Geographic extent used for terrain data.
QgsRectangle Quick3DTerrainProvider::extent;
property forceSquareSize [1/2]
Whether the extent's shorter side will be expanded to form a square terrain.
bool Quick3DTerrainProvider::forceSquareSize;
property gridSize [1/2]
Grid dimensions (width x height) for terrain sampling.
QSize Quick3DTerrainProvider::gridSize;
property isLoading [1/2]
Whether terrain data is currently being loaded.
bool Quick3DTerrainProvider::isLoading;
property mapSettings [1/2]
The map settings from which to get extent for terrain generation.
QgsQuickMapSettings * Quick3DTerrainProvider::mapSettings;
property normalizedData [1/2]
Normalized height data array [0.0-1.0] for terrain mesh generation.
QVariantList Quick3DTerrainProvider::normalizedData;
property project [1/2]
The project from which to read the terrain configuration and DEM layer.
QgsProject * Quick3DTerrainProvider::project;
property size [1/2]
Size of the terrain.
QSizeF Quick3DTerrainProvider::size;
Public Signals Documentation
signal extentChanged
void Quick3DTerrainProvider::extentChanged;
signal forceSquareSizeChanged
void Quick3DTerrainProvider::forceSquareSizeChanged;
signal gridSizeChanged
void Quick3DTerrainProvider::gridSizeChanged;
signal isLoadingChanged
void Quick3DTerrainProvider::isLoadingChanged;
signal mapSettingsChanged
void Quick3DTerrainProvider::mapSettingsChanged;
signal normalizedDataChanged
void Quick3DTerrainProvider::normalizedDataChanged;
signal projectChanged
void Quick3DTerrainProvider::projectChanged;
signal terrainDataReady
Emitted when terrain data has been successfully loaded and is ready for use.
void Quick3DTerrainProvider::terrainDataReady;
Public Functions Documentation
function Quick3DTerrainProvider
Creates a new terrain provider.
explicit Quick3DTerrainProvider::Quick3DTerrainProvider (
QObject * parent=nullptr
)
function calculateVisualExaggeration
Q_INVOKABLE double Quick3DTerrainProvider::calculateVisualExaggeration () const
Calculates recommended vertical exaggeration factor based on terrain height range.
Returns:
Exaggeration multiplier to enhance terrain visibility
function extent [2/2]
Returns the geographic extent for terrain data retrieval.
QgsRectangle Quick3DTerrainProvider::extent () const
function forceSquareSize [2/2]
bool Quick3DTerrainProvider::forceSquareSize () const
function geoTo3D
Q_INVOKABLE QVector3D Quick3DTerrainProvider::geoTo3D (
double geoX,
double geoY,
float heightOffset=0.0f
) const
Converts geographic coordinates to a 3D scene position.
Parameters:
geoXX coordinate in map CRSgeoYY coordinate in map CRSheightOffsetadditional vertical offset (default 0)
Returns:
3D position in scene space, or a null vector if the extent is invalid
function gridSize [2/2]
Returns the grid dimensions for terrain sampling.
QSize Quick3DTerrainProvider::gridSize () const
function heightAt
Q_INVOKABLE double Quick3DTerrainProvider::heightAt (
double x,
double y
) const
Returns the real height value at the specified map coordinates.
Parameters:
xX coordinate in map CRSyY coordinate in map CRS
Returns:
Height in map units, or 0 if outside extent
function isLoading [2/2]
Returns TRUE if terrain data is currently being loaded.
bool Quick3DTerrainProvider::isLoading () const
function mapSettings [2/2]
Returns the map settings.
QgsQuickMapSettings * Quick3DTerrainProvider::mapSettings () const
function normalizedData [2/2]
Returns the normalized height data array [0.0-1.0].
QVariantList Quick3DTerrainProvider::normalizedData () const
function normalizedHeightAt
Q_INVOKABLE double Quick3DTerrainProvider::normalizedHeightAt (
double x,
double y
) const
Returns the normalized height value [0.0-1.0] at the specified map coordinates.
Parameters:
xX coordinate in map CRSyY coordinate in map CRS
Returns:
Normalized height between 0 and 1, or 0 if outside extent
function project [2/2]
Returns the project from which to read terrain configuration and DEM layer.
QgsProject * Quick3DTerrainProvider::project () const
function setForceSquareSize
void Quick3DTerrainProvider::setForceSquareSize (
bool forceSquareSize
)
function setMapSettings
Sets the map settings.
void Quick3DTerrainProvider::setMapSettings (
QgsQuickMapSettings * mapSettings
)
function setProject
Sets the project.
void Quick3DTerrainProvider::setProject (
QgsProject * project
)
function size [2/2]
Returns the size of the terrain.
QSizeF Quick3DTerrainProvider::size () const
function ~Quick3DTerrainProvider
Quick3DTerrainProvider::~Quick3DTerrainProvider () override
The documentation for this class was generated from the following file src/core/3d/quick3dterrainprovider.h