Skip to content
Permalink
Browse files

[optimization][symbology] Rely on enum for ellipse marker symbol laye…

…r shapes
  • Loading branch information
nirvn committed Mar 19, 2021
1 parent e87b1ac commit ad998573d48f57a41f31f9a599e0fea21c6a1ca6
@@ -19,6 +19,35 @@ A symbol layer for rendering objects with major and minor axis (e.g. ellipse, re
#include "qgsellipsesymbollayer.h"
%End
public:

enum Shape
{
Circle,
Rectangle,
Diamond,
Cross,
Arrow,
HalfArc,
Triangle,
RightHalfTriangle,
LeftHalfTriangle,
SemiCircle,
};

static QList< QgsEllipseSymbolLayer::Shape > availableShapes();
%Docstring
Returns a list of all available shape types.
%End

static bool shapeIsFilled( const QgsEllipseSymbolLayer::Shape &shape );
%Docstring
Returns ``True`` if a ``shape`` has a fill.

:return: ``True`` if shape uses a fill, or ``False`` if shape uses lines only

.. versionadded:: 3.20
%End

QgsEllipseSymbolLayer();

static QgsSymbolLayer *create( const QVariantMap &properties = QVariantMap() ) /Factory/;
@@ -48,16 +77,72 @@ Creates the symbol layer
virtual bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;


void setSymbolName( const QString &name );
QString symbolName() const;
void setSymbolName( const QString &name ) /Deprecated/;
%Docstring
Sets the rendered ellipse marker shape using a symbol ``name``.

static bool shapeIsFilled( const QString &symbolName );
.. seealso:: :py:func:`setShape`

.. seealso:: :py:func:`shape`

.. deprecated:: QGIS 3.20
%End

QString symbolName() const /Deprecated/;
%Docstring
Returns ``True`` if a shape has a fill.
Returns the shape name for the rendered ellipse marker symbol.

:param symbolName: name of shape to test
.. seealso:: :py:func:`shape`

:return: ``True`` if shape uses a fill, or ``False`` if shape uses lines only
.. seealso:: :py:func:`setShape`

.. deprecated:: QGIS 3.20
%End

QgsEllipseSymbolLayer::Shape shape() const;
%Docstring
Returns the shape for the rendered ellipse marker symbol.

.. seealso:: :py:func:`setShape`

.. versionadded:: 3.20
%End

void setShape( QgsEllipseSymbolLayer::Shape shape );
%Docstring
Sets the rendered ellipse marker shape.

:param shape: new ellipse marker shape

.. seealso:: :py:func:`shape`

.. versionadded:: 3.20
%End

static QgsEllipseSymbolLayer::Shape decodeShape( const QString &name, bool *ok = 0 );
%Docstring
Attempts to decode a string representation of a shape name to the corresponding
shape.

:param name: encoded shape name
:param ok: if specified, will be set to ``True`` if shape was successfully decoded

:return: decoded name

.. seealso:: :py:func:`encodeShape`

.. versionadded:: 3.20
%End

static QString encodeShape( QgsEllipseSymbolLayer::Shape shape );
%Docstring
Encodes a shape to its string representation.

:param shape: shape to encode

:return: encoded string

.. seealso:: :py:func:`decodeShape`

.. versionadded:: 3.20
%End

0 comments on commit ad99857

Please sign in to comment.