QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
24 delete mHeightMapGenerator;
35 return qobject_cast<QgsRasterLayer *>( mLayer.
layer.data() );
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;
115 mHeightMapGenerator =
new QgsDemHeightMapGenerator( dem,
mTerrainTilingScheme, mResolution, mTransformContext );
121 delete mHeightMapGenerator;
122 mHeightMapGenerator =
nullptr;
QgsCoordinateReferenceSystem crs
@ Dem
Terrain is built from raster layer with digital elevation model.
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.
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.
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.
QgsRectangle tileToExtent(int x, int y, int z) const
Returns map coordinates of the extent of a tile.
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.