Skip to content
Permalink
Browse files

[3d] Fix flat/online terrain generator extent not saved

(cherry picked from commit 06a1e7d)
  • Loading branch information
nirvn authored and nyalldawson committed Dec 21, 2020
1 parent aad81d1 commit 25ddebe5b5b5554d3d54e82d725ce506e756f73e
Showing with 5 additions and 3 deletions.
  1. +1 −0 src/3d/terrain/qgsflatterraingenerator.cpp
  2. +4 −3 src/3d/terrain/qgsonlineterraingenerator.cpp
@@ -116,6 +116,7 @@ void QgsFlatTerrainGenerator::writeXml( QDomElement &elem ) const
elemExtent.setAttribute( QStringLiteral( "xmax" ), QString::number( r.xMaximum() ) );
elemExtent.setAttribute( QStringLiteral( "ymin" ), QString::number( r.yMinimum() ) );
elemExtent.setAttribute( QStringLiteral( "ymax" ), QString::number( r.yMaximum() ) );
elem.appendChild( elemExtent );

// crs is not read/written - it should be the same as destination crs of the map
}
@@ -66,6 +66,7 @@ void QgsOnlineTerrainGenerator::writeXml( QDomElement &elem ) const
elemExtent.setAttribute( QStringLiteral( "xmax" ), QString::number( r.xMaximum() ) );
elemExtent.setAttribute( QStringLiteral( "ymin" ), QString::number( r.yMinimum() ) );
elemExtent.setAttribute( QStringLiteral( "ymax" ), QString::number( r.yMaximum() ) );
elem.appendChild( elemExtent );

elem.setAttribute( QStringLiteral( "resolution" ), mResolution );
elem.setAttribute( QStringLiteral( "skirt-height" ), mSkirtHeight );
@@ -75,6 +76,9 @@ void QgsOnlineTerrainGenerator::writeXml( QDomElement &elem ) const

void QgsOnlineTerrainGenerator::readXml( const QDomElement &elem )
{
mResolution = elem.attribute( QStringLiteral( "resolution" ) ).toInt();
mSkirtHeight = elem.attribute( QStringLiteral( "skirt-height" ) ).toFloat();

QDomElement elemExtent = elem.firstChildElement( QStringLiteral( "extent" ) );
double xmin = elemExtent.attribute( QStringLiteral( "xmin" ) ).toDouble();
double xmax = elemExtent.attribute( QStringLiteral( "xmax" ) ).toDouble();
@@ -83,9 +87,6 @@ void QgsOnlineTerrainGenerator::readXml( const QDomElement &elem )

setExtent( QgsRectangle( xmin, ymin, xmax, ymax ) );

mResolution = elem.attribute( QStringLiteral( "resolution" ) ).toInt();
mSkirtHeight = elem.attribute( QStringLiteral( "skirt-height" ) ).toFloat();

// crs is not read/written - it should be the same as destination crs of the map
}

0 comments on commit 25ddebe

Please sign in to comment.
You can’t perform that action at this time.