35 mAltClamping( other.altitudeClamping() )
36 , mMaterial( other.material() )
37 , mShape( other.shape() )
38 , mShapeProperties( other.shapeProperties() )
39 , mTransform( other.transform() )
40 , mBillboardSymbol( other.billboardSymbol() ? other.billboardSymbol()->clone() : nullptr )
47 QDomDocument doc = elem.ownerDocument();
49 QDomElement elemDataProperties = doc.createElement( QStringLiteral(
"data" ) );
51 elem.appendChild( elemDataProperties );
53 QDomElement elemMaterial = doc.createElement( QStringLiteral(
"material" ) );
55 elem.appendChild( elemMaterial );
57 elem.setAttribute( QStringLiteral(
"shape" ),
shapeToString( mShape ) );
59 QVariantMap shapePropertiesCopy( mShapeProperties );
60 shapePropertiesCopy[QStringLiteral(
"model" )] = QVariant( context.
pathResolver().
writePath( shapePropertiesCopy[QStringLiteral(
"model" )].toString() ) );
62 QDomElement elemShapeProperties = doc.createElement( QStringLiteral(
"shape-properties" ) );
64 elem.appendChild( elemShapeProperties );
66 QDomElement elemTransform = doc.createElement( QStringLiteral(
"transform" ) );
68 elem.appendChild( elemTransform );
74 elem.appendChild( symbolElem );
80 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
83 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
84 mMaterial.
readXml( elemMaterial );
86 mShape =
shapeFromString( elem.attribute( QStringLiteral(
"shape" ) ) );
88 QDomElement elemShapeProperties = elem.firstChildElement( QStringLiteral(
"shape-properties" ) );
90 mShapeProperties[QStringLiteral(
"model" )] = QVariant( context.
pathResolver().
readPath( mShapeProperties[QStringLiteral(
"model" )].toString() ) );
92 QDomElement elemTransform = elem.firstChildElement( QStringLiteral(
"transform" ) );
95 QDomElement symbolElem = elem.firstChildElement( QStringLiteral(
"symbol" ) );
97 setBillboardSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
102 if (
shape == QStringLiteral(
"sphere" ) )
104 else if (
shape == QStringLiteral(
"cone" ) )
106 else if (
shape == QStringLiteral(
"cube" ) )
108 else if (
shape == QStringLiteral(
"torus" ) )
110 else if (
shape == QStringLiteral(
"plane" ) )
112 else if (
shape == QStringLiteral(
"extruded-text" ) )
114 else if (
shape == QStringLiteral(
"model" ) )
116 else if (
shape == QStringLiteral(
"billboard" ) )
126 case Cylinder:
return QStringLiteral(
"cylinder" );
127 case Sphere:
return QStringLiteral(
"sphere" );
128 case Cone:
return QStringLiteral(
"cone" );
129 case Cube:
return QStringLiteral(
"cube" );
130 case Torus:
return QStringLiteral(
"torus" );
131 case Plane:
return QStringLiteral(
"plane" );
132 case ExtrudedText:
return QStringLiteral(
"extruded-text" );
133 case Model:
return QStringLiteral(
"model" );
134 case Billboard:
return QStringLiteral(
"billboard" );
135 default: Q_ASSERT(
false );
return QString();
141 QMatrix4x4 billboardTransformMatrix;
142 billboardTransformMatrix.translate( QVector3D( 0, mTransform.data()[13], 0 ) );
144 return billboardTransformMatrix;