QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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(
"renderer-3d-enabled" ), mEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
45 elemAdvancedSettings.setAttribute( QStringLiteral(
"smoothed-triangle" ), mSmoothedTriangles ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
46 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-enabled" ), mWireframeEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
47 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-line-width" ), mWireframeLineWidth );
49 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-scale" ), mVerticalScale );
50 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-group-index" ), mVerticalDatasetGroupIndex );
51 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-relative" ), mIsVerticalMagnitudeRelative ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
52 elemAdvancedSettings.setAttribute( QStringLiteral(
"texture-type" ), mRenderingStyle );
53 elemAdvancedSettings.appendChild( mColorRampShader.
writeXml( doc ) );
54 elemAdvancedSettings.setAttribute( QStringLiteral(
"min-color-ramp-shader" ), mColorRampShader.
minimumValue() );
55 elemAdvancedSettings.setAttribute( QStringLiteral(
"max-color-ramp-shader" ), mColorRampShader.
maximumValue() );
57 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-enabled" ), mArrowsEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
58 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-spacing" ), mArrowsSpacing );
59 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-fixed-size" ), mArrowsFixedSize ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
60 elem.appendChild( elemAdvancedSettings );
62 QDomElement elemDDP = doc.createElement( QStringLiteral(
"data-defined-properties" ) );
64 elem.appendChild( elemDDP );
72 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
74 mHeight = elemDataProperties.attribute( QStringLiteral(
"height" ) ).toFloat();
75 mAddBackFaces = elemDataProperties.attribute( QStringLiteral(
"add-back-faces" ) ).toInt();
77 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
78 mMaterial.
readXml( elemMaterial );
81 QDomElement elemAdvancedSettings = elem.firstChildElement( QStringLiteral(
"advanced-settings" ) );
82 mEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"renderer-3d-enabled" ) ).toInt();
83 mSmoothedTriangles = elemAdvancedSettings.attribute( QStringLiteral(
"smoothed-triangle" ) ).toInt();
84 mWireframeEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-enabled" ) ).toInt();
85 mWireframeLineWidth = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-line-width" ) ).toDouble();
87 mVerticalScale = elemAdvancedSettings.attribute(
"vertical-scale" ).toDouble();
88 mVerticalDatasetGroupIndex = elemAdvancedSettings.attribute(
"vertical-group-index" ).toInt();
89 mIsVerticalMagnitudeRelative = elemAdvancedSettings.attribute(
"vertical-relative" ).toInt();
91 mColorRampShader.
readXml( elemAdvancedSettings.firstChildElement(
"colorrampshader" ) );
92 mColorRampShader.
setMinimumValue( elemAdvancedSettings.attribute( QStringLiteral(
"min-color-ramp-shader" ) ).toDouble() );
93 mColorRampShader.
setMaximumValue( elemAdvancedSettings.attribute( QStringLiteral(
"max-color-ramp-shader" ) ).toDouble() );
95 mArrowsEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-enabled" ) ).toInt();
96 if ( elemAdvancedSettings.hasAttribute( QStringLiteral(
"arrows-spacing" ) ) )
97 mArrowsSpacing = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-spacing" ) ).toDouble();
98 mArrowsFixedSize = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-fixed-size" ) ).toInt();
99 QDomElement elemDDP = elem.firstChildElement( QStringLiteral(
"data-defined-properties" ) );
100 if ( !elemDDP.isNull() )
106 return mSmoothedTriangles;
111 mSmoothedTriangles = smoothTriangles;
116 return mWireframeEnabled;
126 return mWireframeLineWidth;
136 return mWireframeLineColor;
146 return mVerticalScale;
156 return mColorRampShader;
171 mSingleColor = color;
176 return mRenderingStyle;
181 mRenderingStyle = coloringType;
186 return mVerticalDatasetGroupIndex;
196 return mIsVerticalMagnitudeRelative;
201 mIsVerticalMagnitudeRelative = isVerticalScaleIsRelative;
206 return mArrowsEnabled;
211 mArrowsEnabled = vectorEnabled;
216 return mArrowsSpacing;
226 return mMaximumTextureSize;
236 return mArrowsFixedSize;
241 mArrowsFixedSize = arrowsFixeSize;
void setArrowsEnabled(bool arrowsEnabled)
Sets if arrows are enabled for 3D rendering.
static QString encodeColor(const QColor &color)
bool smoothedTriangles() const
Returns if mesh triangle are smoothed.
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads symbol configuration from the given DOM element.
void setWireframeLineWidth(double wireframeLineWidth)
Sets wireframe line width.
int verticalDatasetGroupIndex() const
Returns the index of the dataset group that will be used to render the vertical component of the 3D m...
QDomElement writeXml(QDomDocument &doc) const
Writes configuration to a new DOM element.
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
void setEnabled(bool enabled)
Sets if the 3d rendering is enabled.
double maximumValue() const
Returns the minimum value for the raster shader.
void setVerticalDatasetGroupIndex(int verticalDatasetGroupIndex)
Sets the index of the dataset group that will be used to render the vertical component of the 3D mesh...
void setRenderingStyle(const QgsMesh3DSymbol::RenderingStyle &textureType)
Sets the rendering style.
bool arrowsFixedSize() const
Returns if the arrow size is fixed.
QgsAbstract3DSymbol * clone() const override
Returns a new instance of the symbol with the same settings.
static QColor decodeColor(const QString &str)
bool isVerticalMagnitudeRelative() const
Returns if the vertical component of the mesh is relative to the mesh vertices Z value.
void setArrowsSpacing(double arrowsSpacing)
Sets the arrow spacing.
void setColorRampShader(const QgsColorRampShader &colorRampShader)
Sets the color ramp shader used to render the color.
void setSingleMeshColor(const QColor &singleMeshColor)
Sets the single color.
QgsMesh3DSymbol::RenderingStyle renderingStyle() const
Returns the rendering style.
void setWireframeLineColor(const QColor &wireframeLineColor)
Sets wireframe line color.
QgsMesh3DSymbol()=default
Constructor for QgsMesh3DSymbol.
QColor wireframeLineColor() const
Returns wireframe line color.
QgsColorRampShader colorRampShader() const
Returns the color ramp shader used to render the color.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
void setVerticalScale(double verticalScale)
Sets mesh vertical scale.
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
void setIsVerticalMagnitudeRelative(bool isVerticalMagnitudeRelative)
Sets if the vertical component of the mesh is relative to the mesh vertices Z value.
QgsPropertyCollection mDataDefinedProperties
void readXml(const QDomElement &elem)
Reads configuration from the given DOM element.
static QString altClampingToString(Qgs3DTypes::AltitudeClamping altClamp)
Converts a value from AltitudeClamping enum to a string.
void readXml(const QDomElement &elem)
Reads settings from a DOM element.
double minimumValue() const
Returns the maximum value for the raster shader.
static Qgs3DTypes::AltitudeClamping altClampingFromString(const QString &str)
Converts a string to a value from AltitudeClamping enum.
void setArrowsFixedSize(bool arrowsFixedSize)
Sets if the arrow size is fixed.
bool arrowsEnabled() const
Returns if arrows are enabled for 3D rendering.
RenderingStyle
How to render the color of the mesh.
void setSmoothedTriangles(bool smoothTriangles)
Sets if the mesh triangles have to been smoothed.
void setMaximumTextureSize(int maximumTextureSize)
Sets the maximum texture size supported by the hardware Used to store the GL_MAX_TEXTURE_SIZE value t...
bool wireframeEnabled() const
Returns if the mesh wireframe.
double verticalScale() const
Returns mesh vertical scale.
double arrowsSpacing() const
Returns the arrow spacing.
void writeXml(QDomElement &elem) const
Writes settings to a DOM element.
void setWireframeEnabled(bool wireframeEnabled)
Sets if the mesh wireframe.
bool isEnabled() const
Returns if the 3d rendering is enabled.
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
double wireframeLineWidth() const
Returns wireframe line width.
QColor singleMeshColor() const
Returns the single color.
int maximumTextureSize() const
Returns the maximum texture size supported by the hardware Used to store the GL_MAX_TEXTURE_SIZE valu...
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes symbol configuration to the given DOM element.