@@ -46,6 +46,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
4646 , mShowCameraViewCenter( other.mShowCameraViewCenter )
4747 , mShowLabels( other.mShowLabels )
4848 , mPointLights( other.mPointLights )
49+ , mFieldOfView( other.mFieldOfView )
4950 , mLayers( other.mLayers )
5051 , mSkyboxEnabled( other.mSkyboxEnabled )
5152 , mSkyboxFileBase( other.mSkyboxFileBase )
@@ -73,6 +74,12 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
7374 elemOrigin.attribute ( QStringLiteral ( " y" ) ).toDouble (),
7475 elemOrigin.attribute ( QStringLiteral ( " z" ) ).toDouble () );
7576
77+ QDomElement elemCamera = elem.firstChildElement ( QStringLiteral ( " camera" ) );
78+ if ( !elemCamera.isNull () )
79+ {
80+ mFieldOfView = elemCamera.attribute ( QStringLiteral ( " field-of-view" ), QStringLiteral ( " 45" ) ).toFloat ();
81+ }
82+
7683 QDomElement elemColor = elem.firstChildElement ( QStringLiteral ( " color" ) );
7784 if ( !elemColor.isNull () )
7885 {
@@ -196,6 +203,10 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
196203 elemOrigin.setAttribute ( QStringLiteral ( " z" ), QString::number ( mOrigin .z () ) );
197204 elem.appendChild ( elemOrigin );
198205
206+ QDomElement elemCamera = doc.createElement ( QStringLiteral ( " camera" ) );
207+ elemCamera.setAttribute ( QStringLiteral ( " field-of-view" ), mFieldOfView );
208+ elem.appendChild ( elemCamera );
209+
199210 QDomElement elemColor = doc.createElement ( QStringLiteral ( " color" ) );
200211 elemColor.setAttribute ( QStringLiteral ( " background" ), QgsSymbolLayerUtils::encodeColor ( mBackgroundColor ) );
201212 elemColor.setAttribute ( QStringLiteral ( " selection" ), QgsSymbolLayerUtils::encodeColor ( mSelectionColor ) );
@@ -501,3 +512,12 @@ void Qgs3DMapSettings::setPointLights( const QList<QgsPointLightSettings> &point
501512 mPointLights = pointLights;
502513 emit pointLightsChanged ();
503514}
515+
516+ void Qgs3DMapSettings::setFieldOfView ( const float fieldOfView )
517+ {
518+ if ( mFieldOfView == fieldOfView )
519+ return ;
520+
521+ mFieldOfView = fieldOfView;
522+ emit fieldOfViewChanged ();
523+ }
0 commit comments