Class Qf3DTerrainProvider
ClassList > Qf3DTerrainProvider
#include <qf3dterrainprovider.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 bool | isTransitioning Whether a transition to apply pan/zoom offsets has begun. |
| 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 QgsRectangle | normalizedDataExtent Geographic extent used for terrain data. |
| property double | offsetScale Offset scale from the last generated terrain data. |
| property QVector3D | offsetVector Offset vector from the last generated terrain data. |
| 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 | isTransitioningChanged |
| signal void | mapSettingsChanged |
| signal void | normalizedDataChanged |
| signal void | offsetScaleChanged |
| signal void | offsetVectorChanged |
| signal void | projectChanged |
| signal void | terrainDataReady Emitted when terrain data has been successfully loaded and is ready for use. |
Public Functions
| Type | Name |
|---|---|
| Qf3DTerrainProvider (QObject * parent=nullptr) Creates a new terrain provider. |
|
| Q_INVOKABLE void | beginTransition () Regenerates the extent and terrain data from current offset. |
| Q_INVOKABLE void | endTransition () Applies offsets and reset values to zeros. |
| QgsRectangle | extent () const Returns the current extent taking into account offsets. |
| bool | forceSquareSize () const |
| Q_INVOKABLE QVector3D | geoTo3D (double geoX, double geoY, float heightOffset=0.0f) const |
| Q_INVOKABLE QVector3D | geoTo3D (const QgsPoint & geoPoint, 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. |
| bool | isTransitioning () const |
| QgsQuickMapSettings * | mapSettings () const Returns the map settings. |
| QVariantList | normalizedData () const Returns the normalized height data array [0.0-1.0]. |
| QgsRectangle | normalizedDataExtent () const Returns the geographic extent for the retrieved terrain data. |
| Q_INVOKABLE double | normalizedHeightAt (double x, double y) const |
| double | offsetScale () const Returns the offset scale from the last generated terrain data. |
| QVector3D | offsetVector () const Returns the offset scale from the last generated terrain data. |
| Q_INVOKABLE void | pan (double x, double z) Applies X/Z offsets to the stored terrain based on pan action. |
| QgsProject * | project () const Returns the project from which to read terrain configuration and DEM layer. |
| Q_INVOKABLE QgsPoint | scene3DToGeo (double sceneX, double sceneZ) const |
| 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. |
| Q_INVOKABLE void | zoom (double factor) Applies scale offset to the stored terrain based on zoom action. |
| ~Qf3DTerrainProvider () 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: Qf3DTerrainProvider
Public Properties Documentation
property extent [1/2]
Geographic extent used for terrain data.
QgsRectangle Qf3DTerrainProvider::extent;
property forceSquareSize [1/2]
Whether the extent's shorter side will be expanded to form a square terrain.
bool Qf3DTerrainProvider::forceSquareSize;
property gridSize [1/2]
Grid dimensions (width x height) for terrain sampling.
QSize Qf3DTerrainProvider::gridSize;
property isLoading [1/2]
Whether terrain data is currently being loaded.
bool Qf3DTerrainProvider::isLoading;
property isTransitioning [1/2]
Whether a transition to apply pan/zoom offsets has begun.
bool Qf3DTerrainProvider::isTransitioning;
property mapSettings [1/2]
The map settings from which to get extent for terrain generation.
QgsQuickMapSettings * Qf3DTerrainProvider::mapSettings;
property normalizedData [1/2]
Normalized height data array [0.0-1.0] for terrain mesh generation.
QVariantList Qf3DTerrainProvider::normalizedData;
property normalizedDataExtent [1/2]
Geographic extent used for terrain data.
QgsRectangle Qf3DTerrainProvider::normalizedDataExtent;
property offsetScale [1/2]
Offset scale from the last generated terrain data.
double Qf3DTerrainProvider::offsetScale;
property offsetVector [1/2]
Offset vector from the last generated terrain data.
QVector3D Qf3DTerrainProvider::offsetVector;
property project [1/2]
The project from which to read the terrain configuration and DEM layer.
QgsProject * Qf3DTerrainProvider::project;
property size [1/2]
Size of the terrain.
QSizeF Qf3DTerrainProvider::size;
Public Signals Documentation
signal extentChanged
void Qf3DTerrainProvider::extentChanged;
signal forceSquareSizeChanged
void Qf3DTerrainProvider::forceSquareSizeChanged;
signal gridSizeChanged
void Qf3DTerrainProvider::gridSizeChanged;
signal isLoadingChanged
void Qf3DTerrainProvider::isLoadingChanged;
signal isTransitioningChanged
void Qf3DTerrainProvider::isTransitioningChanged;
signal mapSettingsChanged
void Qf3DTerrainProvider::mapSettingsChanged;
signal normalizedDataChanged
void Qf3DTerrainProvider::normalizedDataChanged;
signal offsetScaleChanged
void Qf3DTerrainProvider::offsetScaleChanged;
signal offsetVectorChanged
void Qf3DTerrainProvider::offsetVectorChanged;
signal projectChanged
void Qf3DTerrainProvider::projectChanged;
signal terrainDataReady
Emitted when terrain data has been successfully loaded and is ready for use.
void Qf3DTerrainProvider::terrainDataReady;
Public Functions Documentation
function Qf3DTerrainProvider
Creates a new terrain provider.
explicit Qf3DTerrainProvider::Qf3DTerrainProvider (
QObject * parent=nullptr
)
function beginTransition
Regenerates the extent and terrain data from current offset.
Q_INVOKABLE void Qf3DTerrainProvider::beginTransition ()
function endTransition
Applies offsets and reset values to zeros.
Q_INVOKABLE void Qf3DTerrainProvider::endTransition ()
function extent [2/2]
Returns the current extent taking into account offsets.
inline QgsRectangle Qf3DTerrainProvider::extent () const
function forceSquareSize [2/2]
bool Qf3DTerrainProvider::forceSquareSize () const
function geoTo3D [1/2]
Q_INVOKABLE QVector3D Qf3DTerrainProvider::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 geoTo3D [2/2]
Q_INVOKABLE QVector3D Qf3DTerrainProvider::geoTo3D (
const QgsPoint & geoPoint,
float heightOffset=0.0f
) const
Converts geographic coordinates to a 3D scene position.
Parameters:
geoPointPoint coordinate in map CRS
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.
inline QSize Qf3DTerrainProvider::gridSize () const
function heightAt
Q_INVOKABLE double Qf3DTerrainProvider::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 Qf3DTerrainProvider::isLoading () const
function isTransitioning [2/2]
inline bool Qf3DTerrainProvider::isTransitioning () const
function mapSettings [2/2]
Returns the map settings.
QgsQuickMapSettings * Qf3DTerrainProvider::mapSettings () const
function normalizedData [2/2]
Returns the normalized height data array [0.0-1.0].
QVariantList Qf3DTerrainProvider::normalizedData () const
function normalizedDataExtent [2/2]
Returns the geographic extent for the retrieved terrain data.
inline QgsRectangle Qf3DTerrainProvider::normalizedDataExtent () const
function normalizedHeightAt
Q_INVOKABLE double Qf3DTerrainProvider::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 offsetScale [2/2]
Returns the offset scale from the last generated terrain data.
inline double Qf3DTerrainProvider::offsetScale () const
function offsetVector [2/2]
Returns the offset scale from the last generated terrain data.
inline QVector3D Qf3DTerrainProvider::offsetVector () const
function pan
Applies X/Z offsets to the stored terrain based on pan action.
Q_INVOKABLE void Qf3DTerrainProvider::pan (
double x,
double z
)
function project [2/2]
Returns the project from which to read terrain configuration and DEM layer.
QgsProject * Qf3DTerrainProvider::project () const
function scene3DToGeo
Q_INVOKABLE QgsPoint Qf3DTerrainProvider::scene3DToGeo (
double sceneX,
double sceneZ
) const
Converts a 3D scene position back to geographic coordinates in map CRS. Inverse of geoTo3D(); returns an empty QgsPoint when the extent is invalid.
function setForceSquareSize
void Qf3DTerrainProvider::setForceSquareSize (
bool forceSquareSize
)
function setMapSettings
Sets the map settings.
void Qf3DTerrainProvider::setMapSettings (
QgsQuickMapSettings * mapSettings
)
function setProject
Sets the project.
void Qf3DTerrainProvider::setProject (
QgsProject * project
)
function size [2/2]
Returns the size of the terrain.
inline QSizeF Qf3DTerrainProvider::size () const
function zoom
Applies scale offset to the stored terrain based on zoom action.
Q_INVOKABLE void Qf3DTerrainProvider::zoom (
double factor
)
function ~Qf3DTerrainProvider
Qf3DTerrainProvider::~Qf3DTerrainProvider () override
The documentation for this class was generated from the following file src/3d/qf3dterrainprovider.h