Class: QgsSimpleMarkerSymbolLayer

class qgis.core.QgsSimpleMarkerSymbolLayer

Bases: QgsSimpleMarkerSymbolLayerBase

Simple marker symbol layer, consisting of a rendered shape with solid fill color and an stroke.

QgsSimpleMarkerSymbolLayer(shape: Qgis.MarkerShape = Qgis.MarkerShape.Circle, size: float = DEFAULT_SIMPLEMARKER_SIZE, angle: float = DEFAULT_SIMPLEMARKER_ANGLE, scaleMethod: Qgis.ScaleMethod = DEFAULT_SCALE_METHOD, color: Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEMARKER_COLOR, strokeColor: Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEMARKER_BORDERCOLOR, penJoinStyle: Qt.PenJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE) Constructor for QgsSimpleMarkerSymbolLayer.

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

QRectF

calculateOffsetAndRotation()
calculateSize()
clone(self) QgsSimpleMarkerSymbolLayer
Return type:

QgsSimpleMarkerSymbolLayer

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

Creates a new QgsSimpleMarkerSymbolLayer.

Parameters:

properties (Dict[str) – a property map containing symbol properties (see properties())

Return type:

QgsSymbolLayer

Returns:

new QgsSimpleMarkerSymbolLayer

createFromSld(element: QDomElement) QgsSymbolLayer

Creates a new QgsSimpleMarkerSymbolLayer from an SLD XML element.

Parameters:

element (QDomElement) – XML element containing SLD definition of symbol

Return type:

QgsSymbolLayer

Returns:

new QgsSimpleMarkerSymbolLayer

draw()
drawMarker(self, p: QPainter, context: QgsSymbolRenderContext)

Draws the marker shape in the specified painter.

Parameters:

Note

this method does not handle setting the painter pen or brush to match the symbol’s fill or stroke

fillColor(self) QColor
Return type:

QColor

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

mapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

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

ogrFeatureStyle(self, mmScaleFactor: float, mapUnitScaleFactor: float) str
Parameters:
  • mmScaleFactor (float) –

  • mapUnitScaleFactor (float) –

Return type:

str

outputUnit(self) Qgis.RenderUnit
Return type:

Qgis.RenderUnit

penCapStyle(self) Qt.PenCapStyle

Returns the marker’s stroke cap style (e.g., flat, round, etc).

See also

setPenCapStyle()

See also

penJoinStyle()

See also

strokeColor()

See also

strokeStyle()

New in version 3.20.

Return type:

Qt.PenCapStyle

penJoinStyle(self) Qt.PenJoinStyle

Returns the marker’s stroke join style (e.g., miter, bevel, etc).

See also

penCapStyle()

See also

strokeColor()

See also

strokeStyle()

Return type:

Qt.PenJoinStyle

prepareCache(self, context: QgsSymbolRenderContext) bool

Prepares cache image

Return type:

bool

Returns:

True in case of success, False if cache image size too large

Parameters:

context (QgsSymbolRenderContext) –

prepareMarkerPath()
prepareMarkerShape()
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.

setColor(self, color: QColor | Qt.GlobalColor)
Parameters:

color (Union[QColor) –

setFillColor(self, color: QColor | Qt.GlobalColor)
Parameters:

color (Union[QColor) –

setMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

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

unit (Qgis.RenderUnit) –

setPenCapStyle(self, style: Qt.PenCapStyle)

Sets the marker’s stroke cap style (e.g., flat, round, etc).

See also

penCapStyle()

See also

penJoinStyle()

See also

setStrokeColor()

See also

setStrokeStyle()

New in version 3.20.

Parameters:

style (Qt.PenCapStyle) –

setPenJoinStyle(self, style: Qt.PenJoinStyle)

Sets the marker’s stroke join style (e.g., miter, bevel, etc).

Parameters:

style (Qt.PenJoinStyle) – join style

See also

penJoinStyle()

See also

setPenCapStyle()

See also

setStrokeColor()

See also

setStrokeStyle()

setStrokeColor(self, color: QColor | Qt.GlobalColor)

Sets the marker’s stroke color.

Parameters:

color (Union[QColor) – stroke color

See also

strokeColor()

See also

setStrokeStyle()

setStrokeStyle(self, strokeStyle: Qt.PenStyle)

Sets the marker’s stroke style (e.g., solid, dashed, etc)

Parameters:

strokeStyle (Qt.PenStyle) – style

See also

strokeStyle()

See also

setStrokeColor()

setStrokeWidth(self, w: float)

Sets the width of the marker’s stroke.

Parameters:

w (float) – stroke width. See strokeWidthUnit() for units.

See also

strokeWidth()

setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map scale for the width of the marker’s stroke.

Parameters:

scale (QgsMapUnitScale) – stroke width map unit scale

See also

setStrokeWidth()

setStrokeWidthUnit(self, u: Qgis.RenderUnit)

Sets the unit for the width of the marker’s stroke.

Parameters:

u (Qgis.RenderUnit) – stroke width unit

See also

setStrokeWidth()

shapeToPolygon()
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) –

strokeColor(self) QColor

Returns the marker’s stroke color.

See also

setStrokeColor()

See also

strokeStyle()

See also

penJoinStyle()

Return type:

QColor

strokeStyle(self) Qt.PenStyle

Returns the marker’s stroke style (e.g., solid, dashed, etc)

See also

setStrokeStyle()

See also

strokeColor()

See also

penJoinStyle()

Return type:

Qt.PenStyle

strokeWidth(self) float

Returns the width of the marker’s stroke.

See also

setStrokeWidth()

Return type:

float

strokeWidthMapUnitScale(self) QgsMapUnitScale

Returns the map scale for the width of the marker’s stroke.

See also

strokeWidth()

Return type:

QgsMapUnitScale

strokeWidthUnit(self) Qgis.RenderUnit

Returns the unit for the width of the marker’s stroke.

See also

strokeWidth()

Return type:

Qgis.RenderUnit

usesMapUnits(self) bool
Return type:

bool

writeDxf(self, e: QgsDxfExport, mmMapUnitScaleFactor: float, layerName: str, context: QgsSymbolRenderContext, shift: QPointF | QPoint = QPointF(0, 0)) bool
Parameters:
Return type:

bool

writeSldMarker(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any])
Parameters:
  • doc (QDomDocument) –

  • element (QDomElement) –

  • props (Dict[str) –