Class: QgsLineSymbolLayer

Abstract base class for line symbol layers.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsSymbolLayer.clone(), QgsSymbolLayer.layerType(), QgsSymbolLayer.properties(), renderPolyline(), QgsSymbolLayer.startRender(), QgsSymbolLayer.stopRender()

Class Hierarchy

Inheritance diagram of qgis.core.QgsLineSymbolLayer

Base classes

QgsSymbolLayer

Abstract base class for symbol layers.

Subclasses

QgsAbstractBrushedLineSymbolLayer

Base class for line symbol layer types which draws line sections using a QBrush.

QgsArrowSymbolLayer

Line symbol layer used for representing lines as arrows.

QgsFilledLineSymbolLayer

A line symbol layer type which fills a stroked line with a QgsFillSymbol.

QgsTemplatedLineSymbolLayerBase

Base class for templated line symbols, e.g. line symbols which draw markers or hash lines at intervals along the line feature.

QgsInterpolatedLineSymbolLayer

A symbol layer that represents vector layer line features as interpolated lines.

QgsLinearReferencingSymbolLayer

Line symbol layer used for decorating according to linear referencing.

QgsSimpleLineSymbolLayer

A simple line symbol layer, which renders lines using a line in a variety of styles (e.g. solid, dotted, dashed).

Abstract Methods

renderPolyline

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

Methods

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.

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.

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.

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.

setWidthMapUnitScale

setWidthUnit

Sets the units for the line's width.

widthMapUnitScale

widthUnit

Returns the units for the line's width.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsLineSymbolLayer. See the FAQ for more details.

renderPolygonStroke

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

setWidth

Sets the width of the line symbol layer.

width

Returns the estimated width for the line symbol layer.

Attributes

AllRings

ExteriorRingOnly

InteriorRingsOnly

class qgis.core.QgsLineSymbolLayer[source]

Bases: QgsSymbolLayer

AllRings = 0
ExteriorRingOnly = 1
InteriorRingsOnly = 2
class RenderRingFilter

Bases: int

offset(self) float[source]

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

Returns the units for the line’s offset.

See also

setOffsetUnit()

See also

offset()

Return type:

Qgis.RenderUnit

virtual renderPolygonStroke(self, points: QPolygonF, rings: Iterable[QPolygonF] | None, context: QgsSymbolRenderContext)[source]

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:
abstract renderPolyline(self, points: QPolygonF, context: QgsSymbolRenderContext)[source]

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

Parameters:
ringFilter(self) QgsLineSymbolLayer.RenderRingFilter[source]

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

Added in version 3.6.

Return type:

QgsLineSymbolLayer.RenderRingFilter

setOffset(self, offset: float)[source]

Sets the line’s offset.

Offset units are set via setOffsetUnit().

See also

offset()

See also

setOffsetUnit()

Parameters:

offset (float)

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)[source]

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

See also

setOffset()

See also

setOffsetUnit()

Parameters:

scale (QgsMapUnitScale)

setOffsetUnit(self, unit: Qgis.RenderUnit)[source]

Sets the unit for the line’s offset.

See also

offsetUnit()

See also

setOffset()

Parameters:

unit (Qgis.RenderUnit)

setRingFilter(self, filter: QgsLineSymbolLayer.RenderRingFilter)[source]

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

Added in version 3.6.

Parameters:

filter (QgsLineSymbolLayer.RenderRingFilter)

virtual setWidth(self, width: float)[source]

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

scale (QgsMapUnitScale)

setWidthUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units for the line’s width.

Parameters:

unit (Qgis.RenderUnit) – width units

See also

widthUnit()

virtual width(self) float[source]

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

Return type:

float

virtual width(self, context: QgsRenderContext) float[source]

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

Added in version 3.4.5.

Parameters:

context (QgsRenderContext)

Return type:

float

widthMapUnitScale(self) QgsMapUnitScale
Return type:

QgsMapUnitScale

widthUnit(self) Qgis.RenderUnit[source]

Returns the units for the line’s width.

See also

setWidthUnit()

Return type:

Qgis.RenderUnit