Class: QgsLineSymbolLayer

class qgis.core.QgsLineSymbolLayer(locked: bool = False)

Bases: QgsSymbolLayer

Methods

copyDataDefinedProperties

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

copyPaintEffect

Copies paint effect of this layer to another symbol layer

drawPreviewIcon

param context:

dxfWidth

param e:

installMasks

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

mapUnitScale

rtype:

QgsMapUnitScale

offset

Returns the line's offset.

offsetMapUnitScale

Returns the map unit scale for the line's offset.

offsetUnit

Returns the units for the line's offset.

outputUnit

rtype:

Qgis.RenderUnit

removeMasks

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

renderPolygonStroke

Renders the line symbol layer along the outline of polygon, using the given render context.

renderPolyline

Renders the line symbol layer along the line joining points, using the given render context.

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

ringFilter

Returns the line symbol layer's ring filter, which controls which rings are rendered when the line symbol is being used to draw a polygon's rings.

setMapUnitScale

param scale:

setOffset

Sets the line's offset.

setOffsetMapUnitScale

Sets the map unit scale for the line's offset.

setOffsetUnit

Sets the unit for the line's offset.

setOutputUnit

QgsLineSymbolLayer cannot be copied

setRingFilter

Sets the line symbol layer's ring filter, which controls which rings are rendered when the line symbol is being used to draw a polygon's rings.

setWidth

Sets the width of the line symbol layer.

setWidthMapUnitScale

param scale:

setWidthUnit

Sets the units for the line's width.

shouldRenderUsingSelectionColor

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

width

Returns the estimated width for the line symbol layer.

widthMapUnitScale

rtype:

QgsMapUnitScale

widthUnit

Returns the units for the line's width.

Attributes

AllRings

ExteriorRingOnly

InteriorRingsOnly

AllRings = 0
ExteriorRingOnly = 1
InteriorRingsOnly = 2
class RenderRingFilter

Bases: int

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

drawPreviewIcon(self, context: QgsSymbolRenderContext, size: QSize)
Parameters:
dxfWidth(self, e: QgsDxfExport, context: QgsSymbolRenderContext) float
Parameters:
Return type:

float

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.

mapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

offset(self) float

Returns the line’s offset.

Offset units can be retrieved by calling offsetUnit().

See also

setOffset()

See also

offsetUnit()

Return type:

float

offsetMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the line’s offset.

See also

offset()

See also

offsetUnit()

Return type:

QgsMapUnitScale

offsetUnit(self) Qgis.RenderUnit

Returns the units for the line’s offset.

See also

setOffsetUnit()

See also

offset()

Return type:

Qgis.RenderUnit

outputUnit(self) Qgis.RenderUnit
Return type:

Qgis.RenderUnit

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.

renderPolygonStroke(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)

Renders the line symbol layer along the outline of polygon, using the given render context.

The exterior ring of the polygon is specified in points. Optionally, interior rings are set via the rings argument.

See also

renderPolyline()

Parameters:
renderPolyline(self, points: QPolygonF, context: QgsSymbolRenderContext)

Renders the line symbol layer along the line joining points, using the given render context.

Parameters:
restoreOldDataDefinedProperties(self, stringMap: Dict[str, Any])

Restores older data defined properties from string map.

ringFilter(self) QgsLineSymbolLayer.RenderRingFilter

Returns the line symbol layer’s ring filter, which controls which rings are rendered when the line symbol is being used to draw a polygon’s rings.

This setting has no effect when the line symbol is not being rendered for a polygon.

See also

setRingFilter()

New in version 3.6.

Return type:

QgsLineSymbolLayer.RenderRingFilter

setMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setOffset(self, offset: float)

Sets the line’s offset.

Offset units are set via setOffsetUnit().

See also

offset()

See also

setOffsetUnit()

Parameters:

offset (float) –

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the line’s offset.

See also

setOffset()

See also

setOffsetUnit()

Parameters:

scale (QgsMapUnitScale) –

setOffsetUnit(self, unit: Qgis.RenderUnit)

Sets the unit for the line’s offset.

See also

offsetUnit()

See also

setOffset()

Parameters:

unit (Qgis.RenderUnit) –

setOutputUnit(self, unit: Qgis.RenderUnit)

QgsLineSymbolLayer cannot be copied

Parameters:

unit (Qgis.RenderUnit) –

setRingFilter(self, filter: QgsLineSymbolLayer.RenderRingFilter)

Sets the line symbol layer’s ring filter, which controls which rings are rendered when the line symbol is being used to draw a polygon’s rings.

This setting has no effect when the line symbol is not being rendered for a polygon.

See also

ringFilter()

New in version 3.6.

Parameters:

filter (QgsLineSymbolLayer.RenderRingFilter) –

setWidth(self, width: float)

Sets the width of the line symbol layer.

Calling this method updates the width of the line symbol layer, without changing the existing width units. It has different effects depending on the line symbol layer subclass, e.g. for a simple line layer it changes the stroke width of the line, for a marker line layer it changes the size of the markers used to draw the line.

See also

width()

Warning

Since the width units vary, this method is useful for changing the relative width of a line symbol layer only.

Parameters:

width (float) –

setWidthMapUnitScale(self, scale: QgsMapUnitScale)
Parameters:

scale (QgsMapUnitScale) –

setWidthUnit(self, unit: Qgis.RenderUnit)

Sets the units for the line’s width.

Parameters:

unit (Qgis.RenderUnit) – width units

See also

widthUnit()

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.

width(self) float

Returns the estimated width for the line symbol layer.

Warning

This returned value is inaccurate if the symbol layer has sub-symbols with different width units. Use the overload accepting a QgsRenderContext argument instead for accurate sizes in this case.

See also

setWidth()

width(self, context: QgsRenderContext) -> float Returns the line symbol layer width, in painter units.

This method returns an accurate width by calculating the actual rendered width of the symbol layer using the provided render context.

See also

setWidth()

New in version 3.4.5.

Return type:

float

widthMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

widthUnit(self) Qgis.RenderUnit

Returns the units for the line’s width.

See also

setWidthUnit()

Return type:

Qgis.RenderUnit