31 std::unique_ptr< QgsMesh3DSymbol > result = qgis::make_unique< QgsMesh3DSymbol >();
33 result->mAltClamping = mAltClamping;
34 result->mHeight = mHeight;
35 result->mMaterial.reset( mMaterial->clone() );
36 result->mAddBackFaces = mAddBackFaces;
37 result->mEnabled = mEnabled;
38 result->mSmoothedTriangles = mSmoothedTriangles;
39 result->mWireframeEnabled = mWireframeEnabled;
40 result->mWireframeLineWidth = mWireframeLineWidth;
41 result->mWireframeLineColor = mWireframeLineColor;
42 result->mVerticalScale = mVerticalScale;
43 result->mVerticalDatasetGroupIndex = mVerticalDatasetGroupIndex;
44 result->mIsVerticalMagnitudeRelative = mIsVerticalMagnitudeRelative;
45 result->mRenderingStyle = mRenderingStyle;
46 result->mColorRampShader = mColorRampShader;
47 result->mSingleColor = mSingleColor;
48 result->mArrowsEnabled = mArrowsEnabled;
49 result->mArrowsSpacing = mArrowsSpacing;
50 result->mArrowsFixedSize = mArrowsFixedSize;
51 result->mArrowsColor = mArrowsColor;
52 result->mMaximumTextureSize = mMaximumTextureSize;
54 return result.release();
61 QDomDocument doc = elem.ownerDocument();
64 QDomElement elemDataProperties = doc.createElement( QStringLiteral(
"data" ) );
66 elemDataProperties.setAttribute( QStringLiteral(
"height" ), mHeight );
67 elemDataProperties.setAttribute( QStringLiteral(
"add-back-faces" ), mAddBackFaces ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
68 elem.appendChild( elemDataProperties );
70 QDomElement elemMaterial = doc.createElement( QStringLiteral(
"material" ) );
71 mMaterial->writeXml( elemMaterial, context );
72 elem.appendChild( elemMaterial );
75 QDomElement elemAdvancedSettings = doc.createElement( QStringLiteral(
"advanced-settings" ) );
76 elemAdvancedSettings.setAttribute( QStringLiteral(
"renderer-3d-enabled" ), mEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
77 elemAdvancedSettings.setAttribute( QStringLiteral(
"smoothed-triangle" ), mSmoothedTriangles ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
78 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-enabled" ), mWireframeEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
79 elemAdvancedSettings.setAttribute( QStringLiteral(
"wireframe-line-width" ), mWireframeLineWidth );
81 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-scale" ), mVerticalScale );
82 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-group-index" ), mVerticalDatasetGroupIndex );
83 elemAdvancedSettings.setAttribute( QStringLiteral(
"vertical-relative" ), mIsVerticalMagnitudeRelative ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
84 elemAdvancedSettings.setAttribute( QStringLiteral(
"texture-type" ), mRenderingStyle );
85 elemAdvancedSettings.appendChild( mColorRampShader.
writeXml( doc ) );
86 elemAdvancedSettings.setAttribute( QStringLiteral(
"min-color-ramp-shader" ), mColorRampShader.
minimumValue() );
87 elemAdvancedSettings.setAttribute( QStringLiteral(
"max-color-ramp-shader" ), mColorRampShader.
maximumValue() );
89 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-enabled" ), mArrowsEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
90 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-spacing" ), mArrowsSpacing );
91 elemAdvancedSettings.setAttribute( QStringLiteral(
"arrows-fixed-size" ), mArrowsFixedSize ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
92 elem.appendChild( elemAdvancedSettings );
94 QDomElement elemDDP = doc.createElement( QStringLiteral(
"data-defined-properties" ) );
96 elem.appendChild( elemDDP );
104 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
106 mHeight = elemDataProperties.attribute( QStringLiteral(
"height" ) ).toFloat();
107 mAddBackFaces = elemDataProperties.attribute( QStringLiteral(
"add-back-faces" ) ).toInt();
109 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
110 mMaterial->readXml( elemMaterial, context );
113 QDomElement elemAdvancedSettings = elem.firstChildElement( QStringLiteral(
"advanced-settings" ) );
114 mEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"renderer-3d-enabled" ) ).toInt();
115 mSmoothedTriangles = elemAdvancedSettings.attribute( QStringLiteral(
"smoothed-triangle" ) ).toInt();
116 mWireframeEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-enabled" ) ).toInt();
117 mWireframeLineWidth = elemAdvancedSettings.attribute( QStringLiteral(
"wireframe-line-width" ) ).toDouble();
119 mVerticalScale = elemAdvancedSettings.attribute(
"vertical-scale" ).toDouble();
120 mVerticalDatasetGroupIndex = elemAdvancedSettings.attribute(
"vertical-group-index" ).toInt();
121 mIsVerticalMagnitudeRelative = elemAdvancedSettings.attribute(
"vertical-relative" ).toInt();
123 mColorRampShader.
readXml( elemAdvancedSettings.firstChildElement(
"colorrampshader" ) );
124 mColorRampShader.
setMinimumValue( elemAdvancedSettings.attribute( QStringLiteral(
"min-color-ramp-shader" ) ).toDouble() );
125 mColorRampShader.
setMaximumValue( elemAdvancedSettings.attribute( QStringLiteral(
"max-color-ramp-shader" ) ).toDouble() );
127 mArrowsEnabled = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-enabled" ) ).toInt();
128 if ( elemAdvancedSettings.hasAttribute( QStringLiteral(
"arrows-spacing" ) ) )
129 mArrowsSpacing = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-spacing" ) ).toDouble();
130 mArrowsFixedSize = elemAdvancedSettings.attribute( QStringLiteral(
"arrows-fixed-size" ) ).toInt();
131 QDomElement elemDDP = elem.firstChildElement( QStringLiteral(
"data-defined-properties" ) );
132 if ( !elemDDP.isNull() )
138 return mSmoothedTriangles;
143 mSmoothedTriangles = smoothTriangles;
148 return mWireframeEnabled;
158 return mWireframeLineWidth;
168 return mWireframeLineColor;
178 return mVerticalScale;
188 return mColorRampShader;
203 mSingleColor = color;
208 return mRenderingStyle;
213 mRenderingStyle = coloringType;
218 return mVerticalDatasetGroupIndex;
228 return mIsVerticalMagnitudeRelative;
233 mIsVerticalMagnitudeRelative = isVerticalScaleIsRelative;
238 return mArrowsEnabled;
243 mArrowsEnabled = vectorEnabled;
248 return mArrowsSpacing;
258 return mMaximumTextureSize;
268 return mArrowsFixedSize;
273 mArrowsFixedSize = arrowsFixeSize;
289 return mMaterial.get();