QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsshadowsettings.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsshadowsettings.cpp
3  --------------------------------------
4  Date : September 2020
5  Copyright : (C) 2020 by Belgacem Nedjima
6  Email : gb uderscore nedjima at esi dot dz
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include "qgsshadowsettings.h"
17 
18 #include <QDomDocument>
19 
20 #include "qgsreadwritecontext.h"
21 #include "qgssymbollayerutils.h"
22 
23 void QgsShadowSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
24 {
25  Q_UNUSED( context );
26  mRenderShadows = element.attribute( QStringLiteral( "shadow-rendering-enabled" ), QStringLiteral( "0" ) ).toInt();
27  mSelectedDirectionalLight = element.attribute( QStringLiteral( "selected-directional-light" ), QStringLiteral( "-1" ) ).toInt();
28  mMaximumShadowRenderingDistance = element.attribute( QStringLiteral( "max-shadow-rendering-distance" ), QStringLiteral( "500" ) ).toInt();
29  mShadowBias = element.attribute( QStringLiteral( "shadow-bias" ), QStringLiteral( "0.00001" ) ).toFloat();
30  mShadowMapResolution = element.attribute( QStringLiteral( "shadow-map-resolution" ), QStringLiteral( "2048" ) ).toInt();
31 }
32 
33 void QgsShadowSettings::writeXml( QDomElement &element, const QgsReadWriteContext &context ) const
34 {
35  Q_UNUSED( context );
36  element.setAttribute( QStringLiteral( "shadow-rendering-enabled" ), mRenderShadows );
37  element.setAttribute( QStringLiteral( "selected-directional-light" ), mSelectedDirectionalLight );
38  element.setAttribute( QStringLiteral( "max-shadow-rendering-distance" ), mMaximumShadowRenderingDistance );
39  element.setAttribute( QStringLiteral( "shadow-bias" ), mShadowBias );
40  element.setAttribute( QStringLiteral( "shadow-map-resolution" ), mShadowMapResolution );
41 }
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
qgsreadwritecontext.h
qgssymbollayerutils.h
qgsshadowsettings.h
QgsShadowSettings::readXml
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
Definition: qgsshadowsettings.cpp:23
QgsShadowSettings::writeXml
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
Definition: qgsshadowsettings.cpp:33