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