QgsFilledMarkerSymbolLayer class

Filled marker symbol layer, consisting of a shape which is rendered using a QgsFillSymbol.

This allows the symbol to support advanced styling of the interior and stroke of the shape.

Base classes

class QgsSimpleMarkerSymbolLayerBase
Abstract base class for simple marker symbol layers.

Public static functions

static auto create(const QgsStringMap& properties = QgsStringMap()) -> QgsSymbolLayer*
Creates a new QgsFilledMarkerSymbolLayer.

Constructors, destructors, conversion operators

QgsFilledMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle, double size = DEFAULT_SIMPLEMARKER_SIZE, double angle = DEFAULT_SIMPLEMARKER_ANGLE, QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD)
Constructor for QgsFilledMarkerSymbolLayer.

Public functions

auto clone() const -> QgsFilledMarkerSymbolLayer* override
Shall be reimplemented by subclasses to create a deep copy of the instance.
auto color() const -> QColor override
The fill color.
auto estimateMaxBleed(const QgsRenderContext& context) const -> double override
Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context.
auto layerType() const -> QString override
Returns a string that represents this layer type.
auto properties() const -> QgsStringMap override
Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.
void setColor(const QColor& color) override
The fill color.
auto setSubSymbol(QgsSymbol* symbol) -> bool override
Sets layer's subsymbol. takes ownership of the passed symbol.
auto subSymbol() -> QgsSymbol* override
Returns the symbol's sub symbol, if present.
auto usedAttributes(const QgsRenderContext& context) const -> QSet<QString> override
Returns the set of attributes referenced by the layer.

Private functions

void draw(QgsSymbolRenderContext& context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF& polygon, const QPainterPath& path) override SIP_FORCE virtual
Derived classes must implement draw() to handle drawing the generated shape onto the painter surface.

Function documentation

static QgsSymbolLayer* QgsFilledMarkerSymbolLayer::create(const QgsStringMap& properties = QgsStringMap())

Creates a new QgsFilledMarkerSymbolLayer.

Parameters
properties a property map containing symbol properties (see properties())
Returns new QgsFilledMarkerSymbolLayer

QgsFilledMarkerSymbolLayer::QgsFilledMarkerSymbolLayer(QgsSimpleMarkerSymbolLayerBase::Shape shape = Circle, double size = DEFAULT_SIMPLEMARKER_SIZE, double angle = DEFAULT_SIMPLEMARKER_ANGLE, QgsSymbol::ScaleMethod scaleMethod = DEFAULT_SCALE_METHOD)

Constructor for QgsFilledMarkerSymbolLayer.

Parameters
shape symbol shape
size symbol size (in mm)
angle symbol rotation angle
scaleMethod size scaling method

double QgsFilledMarkerSymbolLayer::estimateMaxBleed(const QgsRenderContext& context) const override

Returns the estimated maximum distance which the layer style will bleed outside the drawn shape when drawn in the specified /a context.

For example, polygons drawn with an stroke will draw half the width of the stroke outside of the polygon. This amount is estimated, since it may be affected by data defined symbology rules.

QString QgsFilledMarkerSymbolLayer::layerType() const override

Returns a string that represents this layer type.

Used for serialization. Should match with the string used to register this symbol layer in the registry.

QgsStringMap QgsFilledMarkerSymbolLayer::properties() const override

Should be reimplemented by subclasses to return a string map that contains the configuration information for the symbol layer.

This is used to serialize a symbol layer perstistently.

QSet<QString> QgsFilledMarkerSymbolLayer::usedAttributes(const QgsRenderContext& context) const override

Returns the set of attributes referenced by the layer.

This includes attributes required by any data defined properties associated with the layer.

void QgsFilledMarkerSymbolLayer::draw(QgsSymbolRenderContext& context, QgsSimpleMarkerSymbolLayerBase::Shape shape, const QPolygonF& polygon, const QPainterPath& path) override SIP_FORCE virtual private

Derived classes must implement draw() to handle drawing the generated shape onto the painter surface.

Parameters
context symbol render context
shape shape to draw
polygon polygon representing transformed marker shape. May be empty, in which case the shape will be specified in the path argument.
path transformed painter path representing shape to draw