From 844687fdb7adebb2e85c48d7f77d0557623640a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ko=C5=88a=C5=99=C3=ADk?= Date: Thu, 26 Jun 2025 14:37:16 +0200 Subject: [PATCH] Improve camera XML format per review suggestion --- src/3d/qgscameracontroller.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/3d/qgscameracontroller.cpp b/src/3d/qgscameracontroller.cpp index bc87f17647e..ac3231d8bb2 100644 --- a/src/3d/qgscameracontroller.cpp +++ b/src/3d/qgscameracontroller.cpp @@ -268,8 +268,8 @@ QDomElement QgsCameraController::writeXml( QDomDocument &doc ) const // the same on loading QgsVector3D centerPoint = mCameraPose.centerPoint() + mOrigin; elemCamera.setAttribute( QStringLiteral( "xMap" ), centerPoint.x() ); - elemCamera.setAttribute( QStringLiteral( "yMap" ), centerPoint.z() ); - elemCamera.setAttribute( QStringLiteral( "elevMap" ), centerPoint.y() ); + elemCamera.setAttribute( QStringLiteral( "yMap" ), centerPoint.y() ); + elemCamera.setAttribute( QStringLiteral( "zMap" ), centerPoint.z() ); elemCamera.setAttribute( QStringLiteral( "dist" ), mCameraPose.distanceFromCenterPoint() ); elemCamera.setAttribute( QStringLiteral( "pitch" ), mCameraPose.pitchAngle() ); elemCamera.setAttribute( QStringLiteral( "yaw" ), mCameraPose.headingAngle() ); @@ -286,17 +286,17 @@ void QgsCameraController::readXml( const QDomElement &elem, QgsVector3D savedOri if ( elem.hasAttribute( "xMap" ) ) { // Prefer newer point saved in map coordinates ... - const float x = elem.attribute( QStringLiteral( "xMap" ) ).toFloat(); - const float y = elem.attribute( QStringLiteral( "yMap" ) ).toFloat(); - const float elev = elem.attribute( QStringLiteral( "elevMap" ) ).toFloat(); - centerPoint = QgsVector3D( x, elev, y ) - mOrigin; + const double x = elem.attribute( QStringLiteral( "xMap" ) ).toDouble(); + const double y = elem.attribute( QStringLiteral( "yMap" ) ).toDouble(); + const double z = elem.attribute( QStringLiteral( "zMap" ) ).toDouble(); + centerPoint = QgsVector3D( x, y, z ) - mOrigin; } else { // ... but allow use of older origin-relative coordinates. - const float x = elem.attribute( QStringLiteral( "x" ) ).toFloat(); - const float y = elem.attribute( QStringLiteral( "y" ) ).toFloat(); - const float elev = elem.attribute( QStringLiteral( "elev" ) ).toFloat(); + const double x = elem.attribute( QStringLiteral( "x" ) ).toDouble(); + const double y = elem.attribute( QStringLiteral( "y" ) ).toDouble(); + const double elev = elem.attribute( QStringLiteral( "elev" ) ).toDouble(); centerPoint = QgsVector3D( x, elev, y ) - savedOrigin + mOrigin; } setLookingAtPoint( centerPoint, dist, pitch, yaw );