QGIS API Documentation 3.99.0-Master (26c88405ac0)
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
24 : mRenderShadows( other.mRenderShadows )
25 , mSelectedDirectionalLight( other.mSelectedDirectionalLight )
26 , mMaximumShadowRenderingDistance( other.mMaximumShadowRenderingDistance )
27 , mShadowBias( other.mShadowBias )
28 , mShadowMapResolution( other.mShadowMapResolution )
29{
30}
31
33{
34 if ( &rhs == this )
35 return *this;
36
37 this->mRenderShadows = rhs.mRenderShadows;
38 this->mSelectedDirectionalLight = rhs.mSelectedDirectionalLight;
39 this->mMaximumShadowRenderingDistance = rhs.mMaximumShadowRenderingDistance;
40 this->mShadowBias = rhs.mShadowBias;
41 this->mShadowMapResolution = rhs.mShadowMapResolution;
42 return *this;
43}
44
45void QgsShadowSettings::readXml( const QDomElement &element, const QgsReadWriteContext &context )
46{
47 Q_UNUSED( context );
48 mRenderShadows = element.attribute( QStringLiteral( "shadow-rendering-enabled" ), QStringLiteral( "0" ) ).toInt();
49 mSelectedDirectionalLight = element.attribute( QStringLiteral( "selected-directional-light" ), QStringLiteral( "-1" ) ).toInt();
50 mMaximumShadowRenderingDistance = element.attribute( QStringLiteral( "max-shadow-rendering-distance" ), QStringLiteral( "1500" ) ).toInt();
51 mShadowBias = element.attribute( QStringLiteral( "shadow-bias" ), QStringLiteral( "0.00001" ) ).toFloat();
52 mShadowMapResolution = element.attribute( QStringLiteral( "shadow-map-resolution" ), QStringLiteral( "2048" ) ).toInt();
53}
54
55void QgsShadowSettings::writeXml( QDomElement &element, const QgsReadWriteContext &context ) const
56{
57 Q_UNUSED( context );
58 element.setAttribute( QStringLiteral( "shadow-rendering-enabled" ), mRenderShadows );
59 element.setAttribute( QStringLiteral( "selected-directional-light" ), mSelectedDirectionalLight );
60 element.setAttribute( QStringLiteral( "max-shadow-rendering-distance" ), mMaximumShadowRenderingDistance );
61 element.setAttribute( QStringLiteral( "shadow-bias" ), mShadowBias );
62 element.setAttribute( QStringLiteral( "shadow-map-resolution" ), mShadowMapResolution );
63}
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.