29 QDomDocument doc = elem.ownerDocument();
32 QDomElement elemDataProperties = doc.createElement( QStringLiteral(
"data" ) );
34 elemDataProperties.setAttribute( QStringLiteral(
"height" ), mHeight );
35 elemDataProperties.setAttribute( QStringLiteral(
"add-back-faces" ), mAddBackFaces ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
36 elem.appendChild( elemDataProperties );
38 QDomElement elemMaterial = doc.createElement( QStringLiteral(
"material" ) );
40 elem.appendChild( elemMaterial );
43 QDomElement elemAdvancedSettings = doc.createElement( QStringLiteral(
"advanced-settings" ) );
44 elemAdvancedSettings.setAttribute( QStringLiteral(
"smoothed-triangle" ), mSmoothedTriangles ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
45 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-enabled" ), mWireframeEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
46 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-line-width" ), mWireframeLineWidth );
48 elemAdvancedSettings.setAttribute( QStringLiteral(
"verticale-scale" ), mVerticaleScale );
49 elemAdvancedSettings.setAttribute( QStringLiteral(
"texture-type" ), mRenderingStyle );
50 elemAdvancedSettings.appendChild( mColorRampShader.
writeXml( doc ) );
51 elemAdvancedSettings.setAttribute( QStringLiteral(
"min-color-ramp-shader" ), mColorRampShader.
minimumValue() );
52 elemAdvancedSettings.setAttribute( QStringLiteral(
"max-color-ramp-shader" ), mColorRampShader.
maximumValue() );
54 elem.appendChild( elemAdvancedSettings );
56 QDomElement elemDDP = doc.createElement( QStringLiteral(
"data-defined-properties" ) );
58 elem.appendChild( elemDDP );
66 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
68 mHeight = elemDataProperties.attribute( QStringLiteral(
"height" ) ).toFloat();
69 mAddBackFaces = elemDataProperties.attribute( QStringLiteral(
"add-back-faces" ) ).toInt();
71 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
72 mMaterial.
readXml( elemMaterial );
75 QDomElement elemAdvancedSettings = elem.firstChildElement( QStringLiteral(
"advanced-settings" ) );
76 mSmoothedTriangles = elemAdvancedSettings.attribute( QStringLiteral(
"smoothed-triangle" ) ).toInt();
77 mWireframeEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-enabled" ) ).toInt();
78 mWireframeLineWidth = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-line-width" ) ).toDouble();
80 mVerticaleScale = elemAdvancedSettings.attribute(
"verticale-scale" ).toDouble();
82 mColorRampShader.
readXml( elemAdvancedSettings.firstChildElement(
"colorrampshader" ) );
83 mColorRampShader.
setMinimumValue( elemAdvancedSettings.attribute( QStringLiteral(
"min-color-ramp-shader" ) ).toDouble() );
84 mColorRampShader.
setMaximumValue( elemAdvancedSettings.attribute( QStringLiteral(
"max-color-ramp-shader" ) ).toDouble() );
87 QDomElement elemDDP = elem.firstChildElement( QStringLiteral(
"data-defined-properties" ) );
88 if ( !elemDDP.isNull() )
94 return mSmoothedTriangles;
99 mSmoothedTriangles = smoothTriangles;
104 return mWireframeEnabled;
114 return mWireframeLineWidth;
124 return mWireframeLineColor;
134 return mVerticaleScale;
144 return mColorRampShader;
159 mSingleColor = color;
164 return mRenderingStyle;
169 mRenderingStyle = coloringType;
The class is used as a container of context for various read/write operations on other objects...
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
void setRenderingStyle(const QgsMesh3DSymbol::RenderingStyle &textureType)
Sets the rendering style.
static QString altClampingToString(Qgs3DTypes::AltitudeClamping altClamp)
Converts a value from AltitudeClamping enum to a string.
bool wireframeEnabled() const
Returns if the mesh wireframe.
QgsPropertyCollection mDataDefinedProperties
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
double verticaleScale() const
Returns mesh verticale scale.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
void setSingleMeshColor(const QColor &singleMeshColor)
Sets the single color.
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
void setSmoothedTriangles(bool smoothTriangles)
Sets if the mesh triangles have to been smoothed.
QgsMesh3DSymbol()=default
Constructor for QgsMesh3DSymbol.
static Qgs3DTypes::AltitudeClamping altClampingFromString(const QString &str)
Converts a string to a value from AltitudeClamping enum.
void setWireframeLineWidth(double wireframeLineWidth)
Sets wireframe line width.
double maximumValue() const
Returns the minimum value for the raster shader.
void setWireframeEnabled(bool wireframeEnabled)
Sets if the mesh wireframe.
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
double wireframeLineWidth() const
Returns wireframe line width.
static QString encodeColor(const QColor &color)
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
void setVerticaleScale(double verticaleScale)
Sets mesh verticale scale.
QColor singleMeshColor() const
Returns the single color.
void readXml(const QDomElement &elem)
Reads settings from a DOM element.
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
void setColorRampShader(const QgsColorRampShader &colorRampShader)
Sets the color ramp shader used to render the color.
double minimumValue() const
Returns the maximum value for the raster shader.
void setWireframeLineColor(const QColor &wireframeLineColor)
Sets wireframe line color.
QgsAbstract3DSymbol * clone() const override
Returns a new instance of the symbol with the same settings.
void writeXml(QDomElement &elem) const
Writes settings to a DOM element.
bool smoothedTriangles() const
Returns if mesh triangle are smoothed.
QColor wireframeLineColor() const
Returns wireframe line color.
QgsColorRampShader colorRampShader() const
Returns the color ramp shader used to render the color.
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes symbol configuration to the given DOM element.
RenderingStyle
How to render the color of the mesh with advanced symbology.
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads symbol configuration from the given DOM element.
static QColor decodeColor(const QString &str)
QgsMesh3DSymbol::RenderingStyle renderingStyle() const
Returns the rendering style.