@@ -46,6 +46,7 @@ Qgs3DMapSettings::Qgs3DMapSettings( const Qgs3DMapSettings &other )
46
46
, mShowCameraViewCenter( other.mShowCameraViewCenter )
47
47
, mShowLabels( other.mShowLabels )
48
48
, mPointLights( other.mPointLights )
49
+ , mFieldOfView( other.mFieldOfView )
49
50
, mLayers( other.mLayers )
50
51
, mSkyboxEnabled( other.mSkyboxEnabled )
51
52
, mSkyboxFileBase( other.mSkyboxFileBase )
@@ -73,6 +74,12 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
73
74
elemOrigin.attribute ( QStringLiteral ( " y" ) ).toDouble (),
74
75
elemOrigin.attribute ( QStringLiteral ( " z" ) ).toDouble () );
75
76
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
+
76
83
QDomElement elemColor = elem.firstChildElement ( QStringLiteral ( " color" ) );
77
84
if ( !elemColor.isNull () )
78
85
{
@@ -196,6 +203,10 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
196
203
elemOrigin.setAttribute ( QStringLiteral ( " z" ), QString::number ( mOrigin .z () ) );
197
204
elem.appendChild ( elemOrigin );
198
205
206
+ QDomElement elemCamera = doc.createElement ( QStringLiteral ( " camera" ) );
207
+ elemCamera.setAttribute ( QStringLiteral ( " field-of-view" ), mFieldOfView );
208
+ elem.appendChild ( elemCamera );
209
+
199
210
QDomElement elemColor = doc.createElement ( QStringLiteral ( " color" ) );
200
211
elemColor.setAttribute ( QStringLiteral ( " background" ), QgsSymbolLayerUtils::encodeColor ( mBackgroundColor ) );
201
212
elemColor.setAttribute ( QStringLiteral ( " selection" ), QgsSymbolLayerUtils::encodeColor ( mSelectionColor ) );
@@ -501,3 +512,12 @@ void Qgs3DMapSettings::setPointLights( const QList<QgsPointLightSettings> &point
501
512
mPointLights = pointLights;
502
513
emit pointLightsChanged ();
503
514
}
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