QGIS API Documentation 4.3.0-Master (16eddb2670e)
Loading...
Searching...
No Matches
QgsDemTerrainGenerator Class Reference

Implementation of terrain generator that uses a raster layer with DEM to build terrain. More...

#include <qgsdemterraingenerator.h>

Inheritance diagram for QgsDemTerrainGenerator:

Public Member Functions

 QgsDemTerrainGenerator ()
 ~QgsDemTerrainGenerator () override
QgsTerrainGenerator::Capabilities capabilities () const override
 Returns flags containing the supported capabilities.
QgsTerrainGenerator * clone () const override
 Makes a copy of the current instance.
QgsCoordinateReferenceSystem crs () const override
 Returns CRS of the terrain.
float heightAt (double x, double y, const Qgs3DRenderContext &context) const override
 Returns height at (x,y) in map's CRS.
QgsDemHeightMapGenerator * heightMapGenerator ()
 Returns height map generator object - takes care of extraction of elevations from the layer).
QgsRasterLayer * layer () const
 Returns raster layer with elevation model to be used for terrain generation.
QFuture< QgsChunkLoaderResult > loadChunk (QgsChunkNode *node) override
int resolution () const
 Returns resolution of the generator (how many elevation samples on one side of a terrain tile).
QgsRectangle rootChunkExtent () const override
 extent of the terrain's root chunk in terrain's CRS
void setCrs (const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context) override
 Sets the CRS associated with the terrain.
void setExtent (const QgsRectangle &extent) override
 sets the extent of the terrain in terrain's CRS
void setLayer (QgsRasterLayer *layer)
 Sets raster layer with elevation model to be used for terrain generation.
void setResolution (int resolution)
 Sets resolution of the generator (how many elevation samples on one side of a terrain tile).
void setSkirtHeight (float skirtHeight)
 Sets skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adjacent tiles.
float skirtHeight () const
 Returns skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adjacent tiles.
Type type () const override
 What texture generator implementation is this.
Public Member Functions inherited from QgsTerrainGenerator
 QgsTerrainGenerator ()
 Create new terrain generator.
 ~QgsTerrainGenerator () override
bool isValid () const
 Returns whether the terrain generator is valid.
virtual QgsBox3D rootChunkBox3D (const Qgs3DMapSettings &map) const
 Returns 3D box (in map coordinates) of the root chunk.
virtual float rootChunkError (const Qgs3DMapSettings &map) const
 Returns error of the root chunk in world coordinates.
virtual void rootChunkHeightRange (float &hMin, float &hMax) const
 Returns height range of the root chunk in world coordinates.
virtual void setTerrain (QgsTerrainEntity *t)
 Sets terrain entity for the generator (does not transfer ownership).
const QgsTilingScheme & tilingScheme () const
 Returns tiling scheme of the terrain.
QFuture< QgsChunkLoaderResult > updateChunk (QgsChunkNode *node) override

Static Public Member Functions

static QgsTerrainGenerator * create ()
 Creates a new instance of a QgsDemTerrainGenerator object.
Static Public Member Functions inherited from QgsTerrainGenerator
static QString typeToString (Type type)
 Converts terrain generator type enumeration into a string.

Protected Member Functions

virtual void updateGenerator ()
 (Re-)creates mHeightMapGenerator based on current params
Protected Member Functions inherited from QgsTerrainGenerator
void applyMaterial (const TerrainTextureResources &resources, QgsTerrainTileEntity *entity, bool isShadingEnabled, const QgsPhongMaterialSettings &shadingMaterial, bool useTexture, const Qgs3DRenderContext &context)
 Creates material component for the entity with the rendered map as a texture.
Qt3DRender::QTexture2D * applyTexture (QgsTerrainTileEntity *entity, const QgsMaterialContext &context, const TerrainTextureResources &resources) const
 Creates a new texture that is linked to the entity.
QFuture< TerrainTextureResources > loadTextureResources (QgsChunkNode *node)
 Asynchronously loads resources for creating texture.

Protected Attributes

QgsCoordinateReferenceSystem mCrs
std::unique_ptr< QgsDemHeightMapGenerator > mHeightMapGenerator
QPointer< QgsRasterLayer > mLayer
 source layer for heights
int mResolution = 16
 how many vertices to place on one side of the tile
float mSkirtHeight = 10.f
 height of the "skirts" at the edges of tiles to hide cracks between adjacent cracks
QgsCoordinateTransformContext mTransformContext
Protected Attributes inherited from QgsTerrainGenerator
QgsRectangle mExtent
bool mIsValid = true
QgsTerrainEntity * mTerrain = nullptr
QgsTilingScheme mTerrainTilingScheme
 Tiling scheme of the terrain.

Additional Inherited Members

Public Types inherited from QgsTerrainGenerator
typedef QFlags< Capability > Capabilities
enum class  Capability : int { NoCapabilities = 1 << 0 , SupportsTileResolution = 1 << 1 }
 Specific capabilities of the terrain generator. More...
enum  Type {
  Flat , Dem , Online , Mesh ,
  QuantizedMesh
}
 Enumeration of the available terrain generators. More...
Signals inherited from QgsTerrainGenerator
void terrainChanged ()
 Emitted when the terrain changed (for example, raster DEM or mesh have data changed).

Detailed Description

Implementation of terrain generator that uses a raster layer with DEM to build terrain.

Note
Not available in Python bindings

Definition at line 36 of file qgsdemterraingenerator.h.

Constructor & Destructor Documentation

◆ QgsDemTerrainGenerator()

QgsDemTerrainGenerator::QgsDemTerrainGenerator ( )
default

◆ ~QgsDemTerrainGenerator()

QgsDemTerrainGenerator::~QgsDemTerrainGenerator ( )
override

Definition at line 46 of file qgsdemterraingenerator.cpp.

Member Function Documentation

◆ capabilities()

QgsTerrainGenerator::Capabilities QgsDemTerrainGenerator::capabilities ( ) const
overridevirtual

Returns flags containing the supported capabilities.

Since
QGIS.4.0

Reimplemented from QgsTerrainGenerator.

Definition at line 210 of file qgsdemterraingenerator.cpp.

◆ clone()

QgsTerrainGenerator * QgsDemTerrainGenerator::clone ( ) const
overridevirtual

Makes a copy of the current instance.

Implements QgsTerrainGenerator.

Reimplemented in QgsOnlineTerrainGenerator.

Definition at line 67 of file qgsdemterraingenerator.cpp.

◆ create()

QgsTerrainGenerator * QgsDemTerrainGenerator::create ( )
static

Creates a new instance of a QgsDemTerrainGenerator object.

Definition at line 39 of file qgsdemterraingenerator.cpp.

◆ crs()

QgsCoordinateReferenceSystem QgsDemTerrainGenerator::crs ( ) const
inlineoverridevirtual

Returns CRS of the terrain.

Reimplemented from QgsTerrainGenerator.

Definition at line 55 of file qgsdemterraingenerator.h.

◆ heightAt()

float QgsDemTerrainGenerator::heightAt ( double x,
double y,
const Qgs3DRenderContext & context ) const
overridevirtual

Returns height at (x,y) in map's CRS.

Implements QgsTerrainGenerator.

Definition at line 90 of file qgsdemterraingenerator.cpp.

◆ heightMapGenerator()

QgsDemHeightMapGenerator * QgsDemTerrainGenerator::heightMapGenerator ( )
inline

Returns height map generator object - takes care of extraction of elevations from the layer).

Definition at line 72 of file qgsdemterraingenerator.h.

◆ layer()

QgsRasterLayer * QgsDemTerrainGenerator::layer ( ) const

Returns raster layer with elevation model to be used for terrain generation.

Definition at line 55 of file qgsdemterraingenerator.cpp.

◆ loadChunk()

QFuture< QgsChunkLoaderResult > QgsDemTerrainGenerator::loadChunk ( QgsChunkNode * node)
override

Definition at line 121 of file qgsdemterraingenerator.cpp.

◆ resolution()

int QgsDemTerrainGenerator::resolution ( ) const
inline

Returns resolution of the generator (how many elevation samples on one side of a terrain tile).

Definition at line 64 of file qgsdemterraingenerator.h.

◆ rootChunkExtent()

QgsRectangle QgsDemTerrainGenerator::rootChunkExtent ( ) const
overridevirtual

extent of the terrain's root chunk in terrain's CRS

Implements QgsTerrainGenerator.

Definition at line 85 of file qgsdemterraingenerator.cpp.

◆ setCrs()

void QgsDemTerrainGenerator::setCrs ( const QgsCoordinateReferenceSystem & crs,
const QgsCoordinateTransformContext & context )
overridevirtual

Sets the CRS associated with the terrain.

See also
crs()

Reimplemented from QgsTerrainGenerator.

Definition at line 60 of file qgsdemterraingenerator.cpp.

◆ setExtent()

void QgsDemTerrainGenerator::setExtent ( const QgsRectangle & extent)
overridevirtual

sets the extent of the terrain in terrain's CRS

Reimplemented from QgsTerrainGenerator.

Definition at line 179 of file qgsdemterraingenerator.cpp.

◆ setLayer()

void QgsDemTerrainGenerator::setLayer ( QgsRasterLayer * layer)

Sets raster layer with elevation model to be used for terrain generation.

Definition at line 49 of file qgsdemterraingenerator.cpp.

◆ setResolution()

void QgsDemTerrainGenerator::setResolution ( int resolution)
inline

Sets resolution of the generator (how many elevation samples on one side of a terrain tile).

Definition at line 58 of file qgsdemterraingenerator.h.

◆ setSkirtHeight()

void QgsDemTerrainGenerator::setSkirtHeight ( float skirtHeight)
inline

Sets skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adjacent tiles.

Definition at line 67 of file qgsdemterraingenerator.h.

◆ skirtHeight()

float QgsDemTerrainGenerator::skirtHeight ( ) const
inline

Returns skirt height (in world units). Skirts at the edges of terrain tiles help hide cracks between adjacent tiles.

Definition at line 69 of file qgsdemterraingenerator.h.

◆ type()

QgsTerrainGenerator::Type QgsDemTerrainGenerator::type ( ) const
overridevirtual

What texture generator implementation is this.

Implements QgsTerrainGenerator.

Reimplemented in QgsOnlineTerrainGenerator.

Definition at line 80 of file qgsdemterraingenerator.cpp.

◆ updateGenerator()

void QgsDemTerrainGenerator::updateGenerator ( )
protectedvirtual

(Re-)creates mHeightMapGenerator based on current params

Reimplemented in QgsOnlineTerrainGenerator.

Definition at line 188 of file qgsdemterraingenerator.cpp.

Member Data Documentation

◆ mCrs

QgsCoordinateReferenceSystem QgsDemTerrainGenerator::mCrs
protected

Definition at line 90 of file qgsdemterraingenerator.h.

◆ mHeightMapGenerator

std::unique_ptr<QgsDemHeightMapGenerator> QgsDemTerrainGenerator::mHeightMapGenerator
protected

Definition at line 88 of file qgsdemterraingenerator.h.

◆ mLayer

QPointer<QgsRasterLayer> QgsDemTerrainGenerator::mLayer
protected

source layer for heights

Definition at line 95 of file qgsdemterraingenerator.h.

◆ mResolution

int QgsDemTerrainGenerator::mResolution = 16
protected

how many vertices to place on one side of the tile

Definition at line 97 of file qgsdemterraingenerator.h.

◆ mSkirtHeight

float QgsDemTerrainGenerator::mSkirtHeight = 10.f
protected

height of the "skirts" at the edges of tiles to hide cracks between adjacent cracks

Definition at line 99 of file qgsdemterraingenerator.h.

◆ mTransformContext

QgsCoordinateTransformContext QgsDemTerrainGenerator::mTransformContext
protected

Definition at line 92 of file qgsdemterraingenerator.h.


The documentation for this class was generated from the following files: