Class: QgsMaskMarkerSymbolLayer

class qgis.core.QgsMaskMarkerSymbolLayer

Bases: QgsMarkerSymbolLayer

Special symbol layer that uses its sub symbol as a selective mask

New in version 3.12.

QgsMaskMarkerSymbolLayer() Simple constructor

Methods

bounds

param point:

clone

rtype:

QgsMaskMarkerSymbolLayer

color

rtype:

QColor

copyDataDefinedProperties

Copies all data defined properties of this layer to another symbol layer.

copyPaintEffect

Copies paint effect of this layer to another symbol layer

create

Create a new QgsMaskMarkerSymbolLayer

drawPreviewIcon

param context:

enabled

Whether some masked symbol layers are defined

hasDataDefinedProperties

rtype:

bool

installMasks

When rendering, install masks on context painter if recursive is True masks are installed recursively for all children symbol layers

layerType

rtype:

str

markerOffset

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.

markerOffset2

markerOffsetWithWidthAndHeight

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker's anchor point.

masks

Returns a list of references to symbol layers that are masked by the sub symbol's shape.

properties

rtype:

Dict[str, Any]

removeMasks

When rendering, remove previously installed masks from context painter if recursive is True masks are removed recursively for all children symbol layers

renderPoint

param point:

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

setMasks

Sets the symbol layers that will be masked by the sub symbol's shape.

setOutputUnit

param unit:

setSubSymbol

param symbol:

shouldRenderUsingSelectionColor

Returns True if the symbol layer should be rendered using the selection color from the render context.

startRender

param context:

stopRender

param context:

subSymbol

rtype:

QgsSymbol

usedAttributes

param context:

usesMapUnits

rtype:

bool

bounds(self, point: QPointF | QPoint, context: QgsSymbolRenderContext) QRectF
Parameters:
Return type:

QRectF

clone(self) QgsMaskMarkerSymbolLayer
Return type:

QgsMaskMarkerSymbolLayer

color(self) QColor
Return type:

QColor

copyDataDefinedProperties(self, destLayer: QgsSymbolLayer)

Copies all data defined properties of this layer to another symbol layer.

Parameters:

destLayer – destination layer

copyPaintEffect(self, destLayer: QgsSymbolLayer)

Copies paint effect of this layer to another symbol layer

Parameters:

destLayer – destination layer

create(properties: Dict[str, Any] = {}) QgsSymbolLayer

Create a new QgsMaskMarkerSymbolLayer

Parameters:

properties (Dict[str) – A property map to deserialize saved information from properties()

Return type:

QgsSymbolLayer

Returns:

A new QgsMaskMarkerSymbolLayer

drawPreviewIcon(self, context: QgsSymbolRenderContext, size: QSize)
Parameters:
enabled(self) bool

Whether some masked symbol layers are defined

Return type:

bool

hasDataDefinedProperties(self) bool
Return type:

bool

installMasks(self, context: QgsRenderContext, recursive: bool)

When rendering, install masks on context painter if recursive is True masks are installed recursively for all children symbol layers

See also

prepareMasks()

See also

removeMasks()

New in version 3.30.

layerType(self) str
Return type:

str

markerOffset(self, context: QgsSymbolRenderContext) Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters:
  • context – symbol render context

  • offsetX – will be set to required horizontal offset (in painter units)

  • offsetY – will be set to required vertical offset (in painter units)

markerOffset2(self, context: QgsSymbolRenderContext, width: float, height: float, widthUnit: Qgis.RenderUnit, heightUnit: Qgis.RenderUnit, widthMapUnitScale: QgsMapUnitScale, heightMapUnitScale: QgsMapUnitScale) Tuple[float, float]

Note

available in Python bindings as markerOffset2

markerOffsetWithWidthAndHeight(self, context: QgsSymbolRenderContext, width: float, height: float) Tuple[float, float]

Calculates the required marker offset, including both the symbol offset and any displacement required to align with the marker’s anchor point.

Parameters:
  • context – symbol render context

  • width – marker width

  • height – marker height

  • offsetX – will be set to required horizontal offset (in painter units)

  • offsetY – will be set to required vertical offset (in painter units)

Note

available in Python as markerOffsetWithWidthAndHeight

masks(self) List[QgsSymbolLayerReference]

Returns a list of references to symbol layers that are masked by the sub symbol’s shape.

Return type:

List[QgsSymbolLayerReference]

Returns:

a list of references to masked symbol layers

See also

setMasks()

properties(self) Dict[str, Any]
Return type:

Dict[str, Any]

removeMasks(self, context: QgsRenderContext, recursive: bool)

When rendering, remove previously installed masks from context painter if recursive is True masks are removed recursively for all children symbol layers

See also

prepareMasks()

See also

installMasks()

New in version 3.30.

renderPoint(self, point: QPointF | QPoint, context: QgsSymbolRenderContext)
Parameters:
restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])

Restores older data defined properties from string map.

setMasks(self, maskedLayers: Iterable[QgsSymbolLayerReference])

Sets the symbol layers that will be masked by the sub symbol’s shape.

Parameters:

maskedLayers (Iterable[QgsSymbolLayerReference]) – list of references to symbol layers

See also

masks()

setOutputUnit(self, unit: Qgis.RenderUnit)
Parameters:

unit (Qgis.RenderUnit) –

setSubSymbol(self, symbol: QgsSymbol) bool
Parameters:

symbol (QgsSymbol) –

Return type:

bool

shouldRenderUsingSelectionColor(self, context: QgsSymbolRenderContext) bool

Returns True if the symbol layer should be rendered using the selection color from the render context.

New in version 3.34.

startRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

stopRender(self, context: QgsSymbolRenderContext)
Parameters:

context (QgsSymbolRenderContext) –

subSymbol(self) QgsSymbol
Return type:

QgsSymbol

usedAttributes(self, context: QgsRenderContext) Set[str]
Parameters:

context (QgsRenderContext) –

Return type:

Set[str]

usesMapUnits(self) bool
Return type:

bool