QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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"
22
24
28
29QgsLightSource *QgsLightSource::createFromXml( const QDomElement &element, const QgsReadWriteContext &context )
30{
31 std::unique_ptr<QgsLightSource> res;
32 if ( element.nodeName() == QLatin1String( "point-light" ) )
33 {
34 res = std::make_unique<QgsPointLightSettings>();
35 }
36 else if ( element.nodeName() == QLatin1String( "directional-light" ) )
37 {
38 res = std::make_unique<QgsDirectionalLightSettings>();
39 }
40
41 if ( res )
42 res->readXml( element, context );
43
44 return res.release();
45}
virtual void resolveReferences(const QgsProject &project)
After reading from XML, resolve references to any layers that have been read as layer IDs.
virtual ~QgsLightSource()
static QgsLightSource * createFromXml(const QDomElement &element, const QgsReadWriteContext &context)
Creates a new light source from an XML element.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:107
The class is used as a container of context for various read/write operations on other objects.