Skip to content
Permalink
Browse files

Add method to determine compatible vector layer types for a 3d symbol

  • Loading branch information
nyalldawson committed Jul 29, 2020
1 parent 680e095 commit 93022ea70705895348cb6f1abd021bb7916e3e74
@@ -48,6 +48,8 @@ Caller takes ownership of the returned symbol.

virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );

virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const;


Qgs3DTypes::AltitudeClamping altitudeClamping() const;
%Docstring
@@ -53,6 +53,8 @@ Caller takes ownership of the returned symbol.

virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );

virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const;


Qgs3DTypes::AltitudeClamping altitudeClamping() const;
%Docstring
@@ -42,6 +42,8 @@ Constructor for QgsPolygon3DSymbol

virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );

virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const;


static QgsAbstract3DSymbol *create() /Factory/;
%Docstring
@@ -54,6 +54,13 @@ Writes symbol configuration to the given DOM element
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
%Docstring
Reads symbol configuration from the given DOM element
%End

virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const;
%Docstring
Returns the list of the vector layer geometry types which are compatible with this symbol.

.. versionadded:: 3.16
%End

enum Property
@@ -94,6 +94,11 @@ void QgsLine3DSymbol::setMaterial( QgsAbstractMaterialSettings *material )
mMaterial.reset( material );
}

QList<QgsWkbTypes::GeometryType> QgsLine3DSymbol::compatibleGeometryTypes() const
{
return QList< QgsWkbTypes::GeometryType >() << QgsWkbTypes::LineGeometry;
}

QgsAbstract3DSymbol *QgsLine3DSymbol::create()
{
return new QgsLine3DSymbol();
@@ -51,6 +51,7 @@ class _3D_EXPORT QgsLine3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTORS

void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override;

//! Returns method that determines altitude (whether to clamp to feature to terrain)
Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
@@ -109,6 +109,11 @@ void QgsPoint3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteConte
setBillboardSymbol( QgsSymbolLayerUtils::loadSymbol< QgsMarkerSymbol >( symbolElem, context ) );
}

QList<QgsWkbTypes::GeometryType> QgsPoint3DSymbol::compatibleGeometryTypes() const
{
return QList< QgsWkbTypes::GeometryType >() << QgsWkbTypes::PointGeometry;
}

QgsPoint3DSymbol::Shape QgsPoint3DSymbol::shapeFromString( const QString &shape )
{
if ( shape == QStringLiteral( "sphere" ) )
@@ -56,6 +56,7 @@ class _3D_EXPORT QgsPoint3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCTOR

void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override;

//! Returns method that determines altitude (whether to clamp to feature to terrain)
Qgs3DTypes::AltitudeClamping altitudeClamping() const { return mAltClamping; }
@@ -114,6 +114,11 @@ void QgsPolygon3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteCon
}
}

QList<QgsWkbTypes::GeometryType> QgsPolygon3DSymbol::compatibleGeometryTypes() const
{
return QList< QgsWkbTypes::GeometryType >() << QgsWkbTypes::PolygonGeometry;
}

QgsAbstract3DSymbol *QgsPolygon3DSymbol::create()
{
return new QgsPolygon3DSymbol();
@@ -46,6 +46,7 @@ class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol SIP_NODEFAULTCT

void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const override;

/**
* Creates a new QgsPolygon3DSymbol.
@@ -19,6 +19,11 @@
QgsPropertiesDefinition QgsAbstract3DSymbol::sPropertyDefinitions;


QList<QgsWkbTypes::GeometryType> QgsAbstract3DSymbol::compatibleGeometryTypes() const
{
return QList< QgsWkbTypes::GeometryType >();
}

const QgsPropertiesDefinition &QgsAbstract3DSymbol::propertyDefinitions()
{
initPropertyDefinitions();
@@ -55,6 +55,13 @@ class CORE_EXPORT QgsAbstract3DSymbol
//! Reads symbol configuration from the given DOM element
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;

/**
* Returns the list of the vector layer geometry types which are compatible with this symbol.
*
* \since QGIS 3.16
*/
virtual QList< QgsWkbTypes::GeometryType > compatibleGeometryTypes() const;

//! Data definable properties.
enum Property
{

0 comments on commit 93022ea

Please sign in to comment.
You can’t perform that action at this time.