QGIS API Documentation 4.1.0-Master (ca2ac17535b)
Loading...
Searching...
No Matches
qgssunlightsettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssunlightsettings.h
3 --------------------------------------
4 Date : April 2026
5 Copyright : (C) 2026 by Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
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#ifndef QGSSUNLIGHTSETTINGS_H
17#define QGSSUNLIGHTSETTINGS_H
18
19#include "qgis_3d.h"
20#include "qgslightsource.h"
21#include "qgsvector3d.h"
22
23#include <QColor>
24
25class QDomDocument;
26class QDomElement;
27
36class _3D_EXPORT QgsSunLightSettings : public QgsLightSource
37{
38 public:
40
41 Qgis::LightSourceType type() const override;
42 QgsSunLightSettings *clone() const override SIP_FACTORY;
43 Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map, Qt3DCore::QEntity *parent ) const override SIP_SKIP;
44 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context = QgsReadWriteContext() ) const override;
45 void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() ) override;
46
48 QgsVector3D direction( const Qgs3DMapSettings &map ) const;
49
55 QDateTime sunTime() const { return mSunTime; }
56
62 void setSunTime( const QDateTime &time ) { mSunTime = time; }
63
69 QColor color() const { return mColor; }
70
76 void setColor( const QColor &color ) { mColor = color; }
77
83 double intensity() const { return mIntensity; }
84
90 void setIntensity( double intensity ) { mIntensity = intensity; }
91
97 double atmosphericPressure() const { return mAtmosphericPressure; }
98
104 void setAtmosphericPressure( double pressure ) { mAtmosphericPressure = pressure; }
105
111 double temperature() const { return mTemperature; }
112
118 void setTemperature( double temperature ) { mTemperature = temperature; }
119
125 double referenceElevation() const { return mReferenceElevation; }
126
132 void setReferenceElevation( double elevation ) { mReferenceElevation = elevation; }
133
134 bool operator==( const QgsSunLightSettings &other ) const;
135
136 private:
137 QDateTime mSunTime = QDateTime::currentDateTimeUtc();
138
139 QColor mColor = Qt::white;
140 double mIntensity = 1.0;
141
142 double mAtmosphericPressure = 1013.25;
143 double mTemperature = 15.0;
144
145 double mReferenceElevation = 0.0;
146};
147
148#endif // QGSSUNLIGHTSETTINGS_H
LightSourceType
Light source types for 3D scenes.
Definition qgis.h:4404
Definition of the world.
virtual Qgis::LightSourceType type() const =0
Returns the light source type.
virtual QgsLightSource * clone() const =0
Returns a copy of the light source.
A container for the context for various read/write operations on objects.
Definition of a sun light in a 3D map scene.
double referenceElevation() const
Returns the reference elevation (in meters above sea level) used for the solar position calculation.
void setColor(const QColor &color)
Sets the base color of the sunlight.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context=QgsReadWriteContext()) const override
Writes the light source's configuration to a new DOM element and returns it.
double intensity() const
Returns the base intensity of the sunlight.
QDateTime sunTime() const
Returns the configured date and time for the sun position calculation.
double atmosphericPressure() const
Returns the atmospheric pressure (in millibars/hPa) used for the solar refraction calculation.
void setIntensity(double intensity)
Sets the base intensity of the sunlight.
void setReferenceElevation(double elevation)
Sets the reference elevation (in meters above sea level) for the solar position calculation.
QgsSunLightSettings()=default
void setSunTime(const QDateTime &time)
Sets the date and time for the sun position calculation.
QColor color() const
Returns the base color of the sunlight.
void setTemperature(double temperature)
Sets the ambient temperature (in Celsius) for the solar refraction calculation.
void setAtmosphericPressure(double pressure)
Sets the atmospheric pressure (in millibars/hPa) for the solar refraction calculation.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context=QgsReadWriteContext()) override
Reads configuration from a DOM element previously written using writeXml().
QgsVector3D direction(const Qgs3DMapSettings &map) const
Returns the calculated direction of the light.
Qt3DCore::QEntity * createEntity(const Qgs3DMapSettings &map, Qt3DCore::QEntity *parent) const override
Creates an entity representing the light source.
double temperature() const
Returns the ambient temperature (in Celsius) used for the solar refraction calculation.
A 3D vector (similar to QVector3D) with the difference that it uses double precision instead of singl...
Definition qgsvector3d.h:33
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_FACTORY
Definition qgis_sip.h:83
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)