44 : mAltClamping( other.altitudeClamping() )
45 , mMaterial( other.material() ? other.material()->clone() : nullptr )
46 , mShape( other.shape() )
47 , mShapeProperties( other.shapeProperties() )
48 , mTransform( other.transform() )
49 , mBillboardSymbol( other.billboardSymbol() ? other.billboardSymbol()->clone() : nullptr )
51 setDataDefinedProperties( other.dataDefinedProperties() );
56 QDomDocument doc = elem.ownerDocument();
58 QDomElement elemDataProperties = doc.createElement( QStringLiteral(
"data" ) );
60 elem.appendChild( elemDataProperties );
62 elem.setAttribute( QStringLiteral(
"material_type" ), mMaterial->type() );
63 QDomElement elemMaterial = doc.createElement( QStringLiteral(
"material" ) );
64 mMaterial->writeXml( elemMaterial, context );
65 elem.appendChild( elemMaterial );
67 elem.setAttribute( QStringLiteral(
"shape" ),
shapeToString( mShape ) );
69 QVariantMap shapePropertiesCopy( mShapeProperties );
70 shapePropertiesCopy[QStringLiteral(
"model" )] = QVariant( context.
pathResolver().
writePath( shapePropertiesCopy[QStringLiteral(
"model" )].toString() ) );
72 QDomElement elemShapeProperties = doc.createElement( QStringLiteral(
"shape-properties" ) );
74 elem.appendChild( elemShapeProperties );
76 QDomElement elemTransform = doc.createElement( QStringLiteral(
"transform" ) );
78 elem.appendChild( elemTransform );
84 elem.appendChild( symbolElem );
90 QDomElement elemDataProperties = elem.firstChildElement( QStringLiteral(
"data" ) );
93 QDomElement elemMaterial = elem.firstChildElement( QStringLiteral(
"material" ) );
94 const QString materialType = elem.attribute( QStringLiteral(
"material_type" ), QStringLiteral(
"phong" ) );
98 mMaterial->readXml( elemMaterial, context );
100 mShape =
shapeFromString( elem.attribute( QStringLiteral(
"shape" ) ) );
102 QDomElement elemShapeProperties = elem.firstChildElement( QStringLiteral(
"shape-properties" ) );
104 mShapeProperties[QStringLiteral(
"model" )] = QVariant( context.
pathResolver().
readPath( mShapeProperties[QStringLiteral(
"model" )].toString() ) );
106 QDomElement elemTransform = elem.firstChildElement( QStringLiteral(
"transform" ) );
109 QDomElement symbolElem = elem.firstChildElement( QStringLiteral(
"symbol" ) );
111 setBillboardSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
121 if (
shape == QStringLiteral(
"sphere" ) )
123 else if (
shape == QLatin1String(
"cone" ) )
125 else if (
shape == QLatin1String(
"cube" ) )
127 else if (
shape == QLatin1String(
"torus" ) )
129 else if (
shape == QLatin1String(
"plane" ) )
131 else if (
shape == QLatin1String(
"extruded-text" ) )
133 else if (
shape == QLatin1String(
"model" ) )
135 else if (
shape == QLatin1String(
"billboard" ) )
145 case Cylinder:
return QStringLiteral(
"cylinder" );
146 case Sphere:
return QStringLiteral(
"sphere" );
147 case Cone:
return QStringLiteral(
"cone" );
148 case Cube:
return QStringLiteral(
"cube" );
149 case Torus:
return QStringLiteral(
"torus" );
150 case Plane:
return QStringLiteral(
"plane" );
151 case ExtrudedText:
return QStringLiteral(
"extruded-text" );
152 case Model:
return QStringLiteral(
"model" );
153 case Billboard:
return QStringLiteral(
"billboard" );
154 default: Q_ASSERT(
false );
return QString();
160 QMatrix4x4 billboardTransformMatrix;
161 billboardTransformMatrix.translate( QVector3D( 0, mTransform.data()[13], 0 ) );
163 return billboardTransformMatrix;
168 return mMaterial.get();
183 Qt3DRender::QSceneLoader *sceneLoader = entity->findChild<Qt3DRender::QSceneLoader *>();
184 if ( sceneLoader !=
nullptr )
186 QVector<Qgs3DExportObject *> objects = exporter->processSceneLoaderGeometries( sceneLoader, objectNamePrefix );
192 exporter->mObjects << objects;
196 QList<Qt3DRender::QMesh *> meshes = entity->findChildren<Qt3DRender::QMesh *>();
197 for ( Qt3DRender::QMesh *mesh : meshes )
199 Qgs3DExportObject *
object = exporter->processGeometryRenderer( mesh, objectNamePrefix );
200 if (
object ==
nullptr )
continue;
202 object->setupMaterial(
material() );
203 exporter->mObjects << object;
211 if ( obj !=
nullptr ) exporter->mObjects << obj;
212 if ( obj !=
nullptr )
return true;
216 QVector<Qgs3DExportObject *> objects = exporter->processInstancedPointGeometry( entity, objectNamePrefix );
220 exporter->mObjects << obj;