Class: QgsSimpleMarkerSymbolLayer

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsSimpleMarkerSymbolLayer

Base classes

QgsSimpleMarkerSymbolLayerBase

Abstract base class for simple marker symbol layers.

QgsMarkerSymbolLayer

Abstract base class for marker symbol layers.

QgsSymbolLayer

Abstract base class for symbol layers.

class qgis.core.QgsSimpleMarkerSymbolLayer[source]

Bases: QgsSimpleMarkerSymbolLayerBase

__init__(shape: Qgis.MarkerShape = Qgis.MarkerShape.Circle, size: float = DEFAULT_SIMPLEMARKER_SIZE, angle: float = DEFAULT_SIMPLEMARKER_ANGLE, scaleMethod: Qgis.ScaleMethod = DEFAULT_SCALE_METHOD, color: QColor | Qt.GlobalColor = DEFAULT_SIMPLEMARKER_COLOR, strokeColor: QColor | Qt.GlobalColor = DEFAULT_SIMPLEMARKER_BORDERCOLOR, penJoinStyle: Qt.PenJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE)

Constructor for QgsSimpleMarkerSymbolLayer.

Parameters:
  • shape (Qgis.MarkerShape = Qgis.MarkerShape.Circle) – symbol shape

  • size (float = DEFAULT_SIMPLEMARKER_SIZE) – symbol size (in mm)

  • angle (float = DEFAULT_SIMPLEMARKER_ANGLE) – symbol rotation angle

  • scaleMethod (Qgis.ScaleMethod = DEFAULT_SCALE_METHOD) – scaling method for data defined scaling

  • color (Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEMARKER_COLOR) – fill color for symbol

  • strokeColor (Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEMARKER_BORDERCOLOR) – stroke color for symbol

  • penJoinStyle (Qt.PenJoinStyle = DEFAULT_SIMPLEMARKER_JOINSTYLE) – join style for stroke pen

calculateOffsetAndRotation()
calculateSize()
static create(properties: Dict[str, Any] = {}) QgsSymbolLayer | None[source]

Creates a new QgsSimpleMarkerSymbolLayer.

Parameters:

properties (Dict[str, Any] = {}) – a property map containing symbol properties (see properties())

Return type:

Optional[QgsSymbolLayer]

Returns:

new QgsSimpleMarkerSymbolLayer

static createFromSld(element: QDomElement) QgsSymbolLayer | None[source]

Creates a new QgsSimpleMarkerSymbolLayer from an SLD XML element.

Parameters:

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

Return type:

Optional[QgsSymbolLayer]

Returns:

new QgsSimpleMarkerSymbolLayer

abstract draw()[source]
drawMarker(self, p: QPainter | None, context: QgsSymbolRenderContext)[source]

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

penCapStyle(self) Qt.PenCapStyle[source]

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

See also

setPenCapStyle()

See also

penJoinStyle()

See also

strokeColor()

See also

strokeStyle()

Added in version 3.20.

Return type:

Qt.PenCapStyle

penJoinStyle(self) Qt.PenJoinStyle[source]

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[source]

Prepares cache image

Return type:

bool

Returns:

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

Parameters:

context (QgsSymbolRenderContext)

prepareMarkerPath()
prepareMarkerShape()
setPenCapStyle(self, style: Qt.PenCapStyle)[source]

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

See also

penCapStyle()

See also

penJoinStyle()

See also

setStrokeColor()

See also

setStrokeStyle()

Added in version 3.20.

Parameters:

style (Qt.PenCapStyle)

setPenJoinStyle(self, style: Qt.PenJoinStyle)[source]

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

virtual setStrokeColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the marker’s stroke color.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – stroke color

See also

strokeColor()

See also

setStrokeStyle()

setStrokeStyle(self, strokeStyle: Qt.PenStyle)[source]

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)[source]

Sets the width of the marker’s stroke.

Parameters:

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

See also

strokeWidth()

setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)[source]

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)[source]

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

Parameters:

u (Qgis.RenderUnit) – stroke width unit

See also

setStrokeWidth()

shapeToPolygon()
virtual strokeColor(self) QColor[source]

Returns the marker’s stroke color.

See also

setStrokeColor()

See also

strokeStyle()

See also

penJoinStyle()

Return type:

QColor

strokeStyle(self) Qt.PenStyle[source]

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[source]

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[source]

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

See also

strokeWidth()

Return type:

Qgis.RenderUnit