QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
3d
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
24
using namespace
Qt::StringLiterals;
25
26
QgsShadowSettings::QgsShadowSettings
(
const
QgsShadowSettings
&other )
27
: mRenderShadows( other.mRenderShadows )
28
, mLightSourceId( other.mLightSourceId )
29
, mMaximumShadowRenderingDistance( other.mMaximumShadowRenderingDistance )
30
, mShadowBias( other.mShadowBias )
31
, mShadowQuality( other.mShadowQuality )
32
, mShowCascadeSplits( other.mShowCascadeSplits )
33
{}
34
35
QgsShadowSettings
&
QgsShadowSettings::operator=
(
QgsShadowSettings
const
&rhs )
36
{
37
if
( &rhs ==
this
)
38
return
*
this
;
39
40
this->mRenderShadows = rhs.mRenderShadows;
41
this->mLightSourceId = rhs.mLightSourceId;
42
this->mMaximumShadowRenderingDistance = rhs.mMaximumShadowRenderingDistance;
43
this->mShadowBias = rhs.mShadowBias;
44
this->mShadowQuality = rhs.mShadowQuality;
45
this->mShowCascadeSplits = rhs.mShowCascadeSplits;
46
return
*
this
;
47
}
48
49
void
QgsShadowSettings::readXml
(
const
QDomElement &element,
const
QgsReadWriteContext
&context )
50
{
51
Q_UNUSED( context );
52
mRenderShadows = element.attribute( u
"shadow-rendering-enabled"
_s, u
"0"
_s ).toInt();
53
mLightSourceId = element.attribute( u
"light-source"
_s );
54
mMaximumShadowRenderingDistance = element.attribute( u
"max-shadow-rendering-distance"
_s, u
"1500"
_s ).toInt();
55
mShadowBias = element.attribute( u
"shadow-bias"
_s, u
"0.00001"
_s ).toFloat();
56
}
57
58
void
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
"light-source"
_s, mLightSourceId );
63
element.setAttribute( u
"max-shadow-rendering-distance"
_s, mMaximumShadowRenderingDistance );
64
element.setAttribute( u
"shadow-bias"
_s, mShadowBias );
65
}
66
67
int
QgsShadowSettings::qualityToMapResolution
(
Qgis::ShadowQuality
quality )
68
{
69
switch
( quality )
70
{
71
case
Qgis::ShadowQuality::Low
:
72
return
512;
73
case
Qgis::ShadowQuality::Medium
:
74
return
1024;
75
case
Qgis::ShadowQuality::High
:
76
return
2048;
77
case
Qgis::ShadowQuality::VeryHigh
:
78
return
4096;
79
case
Qgis::ShadowQuality::Extreme
:
80
return
8192;
81
}
82
BUILTIN_UNREACHABLE
83
}
84
85
bool
QgsShadowSettings::showCascadeSplits
()
const
86
{
87
return
mShowCascadeSplits;
88
}
89
90
void
QgsShadowSettings::setShowCascadeSplits
(
bool
newShowCascadeSplits )
91
{
92
mShowCascadeSplits = newShowCascadeSplits;
93
}
Qgis::ShadowQuality
ShadowQuality
Shadow texture quality.
Definition
qgis.h:4524
Qgis::ShadowQuality::Low
@ Low
Low quality.
Definition
qgis.h:4525
Qgis::ShadowQuality::High
@ High
High quality.
Definition
qgis.h:4527
Qgis::ShadowQuality::Medium
@ Medium
Medium quality.
Definition
qgis.h:4526
Qgis::ShadowQuality::Extreme
@ Extreme
Extremely high quality.
Definition
qgis.h:4529
Qgis::ShadowQuality::VeryHigh
@ VeryHigh
Very high quality.
Definition
qgis.h:4528
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
QgsShadowSettings::operator=
QgsShadowSettings & operator=(QgsShadowSettings const &rhs)
Definition
qgsshadowsettings.cpp:35
QgsShadowSettings::QgsShadowSettings
QgsShadowSettings()=default
QgsShadowSettings::qualityToMapResolution
static int qualityToMapResolution(Qgis::ShadowQuality quality)
Returns the shadow map resolution corresponding to the specified shadow quality.
Definition
qgsshadowsettings.cpp:67
QgsShadowSettings::setShowCascadeSplits
void setShowCascadeSplits(bool show)
Sets whether the cascading shadow splits should be tinted in the view.
Definition
qgsshadowsettings.cpp:90
QgsShadowSettings::writeXml
void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes settings to a DOM element.
Definition
qgsshadowsettings.cpp:58
QgsShadowSettings::readXml
void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads settings from a DOM element.
Definition
qgsshadowsettings.cpp:49
QgsShadowSettings::showCascadeSplits
bool showCascadeSplits() const
Returns true if the cascading shadow splits should be tinted in the view.
Definition
qgsshadowsettings.cpp:85
BUILTIN_UNREACHABLE
#define BUILTIN_UNREACHABLE
Definition
qgis.h:8443
qgsreadwritecontext.h
qgsshadowsettings.h
qgssymbollayerutils.h
Generated on
for QGIS API Documentation by
1.17.0