Class: QgsTemplatedLineSymbolLayerBase

class qgis.core.QgsTemplatedLineSymbolLayerBase(rotateSymbol: bool = True, interval: float = 3)

Bases: qgis._core.QgsLineSymbolLayer

Constructor for QgsTemplatedLineSymbolLayerBase. Creates a template line placed at the specified interval (in millimeters).

The rotateSymbol argument specifies whether individual symbols should be rotated to match the line segment alignment.

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

New in version 3.8: Enums

Methods

averageAngleLength

Returns the length of line over which the line’s direction is averaged when calculating individual symbol angles.

averageAngleMapUnitScale

Returns the map unit scale for the length over which the line’s direction is averaged when calculating individual symbol angles.

averageAngleUnit

Returns the unit for the length over which the line’s direction is averaged when calculating individual symbol angles.

copyDataDefinedProperties

copyPaintEffect

copyTemplateSymbolProperties

Copies all common properties of this layer to another templated symbol layer.

interval

Returns the interval between individual symbols.

intervalMapUnitScale

Returns the map unit scale for the interval between symbols.

intervalUnit

Returns the units for the interval between symbols.

mapUnitScale

offsetAlongLine

Returns the offset along the line for the symbol placement.

offsetAlongLineMapUnitScale

Returns the map unit scale used for calculating the offset in map units along line for symbols.

offsetAlongLineUnit

Returns the unit used for calculating the offset along line for symbols.

outputUnit

placement

Returns the placement of the symbols.

properties

renderPolygonStroke

renderPolyline

renderSymbol

Renders the templated symbol at the specified point, using the given render context.

restoreOldDataDefinedProperties

rotateSymbols

Returns True if the repeating symbols be rotated to match their line segment orientation.

setAverageAngleLength

Sets the length of line over which the line’s direction is averaged when calculating individual symbol angles.

setAverageAngleMapUnitScale

Sets the map unit scale for the length over which the line’s direction is averaged when calculating individual symbol angles.

setAverageAngleUnit

Sets the unit for the length over which the line’s direction is averaged when calculating individual symbol angles.

setCommonProperties

Sets all common symbol properties in the destLayer, using the settings serialized in the properties map.

setInterval

Sets the interval between individual symbols.

setIntervalMapUnitScale

Sets the map unit scale for the interval between symbols.

setIntervalUnit

Sets the units for the interval between symbols.

setMapUnitScale

setOffsetAlongLine

Sets the the offset along the line for the symbol placement.

setOffsetAlongLineMapUnitScale

Sets the map unit scale used for calculating the offset in map units along line for symbols.

setOffsetAlongLineUnit

Sets the unit used for calculating the offset along line for symbols.

setPlacement

Sets the placement of the symbols.

setRotateSymbols

Sets whether the repeating symbols should be rotated to match their line segment orientation.

setSymbolAngle

Sets the symbol’s angle, in degrees clockwise.

setSymbolLineAngle

Sets the line angle modification for the symbol’s angle.

symbolAngle

Returns the symbol’s current angle, in degrees clockwise.

Signals

Attributes

CentralPoint

CurvePoint

FirstVertex

Interval

LastVertex

Vertex

CentralPoint = 4
CurvePoint = 5
FirstVertex = 3
Interval = 0
LastVertex = 2
class Placement

Bases: int

Vertex = 1
averageAngleLength(self) → float

Returns the length of line over which the line’s direction is averaged when calculating individual symbol angles. Longer lengths smooth out angles from jagged lines to a greater extent.

Units are retrieved through averageAngleUnit()

averageAngleMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the length over which the line’s direction is averaged when calculating individual symbol angles.

averageAngleUnit(self) → QgsUnitTypes.RenderUnit

Returns the unit for the length over which the line’s direction is averaged when calculating individual symbol angles.

copyDataDefinedProperties()
copyPaintEffect()
copyTemplateSymbolProperties(self, destLayer: QgsTemplatedLineSymbolLayerBase)

Copies all common properties of this layer to another templated symbol layer.

interval(self) → float

Returns the interval between individual symbols. Units are specified through intervalUnits().

See also

setInterval()

See also

intervalUnit()

intervalMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale for the interval between symbols.

See also

intervalUnit()

See also

interval()

intervalUnit(self) → QgsUnitTypes.RenderUnit

Returns the units for the interval between symbols.

See also

interval()

mapUnitScale(self) → QgsMapUnitScale
offsetAlongLine(self) → float

Returns the offset along the line for the symbol placement. For Interval placements, this is the distance between the start of the line and the first symbol. For FirstVertex and LastVertex placements, this is the distance between the symbol and the start of the line or the end of the line respectively. This setting has no effect for Vertex or CentralPoint placements.

Returns

The offset along the line. The unit for the offset is retrievable via offsetAlongLineUnit.

See also

placement()

offsetAlongLineMapUnitScale(self) → QgsMapUnitScale

Returns the map unit scale used for calculating the offset in map units along line for symbols.

offsetAlongLineUnit(self) → QgsUnitTypes.RenderUnit

Returns the unit used for calculating the offset along line for symbols.

Returns

Offset along line unit type.

outputUnit(self) → QgsUnitTypes.RenderUnit
placement(self) → QgsTemplatedLineSymbolLayerBase.Placement

Returns the placement of the symbols.

See also

setPlacement()

properties(self) → Dict[str, str]
renderPolygonStroke(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)
renderPolyline(self, points: QPolygonF, context: QgsSymbolRenderContext)
renderSymbol(self, point: Union[QPointF, QPoint], feature: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)

Renders the templated symbol at the specified point, using the given render context.

The feature argument is used to pass the feature currently being rendered (when available).

If only a single symbol layer from the symbol should be rendered, it should be specified in the layer argument. A layer of -1 indicates that all symbol layers should be rendered.

If selected is true then the symbol will be drawn using the “selected feature” style and colors instead of the symbol’s normal style.

restoreOldDataDefinedProperties()
rotateSymbols(self) → bool

Returns True if the repeating symbols be rotated to match their line segment orientation.

setAverageAngleLength(self, length: float)

Sets the length of line over which the line’s direction is averaged when calculating individual symbol angles. Longer lengths smooth out angles from jagged lines to a greater extent.

Units are set through setAverageAngleUnit()

setAverageAngleMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the length over which the line’s direction is averaged when calculating individual symbol angles.

setAverageAngleUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit for the length over which the line’s direction is averaged when calculating individual symbol angles.

setCommonProperties(destLayer: QgsTemplatedLineSymbolLayerBase, properties: Dict[str, str])

Sets all common symbol properties in the destLayer, using the settings serialized in the properties map.

setInterval(self, interval: float)

Sets the interval between individual symbols.

Parameters

interval – interval size. Units are specified through setIntervalUnit()

See also

interval()

setIntervalMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the interval between symbols.

See also

setInterval()

setIntervalUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units for the interval between symbols.

Parameters

unit – interval units

See also

intervalUnit()

See also

setInterval()

setMapUnitScale(self, scale: QgsMapUnitScale)
setOffsetAlongLine(self, offsetAlongLine: float)

Sets the the offset along the line for the symbol placement. For Interval placements, this is the distance between the start of the line and the first symbol. For FirstVertex and LastVertex placements, this is the distance between the symbol and the start of the line or the end of the line respectively. This setting has no effect for Vertex or CentralPoint placements.

Parameters

offsetAlongLine – Distance to offset markers along the line. The offset unit is set via setOffsetAlongLineUnit.

See also

setPlacement()

setOffsetAlongLineMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale used for calculating the offset in map units along line for symbols.

setOffsetAlongLineUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the unit used for calculating the offset along line for symbols.

Parameters

unit – Offset along line unit type.

setPlacement(self, placement: QgsTemplatedLineSymbolLayerBase.Placement)

Sets the placement of the symbols.

See also

placement()

setRotateSymbols(self, rotate: bool)

Sets whether the repeating symbols should be rotated to match their line segment orientation.

See also

rotateSymbols()

setSymbolAngle(self, angle: float)

Sets the symbol’s angle, in degrees clockwise.

setSymbolLineAngle(self, angle: float)

Sets the line angle modification for the symbol’s angle. This angle is added to the symbol’s rotation and data defined rotation before rendering the symbol, and is used for orienting symbols to match the line’s angle.

Parameters

angle – Angle in degrees, valid values are between 0 and 360

symbolAngle(self) → float

Returns the symbol’s current angle, in degrees clockwise.