24 delete mHeightMapGenerator;
41 mTransformContext = context;
49 cloned->mLayer = mLayer;
50 cloned->mResolution = mResolution;
51 cloned->mSkirtHeight = mSkirtHeight;
52 cloned->updateGenerator();
69 if ( mHeightMapGenerator )
70 return mHeightMapGenerator->heightAt( x, y );
77 elem.setAttribute( QStringLiteral(
"layer" ), mLayer.
layerId );
78 elem.setAttribute( QStringLiteral(
"resolution" ), mResolution );
79 elem.setAttribute( QStringLiteral(
"skirt-height" ), mSkirtHeight );
86 mLayer =
QgsMapLayerRef( elem.attribute( QStringLiteral(
"layer" ) ) );
87 mResolution = elem.attribute( QStringLiteral(
"resolution" ) ).toInt();
88 mSkirtHeight = elem.attribute( QStringLiteral(
"skirt-height" ) ).toFloat();
101 return new QgsDemTerrainTileLoader(
mTerrain, node );
104 void QgsDemTerrainGenerator::updateGenerator()
111 te = terrainToMapTransform.transformBoundingBox( te );
114 delete mHeightMapGenerator;
120 delete mHeightMapGenerator;
121 mHeightMapGenerator =
nullptr;
A rectangle specified with double values.
QgsTerrainGenerator * clone() const override
Makes a copy of the current instance.
_LayerRef< QgsMapLayer > QgsMapLayerRef
QgsDemTerrainGenerator()=default
Constructor for QgsDemTerrainGenerator.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QgsCoordinateReferenceSystem crs() const
Returns CRS of the terrain.
float heightAt(double x, double y, const Qgs3DMapSettings &map) const override
Returns height at (x,y) in terrain's CRS.
3 Definition of the world
virtual QgsRectangle extent() const
Returns the extent of the layer.
QString layerId
Original layer ID.
Terrain is built from raster layer with digital elevation model.
void setLayer(QgsRasterLayer *layer)
Sets raster layer with elevation model to be used for terrain generation.
void setCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets CRS of the terrain.
QPointer< TYPE > layer
Weak pointer to map layer.
~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
QgsTerrainEntity * mTerrain
Reads and writes project states.
Contains information about the context in which a coordinate transform is executed.
void readXml(const QDomElement &elem) override
Read terrain generator's configuration from XML.
Type
Enumeration of the available terrain generators.
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
3 Base class for generators of terrain.
3 Implementation of terrain generator that uses a raster layer with DEM to build terrain.
QgsChunkLoader * createChunkLoader(QgsChunkNode *node) const override
QgsRasterLayer * layer() const
Returns raster layer with elevation model to be used for terrain generation.
This class represents a coordinate reference system (CRS).
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
void resolveReferences(const QgsProject &project) override
After read of XML, resolve references to any layers that have been read as layer IDs.
3 The class encapsulates tiling scheme (just like with WMTS / TMS / XYZ layers).
QgsRectangle tileToExtent(int x, int y, int z) const
Returns map coordinates of the extent of a tile.
Type type() const override
What texture generator implementation is this.
QgsCoordinateReferenceSystem crs