Class: QgsEllipseSymbolLayer

class qgis.core.QgsEllipseSymbolLayer

Bases: QgsMarkerSymbolLayer

A symbol layer for rendering objects with major and minor axis (e.g. ellipse, rectangle, etc).

Methods

availableShapes

Returns a list of all available shape types.

bounds

param point:

clone

rtype:

QgsEllipseSymbolLayer

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

Creates the symbol layer

createFromSld

param element:

decodeShape

Attempts to decode a string representation of a shape name to the corresponding shape.

encodeShape

Encodes a shape to its string representation.

fillColor

rtype:

QColor

installMasks

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

layerType

rtype:

str

mapUnitScale

rtype:

QgsMapUnitScale

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.

outputUnit

rtype:

Qgis.RenderUnit

penCapStyle

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

penJoinStyle

Gets stroke join style.

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.

setFillColor

param c:

setMapUnitScale

param scale:

setOutputUnit

param unit:

setPenCapStyle

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

setPenJoinStyle

Set stroke join style.

setShape

Sets the rendered ellipse marker shape.

setSize

param size:

setStrokeColor

param c:

setStrokeStyle

param strokeStyle:

setStrokeWidth

param w:

setStrokeWidthMapUnitScale

param scale:

setStrokeWidthUnit

Sets the units for the symbol's stroke width.

setSymbolHeight

param h:

setSymbolHeightMapUnitScale

param scale:

setSymbolHeightUnit

Sets the units for the symbol's height.

setSymbolName

Sets the rendered ellipse marker shape using a symbol name.

setSymbolWidth

param w:

setSymbolWidthMapUnitScale

param scale:

setSymbolWidthUnit

Sets the units for the symbol's width.

shape

Returns the shape for the rendered ellipse marker symbol.

shapeIsFilled

Returns True if a shape has a fill.

shouldRenderUsingSelectionColor

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

startRender

param context:

stopRender

param context:

strokeColor

rtype:

QColor

strokeStyle

rtype:

Qt.PenStyle

strokeWidth

rtype:

float

strokeWidthMapUnitScale

rtype:

QgsMapUnitScale

strokeWidthUnit

Returns the units for the symbol's stroke width.

symbolHeight

rtype:

float

symbolHeightMapUnitScale

rtype:

QgsMapUnitScale

symbolHeightUnit

Returns the units for the symbol's height.

symbolName

Returns the shape name for the rendered ellipse marker symbol.

symbolWidth

rtype:

float

symbolWidthMapUnitScale

rtype:

QgsMapUnitScale

symbolWidthUnit

Returns the units for the symbol's width.

toSld

param doc:

usesMapUnits

rtype:

bool

writeDxf

param e:

writeSldMarker

param doc:

Attributes

Arrow

Circle

Cross

Diamond

HalfArc

Hexagon

LeftHalfTriangle

Octagon

Pentagon

QuarterCircle

Rectangle

RightHalfTriangle

SemiCircle

Star

ThirdCircle

Triangle

Arrow = 4
Circle = 0
Cross = 3
Diamond = 2
HalfArc = 5
Hexagon = 13
LeftHalfTriangle = 8
Octagon = 14
Pentagon = 12
QuarterCircle = 11
Rectangle = 1
RightHalfTriangle = 7
SemiCircle = 9
class Shape

Bases: int

Star = 15
ThirdCircle = 10
Triangle = 6
availableShapes() List[QgsEllipseSymbolLayer.Shape]

Returns a list of all available shape types.

Return type:

List[QgsEllipseSymbolLayer.Shape]

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

QRectF

clone(self) QgsEllipseSymbolLayer
Return type:

QgsEllipseSymbolLayer

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 the symbol layer

Parameters:

properties (Dict[str) –

Return type:

QgsSymbolLayer

createFromSld(element: QDomElement) QgsSymbolLayer
Parameters:

element (QDomElement) –

Return type:

QgsSymbolLayer

decodeShape(name: str) Tuple[QgsEllipseSymbolLayer.Shape, bool]

Attempts to decode a string representation of a shape name to the corresponding shape.

Parameters:
  • name (str) – encoded shape name

  • ok – if specified, will be set to True if shape was successfully decoded

Return type:

Tuple[QgsEllipseSymbolLayer.Shape, bool]

Returns:

decoded name

See also

encodeShape()

New in version 3.20.

encodeShape(shape: QgsEllipseSymbolLayer.Shape) str

Encodes a shape to its string representation.

Parameters:

shape (QgsEllipseSymbolLayer.Shape) – shape to encode

Return type:

str

Returns:

encoded string

See also

decodeShape()

New in version 3.20.

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

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

Gets stroke join style.

Return type:

Qt.PenJoinStyle

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.

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

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

Set stroke join style.

Parameters:

style (Qt.PenJoinStyle) –

setShape(self, shape: QgsEllipseSymbolLayer.Shape)

Sets the rendered ellipse marker shape.

Parameters:

shape (QgsEllipseSymbolLayer.Shape) – new ellipse marker shape

See also

shape()

New in version 3.20.

setSize(self, size: float)
Parameters:

size (float) –

setStrokeColor(self, c: QColor | Qt.GlobalColor | QGradient)
Parameters:

c (Union[QColor) –

setStrokeStyle(self, strokeStyle: Qt.PenStyle)
Parameters:

strokeStyle (Qt.PenStyle) –

setStrokeWidth(self, w: float)
Parameters:

w (float) –

setStrokeWidthMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setStrokeWidthUnit(self, unit: Qgis.RenderUnit)

Sets the units for the symbol’s stroke width.

Parameters:

unit (Qgis.RenderUnit) – symbol units

setSymbolHeight(self, h: float)
Parameters:

h (float) –

setSymbolHeightMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setSymbolHeightUnit(self, unit: Qgis.RenderUnit)

Sets the units for the symbol’s height.

Parameters:

unit (Qgis.RenderUnit) – symbol units

setSymbolName(self, name: str)

Sets the rendered ellipse marker shape using a symbol name.

See also

setShape()

See also

shape()

Deprecated since version QGIS: 3.20

Parameters:

name (str) –

setSymbolWidth(self, w: float)
Parameters:

w (float) –

setSymbolWidthMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setSymbolWidthUnit(self, unit: Qgis.RenderUnit)

Sets the units for the symbol’s width.

Parameters:

unit (Qgis.RenderUnit) – symbol units

shape(self) QgsEllipseSymbolLayer.Shape

Returns the shape for the rendered ellipse marker symbol.

See also

setShape()

New in version 3.20.

Return type:

QgsEllipseSymbolLayer.Shape

shapeIsFilled(shape: QgsEllipseSymbolLayer.Shape) bool

Returns True if a shape has a fill.

Return type:

bool

Returns:

True if shape uses a fill, or False if shape uses lines only

New in version 3.20.

Parameters:

shape (QgsEllipseSymbolLayer.Shape) –

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

strokeColor(self) QColor
Return type:

QColor

strokeStyle(self) Qt.PenStyle
Return type:

Qt.PenStyle

strokeWidth(self) float
Return type:

float

strokeWidthMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

strokeWidthUnit(self) Qgis.RenderUnit

Returns the units for the symbol’s stroke width.

Return type:

Qgis.RenderUnit

symbolHeight(self) float
Return type:

float

symbolHeightMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

symbolHeightUnit(self) Qgis.RenderUnit

Returns the units for the symbol’s height.

Return type:

Qgis.RenderUnit

symbolName(self) str

Returns the shape name for the rendered ellipse marker symbol.

See also

shape()

See also

setShape()

Deprecated since version QGIS: 3.20

Return type:

str

symbolWidth(self) float
Return type:

float

symbolWidthMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

symbolWidthUnit(self) Qgis.RenderUnit

Returns the units for the symbol’s width.

Return type:

Qgis.RenderUnit

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

  • element (QDomElement) –

  • props (Dict[str) –

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