30 QDomDocument doc = elem.ownerDocument();
32 QDomElement elemDataProperties = doc.createElement( QStringLiteral(
"data" ) );
35 elemDataProperties.setAttribute( QStringLiteral(
"height" ), mHeight );
36 elemDataProperties.setAttribute( QStringLiteral(
"extrusion-height" ), mExtrusionHeight );
38 elemDataProperties.setAttribute( QStringLiteral(
"invert-normals" ), mInvertNormals ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
39 elemDataProperties.setAttribute( QStringLiteral(
"add-back-faces" ), mAddBackFaces ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
40 elem.appendChild( elemDataProperties );
42 QDomElement elemMaterial = doc.createElement( QStringLiteral(
"material" ) );
44 elem.appendChild( elemMaterial );
46 QDomElement elemDDP = doc.createElement( QStringLiteral(
"data-defined-properties" ) );
48 elem.appendChild( elemDDP );
50 QDomElement elemEdges = doc.createElement( QStringLiteral(
"edges" ) );
51 elemEdges.setAttribute( QStringLiteral(
"enabled" ), mEdgesEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
52 elemEdges.setAttribute( QStringLiteral(
"width" ), mEdgeWidth );
54 elem.appendChild( elemEdges );
61 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
64 mHeight = elemDataProperties.attribute( QStringLiteral(
"height" ) ).toFloat();
65 mExtrusionHeight = elemDataProperties.attribute( QStringLiteral(
"extrusion-height" ) ).toFloat();
67 mInvertNormals = elemDataProperties.attribute( QStringLiteral(
"invert-normals" ) ).toInt();
68 mAddBackFaces = elemDataProperties.attribute( QStringLiteral(
"add-back-faces" ) ).toInt();
70 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
71 mMaterial.
readXml( elemMaterial );
73 QDomElement elemDDP = elem.firstChildElement( QStringLiteral(
"data-defined-properties" ) );
74 if ( !elemDDP.isNull() )
77 QDomElement elemEdges = elem.firstChildElement( QStringLiteral(
"edges" ) );
78 if ( !elemEdges.isNull() )
80 mEdgesEnabled = elemEdges.attribute( QStringLiteral(
"enabled" ) ).toInt();
81 mEdgeWidth = elemEdges.attribute( QStringLiteral(
"width" ) ).toFloat();
The class is used as a container of context for various read/write operations on other objects...
static QString altClampingToString(Qgs3DTypes::AltitudeClamping altClamp)
Converts a value from AltitudeClamping enum to a string.
static Qgs3DTypes::CullingMode cullingModeFromString(const QString &str)
Converts a string to a value from CullingMode enum.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes symbol configuration to the given DOM element.
QgsPropertyCollection mDataDefinedProperties
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
QgsPolygon3DSymbol()=default
Constructor for QgsPolygon3DSymbol.
static Qgs3DTypes::AltitudeClamping altClampingFromString(const QString &str)
Converts a string to a value from AltitudeClamping enum.
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
static QString encodeColor(const QColor &color)
static QString cullingModeToString(Qgs3DTypes::CullingMode mode)
Converts a value from CullingMode enum to a string.
void readXml(const QDomElement &elem)
Reads settings from a DOM element.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads symbol configuration from the given DOM element.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
void writeXml(QDomElement &elem) const
Writes settings to a DOM element.
static Qgs3DTypes::AltitudeBinding altBindingFromString(const QString &str)
Converts a string to a value from AltitudeBinding enum.
QgsAbstract3DSymbol * clone() const override
Returns a new instance of the symbol with the same settings.
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
static QString altBindingToString(Qgs3DTypes::AltitudeBinding altBind)
Converts a value from AltitudeBinding enum to a string.
static QColor decodeColor(const QString &str)