QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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 
24  : mRenderShadows( other.mRenderShadows )
25  , mSelectedDirectionalLight( other.mSelectedDirectionalLight )
26  , mMaximumShadowRenderingDistance( other.mMaximumShadowRenderingDistance )
27  , mShadowBias( other.mShadowBias )
28  , mShadowMapResolution( other.mShadowMapResolution )
29 {
30 
31 }
32 
34 {
35  this->mRenderShadows = rhs.mRenderShadows;
36  this->mSelectedDirectionalLight = rhs.mSelectedDirectionalLight;
37  this->mMaximumShadowRenderingDistance = rhs.mMaximumShadowRenderingDistance;
38  this->mShadowBias = rhs.mShadowBias;
39  this->mShadowMapResolution = rhs.mShadowMapResolution;
40  return *this;
41 }
42 
43 void QgsShadowSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
44 {
45  Q_UNUSED( context );
46  mRenderShadows = element.attribute( QStringLiteral( "shadow-rendering-enabled" ), QStringLiteral( "0" ) ).toInt();
47  mSelectedDirectionalLight = element.attribute( QStringLiteral( "selected-directional-light" ), QStringLiteral( "-1" ) ).toInt();
48  mMaximumShadowRenderingDistance = element.attribute( QStringLiteral( "max-shadow-rendering-distance" ), QStringLiteral( "1500" ) ).toInt();
49  mShadowBias = element.attribute( QStringLiteral( "shadow-bias" ), QStringLiteral( "0.00001" ) ).toFloat();
50  mShadowMapResolution = element.attribute( QStringLiteral( "shadow-map-resolution" ), QStringLiteral( "2048" ) ).toInt();
51 }
52 
53 void QgsShadowSettings::writeXml( QDomElement &element, const QgsReadWriteContext &context ) const
54 {
55  Q_UNUSED( context );
56  element.setAttribute( QStringLiteral( "shadow-rendering-enabled" ), mRenderShadows );
57  element.setAttribute( QStringLiteral( "selected-directional-light" ), mSelectedDirectionalLight );
58  element.setAttribute( QStringLiteral( "max-shadow-rendering-distance" ), mMaximumShadowRenderingDistance );
59  element.setAttribute( QStringLiteral( "shadow-bias" ), mShadowBias );
60  element.setAttribute( QStringLiteral( "shadow-map-resolution" ), mShadowMapResolution );
61 }
The class is used as a container of context for various read/write operations on other objects.
class containing the configuration of shadows rendering 3
QgsShadowSettings & operator=(QgsShadowSettings const &rhs)
delete assignment operator
QgsShadowSettings()=default
Default constructor.
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.