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();