18 #include <QDomDocument> 25 QDomElement elemLight = doc.createElement( QStringLiteral(
"point-light" ) );
26 elemLight.setAttribute( QStringLiteral(
"x" ), mPosition.
x() );
27 elemLight.setAttribute( QStringLiteral(
"y" ), mPosition.
y() );
28 elemLight.setAttribute( QStringLiteral(
"z" ), mPosition.
z() );
30 elemLight.setAttribute( QStringLiteral(
"intensity" ), mIntensity );
31 elemLight.setAttribute( QStringLiteral(
"attenuation-0" ), mConstantAttenuation );
32 elemLight.setAttribute( QStringLiteral(
"attenuation-1" ), mLinearAttenuation );
33 elemLight.setAttribute( QStringLiteral(
"attenuation-2" ), mQuadraticAttenuation );
39 mPosition.
set( elem.attribute( QStringLiteral(
"x" ) ).toDouble(),
40 elem.attribute( QStringLiteral(
"y" ) ).toDouble(),
41 elem.attribute( QStringLiteral(
"z" ) ).toDouble() );
43 mIntensity = elem.attribute( QStringLiteral(
"intensity" ) ).toFloat();
44 mConstantAttenuation = elem.attribute( QStringLiteral(
"attenuation-0" ) ).toDouble();
45 mLinearAttenuation = elem.attribute( QStringLiteral(
"attenuation-1" ) ).toDouble();
46 mQuadraticAttenuation = elem.attribute( QStringLiteral(
"attenuation-2" ) ).toDouble();
51 return mPosition == other.mPosition && mColor == other.mColor && mIntensity == other.mIntensity &&
52 mConstantAttenuation == other.mConstantAttenuation && mLinearAttenuation == other.mLinearAttenuation &&
53 mQuadraticAttenuation == other.mQuadraticAttenuation;
double y() const
Returns Y coordinate.
void set(double x, double y, double z)
Sets vector coordinates.
static QString encodeColor(const QColor &color)
3 Definition of a point light in a 3D map scene
double z() const
Returns Z coordinate.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element and returns it.
bool operator==(const QgsPointLightSettings &other)
double x() const
Returns X coordinate.
static QColor decodeColor(const QString &str)
void readXml(const QDomElement &elem)
Reads configuration from a DOM element previously written using writeXml()