53 r->mLayerRef = mLayerRef;
69 mSymbol.reset( symbol );
81 if ( !mSymbol || !vl )
84 if ( mSymbol->type() == QLatin1String(
"polygon" ) )
85 return Qgs3DSymbolImpl::entityForPolygon3DSymbol( map, vl, *static_cast<QgsPolygon3DSymbol *>( mSymbol.get() ) );
86 else if ( mSymbol->type() == QLatin1String(
"point" ) )
87 return Qgs3DSymbolImpl::entityForPoint3DSymbol( map, vl, *static_cast<QgsPoint3DSymbol *>( mSymbol.get() ) );
88 else if ( mSymbol->type() == QLatin1String(
"line" ) )
89 return Qgs3DSymbolImpl::entityForLine3DSymbol( map, vl, *static_cast<QgsLine3DSymbol *>( mSymbol.get() ) );
96 QDomDocument doc = elem.ownerDocument();
98 elem.setAttribute( QStringLiteral(
"layer" ), mLayerRef.
layerId );
100 QDomElement elemSymbol = doc.createElement( QStringLiteral(
"symbol" ) );
103 elemSymbol.setAttribute( QStringLiteral(
"type" ), mSymbol->type() );
104 mSymbol->writeXml( elemSymbol, context );
106 elem.appendChild( elemSymbol );
111 mLayerRef =
QgsMapLayerRef( elem.attribute( QStringLiteral(
"layer" ) ) );
113 QDomElement elemSymbol = elem.firstChildElement( QStringLiteral(
"symbol" ) );
114 QString symbolType = elemSymbol.attribute( QStringLiteral(
"type" ) );
116 if ( symbolType == QLatin1String(
"polygon" ) )
118 else if ( symbolType == QLatin1String(
"point" ) )
120 else if ( symbolType == QLatin1String(
"line" ) )
124 symbol->
readXml( elemSymbol, context );
125 mSymbol.reset( symbol );
The class is used as a container of context for various read/write operations on other objects...
void readXml(const QDomElement &elem, const QgsReadWriteContext &context) override
Reads renderer's properties from given XML element.
_LayerRef< QgsMapLayer > QgsMapLayerRef
Base class for all renderers that may to participate in 3D view.
void resolveReferences(const QgsProject &project) override
Resolves references to other objects - second phase of loading - after readXml()
void writeXml(QDomElement &elem, const QgsReadWriteContext &context) const override
Writes renderer's properties to given XML element.
3 3D symbol that draws polygon geometries as planar polygons, optionally extruded (with added walls)...
void setLayer(QgsVectorLayer *layer)
Sets vector layer associated with the renderer.
void setSymbol(QgsAbstract3DSymbol *symbol)
Sets 3D symbol associated with the renderer. Takes ownership of the symbol.
3 Definition of the world
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
QgsVectorLayer3DRenderer * clone() const override
Returns a cloned instance.
QString layerId
Original layer ID.
QPointer< TYPE > layer
Weak pointer to map layer.
3 3D symbol that draws point geometries as 3D objects using one of the predefined shapes...
Reads and writes project states.
3 3D symbol that draws linestring geometries as planar polygons (created from lines using a buffer wi...
void setLayer(TYPE *l)
Sets the reference to point to a specified layer.
const QgsAbstract3DSymbol * symbol() const
Returns 3D symbol associated with the renderer.
3D renderer that renders all features of a vector layer with the same 3D symbol.
QgsVectorLayer * layer() const
Returns vector layer associated with the renderer.
Qt3DCore::QEntity * createEntity(const Qgs3DMapSettings &map) const override
Returns a 3D entity that will be used to show renderer's data in 3D scene.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads symbol configuration from the given DOM element.
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
Represents a vector layer which manages a vector based data sets.
QgsVectorLayer3DRenderer(QgsAbstract3DSymbol *s=nullptr)
Takes ownership of the symbol object.