Skip to content

Commit

Permalink
use project extent for saved 3d views in old projects
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Jan 24, 2023
1 parent ea97d48 commit d94a371
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -20,6 +20,7 @@
#include "qgsdemterraingenerator.h"
#include "qgsmeshterraingenerator.h"
#include "qgsonlineterraingenerator.h"
#include "qgsprojectviewsettings.h"
#include "qgsvectorlayer3drenderer.h"
#include "qgsmeshlayer3drenderer.h"
#include "qgspointcloudlayer3drenderer.h"
Expand Down Expand Up @@ -130,11 +131,18 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
elemOrigin.attribute( QStringLiteral( "z" ) ).toDouble() );

QDomElement elemExtent = elem.firstChildElement( QStringLiteral( "extent" ) );
mExtent = QgsRectangle(
elemExtent.attribute( QStringLiteral( "xMin" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "yMin" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "xMax" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "yMax" ) ).toDouble() );
if ( !elemExtent.isNull() )
{
mExtent = QgsRectangle(
elemExtent.attribute( QStringLiteral( "xMin" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "yMin" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "xMax" ) ).toDouble(),
elemExtent.attribute( QStringLiteral( "yMax" ) ).toDouble() );
}
else
{
mExtent = QgsProject::instance()->viewSettings()->fullExtent();
}

QDomElement elemCamera = elem.firstChildElement( QStringLiteral( "camera" ) );
if ( !elemCamera.isNull() )
Expand Down

0 comments on commit d94a371

Please sign in to comment.