mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
Improve camera XML format per review suggestion
This commit is contained in:
parent
2e1aeaa258
commit
844687fdb7
@ -268,8 +268,8 @@ QDomElement QgsCameraController::writeXml( QDomDocument &doc ) const
|
|||||||
// the same on loading
|
// the same on loading
|
||||||
QgsVector3D centerPoint = mCameraPose.centerPoint() + mOrigin;
|
QgsVector3D centerPoint = mCameraPose.centerPoint() + mOrigin;
|
||||||
elemCamera.setAttribute( QStringLiteral( "xMap" ), centerPoint.x() );
|
elemCamera.setAttribute( QStringLiteral( "xMap" ), centerPoint.x() );
|
||||||
elemCamera.setAttribute( QStringLiteral( "yMap" ), centerPoint.z() );
|
elemCamera.setAttribute( QStringLiteral( "yMap" ), centerPoint.y() );
|
||||||
elemCamera.setAttribute( QStringLiteral( "elevMap" ), centerPoint.y() );
|
elemCamera.setAttribute( QStringLiteral( "zMap" ), centerPoint.z() );
|
||||||
elemCamera.setAttribute( QStringLiteral( "dist" ), mCameraPose.distanceFromCenterPoint() );
|
elemCamera.setAttribute( QStringLiteral( "dist" ), mCameraPose.distanceFromCenterPoint() );
|
||||||
elemCamera.setAttribute( QStringLiteral( "pitch" ), mCameraPose.pitchAngle() );
|
elemCamera.setAttribute( QStringLiteral( "pitch" ), mCameraPose.pitchAngle() );
|
||||||
elemCamera.setAttribute( QStringLiteral( "yaw" ), mCameraPose.headingAngle() );
|
elemCamera.setAttribute( QStringLiteral( "yaw" ), mCameraPose.headingAngle() );
|
||||||
@ -286,17 +286,17 @@ void QgsCameraController::readXml( const QDomElement &elem, QgsVector3D savedOri
|
|||||||
if ( elem.hasAttribute( "xMap" ) )
|
if ( elem.hasAttribute( "xMap" ) )
|
||||||
{
|
{
|
||||||
// Prefer newer point saved in map coordinates ...
|
// Prefer newer point saved in map coordinates ...
|
||||||
const float x = elem.attribute( QStringLiteral( "xMap" ) ).toFloat();
|
const double x = elem.attribute( QStringLiteral( "xMap" ) ).toDouble();
|
||||||
const float y = elem.attribute( QStringLiteral( "yMap" ) ).toFloat();
|
const double y = elem.attribute( QStringLiteral( "yMap" ) ).toDouble();
|
||||||
const float elev = elem.attribute( QStringLiteral( "elevMap" ) ).toFloat();
|
const double z = elem.attribute( QStringLiteral( "zMap" ) ).toDouble();
|
||||||
centerPoint = QgsVector3D( x, elev, y ) - mOrigin;
|
centerPoint = QgsVector3D( x, y, z ) - mOrigin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ... but allow use of older origin-relative coordinates.
|
// ... but allow use of older origin-relative coordinates.
|
||||||
const float x = elem.attribute( QStringLiteral( "x" ) ).toFloat();
|
const double x = elem.attribute( QStringLiteral( "x" ) ).toDouble();
|
||||||
const float y = elem.attribute( QStringLiteral( "y" ) ).toFloat();
|
const double y = elem.attribute( QStringLiteral( "y" ) ).toDouble();
|
||||||
const float elev = elem.attribute( QStringLiteral( "elev" ) ).toFloat();
|
const double elev = elem.attribute( QStringLiteral( "elev" ) ).toDouble();
|
||||||
centerPoint = QgsVector3D( x, elev, y ) - savedOrigin + mOrigin;
|
centerPoint = QgsVector3D( x, elev, y ) - savedOrigin + mOrigin;
|
||||||
}
|
}
|
||||||
setLookingAtPoint( centerPoint, dist, pitch, yaw );
|
setLookingAtPoint( centerPoint, dist, pitch, yaw );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user