QGIS API Documentation 3.99.0-Master (8e76e220402)
Loading...
Searching...
No Matches
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 "qgsreadwritecontext.h"
19#include "qgssymbollayerutils.h"
20
21#include <QDomDocument>
22#include <QString>
23
24using namespace Qt::StringLiterals;
25
27 : mRenderShadows( other.mRenderShadows )
28 , mSelectedDirectionalLight( other.mSelectedDirectionalLight )
29 , mMaximumShadowRenderingDistance( other.mMaximumShadowRenderingDistance )
30 , mShadowBias( other.mShadowBias )
31 , mShadowMapResolution( other.mShadowMapResolution )
32{
33}
34
36{
37 if ( &rhs == this )
38 return *this;
39
40 this->mRenderShadows = rhs.mRenderShadows;
41 this->mSelectedDirectionalLight = rhs.mSelectedDirectionalLight;
42 this->mMaximumShadowRenderingDistance = rhs.mMaximumShadowRenderingDistance;
43 this->mShadowBias = rhs.mShadowBias;
44 this->mShadowMapResolution = rhs.mShadowMapResolution;
45 return *this;
46}
47
48void QgsShadowSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
49{
50 Q_UNUSED( context );
51 mRenderShadows = element.attribute( u"shadow-rendering-enabled"_s, u"0"_s ).toInt();
52 mSelectedDirectionalLight = element.attribute( u"selected-directional-light"_s, u"-1"_s ).toInt();
53 mMaximumShadowRenderingDistance = element.attribute( u"max-shadow-rendering-distance"_s, u"1500"_s ).toInt();
54 mShadowBias = element.attribute( u"shadow-bias"_s, u"0.00001"_s ).toFloat();
55 mShadowMapResolution = element.attribute( u"shadow-map-resolution"_s, u"2048"_s ).toInt();
56}
57
58void QgsShadowSettings::writeXml( QDomElement &element, const QgsReadWriteContext &context ) const
59{
60 Q_UNUSED( context );
61 element.setAttribute( u"shadow-rendering-enabled"_s, mRenderShadows );
62 element.setAttribute( u"selected-directional-light"_s, mSelectedDirectionalLight );
63 element.setAttribute( u"max-shadow-rendering-distance"_s, mMaximumShadowRenderingDistance );
64 element.setAttribute( u"shadow-bias"_s, mShadowBias );
65 element.setAttribute( u"shadow-map-resolution"_s, mShadowMapResolution );
66}
A container for the context for various read/write operations on objects.
QgsShadowSettings & operator=(QgsShadowSettings const &rhs)
QgsShadowSettings()=default
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.