17#include "moc_qgsonlineterraingenerator.cpp"
37 cloned->mResolution = mResolution;
38 cloned->mSkirtHeight = mSkirtHeight;
39 cloned->updateGenerator();
56 if ( mHeightMapGenerator )
57 return mHeightMapGenerator->heightAt( x, y );
65 QDomElement elemExtent = elem.ownerDocument().createElement( QStringLiteral(
"extent" ) );
66 elemExtent.setAttribute( QStringLiteral(
"xmin" ), QString::number( r.
xMinimum() ) );
67 elemExtent.setAttribute( QStringLiteral(
"xmax" ), QString::number( r.
xMaximum() ) );
68 elemExtent.setAttribute( QStringLiteral(
"ymin" ), QString::number( r.
yMinimum() ) );
69 elemExtent.setAttribute( QStringLiteral(
"ymax" ), QString::number( r.
yMaximum() ) );
70 elem.appendChild( elemExtent );
72 elem.setAttribute( QStringLiteral(
"resolution" ), mResolution );
73 elem.setAttribute( QStringLiteral(
"skirt-height" ), mSkirtHeight );
80 mResolution = elem.attribute( QStringLiteral(
"resolution" ) ).toInt();
81 mSkirtHeight = elem.attribute( QStringLiteral(
"skirt-height" ) ).toFloat();
83 const QDomElement elemExtent = elem.firstChildElement( QStringLiteral(
"extent" ) );
84 const double xmin = elemExtent.attribute( QStringLiteral(
"xmin" ) ).toDouble();
85 const double xmax = elemExtent.attribute( QStringLiteral(
"xmax" ) ).toDouble();
86 const double ymin = elemExtent.attribute( QStringLiteral(
"ymin" ) ).toDouble();
87 const double ymax = elemExtent.attribute( QStringLiteral(
"ymax" ) ).toDouble();
97 mTransformContext = context;
110void QgsOnlineTerrainGenerator::updateGenerator()
122 mHeightMapGenerator.reset(
new QgsDemHeightMapGenerator(
nullptr,
mTerrainTilingScheme, mResolution, mTransformContext ) );
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
void setExtent(const QgsRectangle &extent) override
sets the extent of the terrain in terrain's CRS
void setCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context)
Sets CRS of the terrain.
float heightAt(double x, double y, const Qgs3DRenderContext &context) const override
Returns height at (x,y) in map's CRS.
QgsTerrainGenerator * clone() const override SIP_FACTORY
Makes a copy of the current instance.
~QgsOnlineTerrainGenerator() override
QgsOnlineTerrainGenerator()
void writeXml(QDomElement &elem) const override
Write terrain generator's configuration to XML.
QgsCoordinateReferenceSystem crs() const override
Returns CRS of the terrain.
QgsRectangle rootChunkExtent() const override
extent of the terrain's root chunk in terrain's CRS
Type type() const override
What texture generator implementation is this.
void readXml(const QDomElement &elem) override
Read terrain generator's configuration from XML.
QgsChunkLoader * createChunkLoader(QgsChunkNode *node) const override SIP_FACTORY
A rectangle specified with double values.
Type
Enumeration of the available terrain generators.
@ Online
Terrain is built from downloaded tiles with digital elevation model.
QgsTilingScheme mTerrainTilingScheme
Tiling scheme of the terrain.
virtual QgsRectangle extent() const
extent of the terrain in terrain's CRS, might be non-square and smaller than rootChunkExtent()
QgsTerrainEntity * mTerrain
virtual void setTerrain(QgsTerrainEntity *t)
Sets terrain entity for the generator (does not transfer ownership)
QgsRectangle tileToExtent(int x, int y, int z) const
Returns map coordinates of the extent of a tile.
const QgsCoordinateReferenceSystem & crs