QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
25 delete mHeightMapGenerator;
36 return qobject_cast<QgsRasterLayer *>( mLayer.
layer.data() );
42 mTransformContext = context;
51 cloned->mLayer = mLayer;
52 cloned->mResolution = mResolution;
53 cloned->mSkirtHeight = mSkirtHeight;
54 cloned->updateGenerator();
71 if ( mHeightMapGenerator )
72 return mHeightMapGenerator->heightAt( x, y );
79 elem.setAttribute( QStringLiteral(
"layer" ), mLayer.
layerId );
80 elem.setAttribute( QStringLiteral(
"resolution" ), mResolution );
81 elem.setAttribute( QStringLiteral(
"skirt-height" ), mSkirtHeight );
88 mLayer =
QgsMapLayerRef( elem.attribute( QStringLiteral(
"layer" ) ) );
89 mResolution = elem.attribute( QStringLiteral(
"resolution" ) ).toInt();
90 mSkirtHeight = elem.attribute( QStringLiteral(
"skirt-height" ) ).toFloat();
107 void QgsDemTerrainGenerator::updateGenerator()
114 terrainToMapTransform.setBallparkTransformsAreAppropriate(
true );
115 te = terrainToMapTransform.transformBoundingBox( te );
118 delete mHeightMapGenerator;
119 mHeightMapGenerator =
new QgsDemHeightMapGenerator( dem,
mTerrainTilingScheme, mResolution, mTransformContext );
125 delete mHeightMapGenerator;
126 mHeightMapGenerator =
nullptr;
QgsCoordinateReferenceSystem crs
@ Dem
Terrain is built from raster layer with digital elevation model.
Contains information about the context in which a coordinate transform is executed.
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
QgsChunkLoader * createChunkLoader(QgsChunkNode *node) const override
const QgsCoordinateReferenceSystem & crs
void readXml(const QDomElement &elem) override
Read terrain generator's configuration from XML.
_LayerRef< QgsMapLayer > QgsMapLayerRef
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QPointer< TYPE > layer
Weak pointer to map layer.
A rectangle specified with double values.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Type type() const override
What texture generator implementation is this.
QString layerId
Original layer ID.
QgsTerrainEntity * mTerrain
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
QgsRasterLayer * layer() const
Returns raster layer with elevation model to be used for terrain generation.
QgsTerrainGenerator * clone() const override
Makes a copy of the current instance.
Base class for generators of terrain.
virtual QgsRectangle extent() const
Returns the extent of the layer.
float heightAt(double x, double y, const Qgs3DMapSettings &map) const override
Returns height at (x,y) in terrain's CRS.
Type
Enumeration of the available terrain generators.
void resolveReferences(const QgsProject &project) override
After read of XML, resolve references to any layers that have been read as layer IDs.
Represents a raster layer.
QgsRectangle tileToExtent(int x, int y, int z) const
Returns map coordinates of the extent of a tile.
This class represents a coordinate reference system (CRS).
Implementation of terrain generator that uses a raster layer with DEM to build terrain.
void setCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets CRS of the terrain.
void setLayer(QgsRasterLayer *layer)
Sets raster layer with elevation model to be used for terrain generation.
~QgsDemTerrainGenerator() override
void writeXml(QDomElement &elem) const override
Write terrain generator's configuration to XML.
QgsRectangle extent() const override
extent of the terrain in terrain's CRS
QgsDemTerrainGenerator()=default
Constructor for QgsDemTerrainGenerator.
The class encapsulates tiling scheme (just like with WMTS / TMS / XYZ layers).
void setTerrain(QgsTerrainEntity *t)
Sets terrain entity for the generator (does not transfer ownership)