QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
3d
lights
qgslightsource.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslightsource.cpp
3
-----------------
4
begin : April 2022
5
copyright : (C) 2022 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
10
/***************************************************************************
11
* *
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
16
* *
17
***************************************************************************/
18
19
#include "
qgslightsource.h
"
20
21
#include "
qgsdirectionallightsettings.h
"
22
#include "
qgspointlightsettings.h
"
23
#include "
qgssunlightsettings.h
"
24
25
#include <QString>
26
#include <QUuid>
27
28
using namespace
Qt::StringLiterals;
29
30
QgsLightSource::QgsLightSource
()
31
:
mId
( QUuid::createUuid().toString( QUuid::StringFormat::WithoutBraces ) )
32
{}
33
34
QgsLightSource::~QgsLightSource
() =
default
;
35
36
void
QgsLightSource::resolveReferences
(
const
QgsProject
& )
37
{}
38
39
QgsLightSource
*
QgsLightSource::createFromXml
(
const
QDomElement &element,
const
QgsReadWriteContext
&context )
40
{
41
std::unique_ptr<QgsLightSource> res;
42
if
( element.nodeName() ==
"point-light"
_L1 )
43
{
44
res = std::make_unique<QgsPointLightSettings>();
45
}
46
else
if
( element.nodeName() ==
"directional-light"
_L1 )
47
{
48
res = std::make_unique<QgsDirectionalLightSettings>();
49
}
50
else
if
( element.nodeName() ==
"sun-light"
_L1 )
51
{
52
res = std::make_unique<QgsSunLightSettings>();
53
}
54
55
if
( res )
56
res->readXml( element, context );
57
58
return
res.release();
59
}
QgsLightSource::mId
QString mId
Unique light ID.
Definition
qgslightsource.h:101
QgsLightSource::resolveReferences
virtual void resolveReferences(const QgsProject &project)
After reading from XML, resolve references to any layers that have been read as layer IDs.
Definition
qgslightsource.cpp:36
QgsLightSource::QgsLightSource
QgsLightSource()
Definition
qgslightsource.cpp:30
QgsLightSource::~QgsLightSource
virtual ~QgsLightSource()
QgsLightSource::createFromXml
static QgsLightSource * createFromXml(const QDomElement &element, const QgsReadWriteContext &context)
Creates a new light source from an XML element.
Definition
qgslightsource.cpp:39
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition
qgsproject.h:114
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgsdirectionallightsettings.h
qgslightsource.h
qgspointlightsettings.h
qgssunlightsettings.h
Generated on
for QGIS API Documentation by
1.17.0