Class: QgsHashedLineSymbolLayer

class qgis.core.QgsHashedLineSymbolLayer

Bases: QgsTemplatedLineSymbolLayerBase

Line symbol layer type which draws repeating line sections along a line feature.

New in version 3.8.

QgsHashedLineSymbolLayer(rotateSymbol: bool = True, interval: float = 3) Constructor for QgsHashedLineSymbolLayer. Creates a line with a default hash symbol, placed at the specified interval (in millimeters).

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

Methods

clone

rtype:

QgsHashedLineSymbolLayer

color

rtype:

QColor

copyDataDefinedProperties

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

copyPaintEffect

Copies paint effect of this layer to another symbol layer

copyTemplateSymbolProperties

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

create

Creates a new QgsHashedLineSymbolLayer, using the settings serialized in the properties map (corresponding to the output from QgsHashedLineSymbolLayer.properties() ).

estimateMaxBleed

param context:

hasDataDefinedProperties

rtype:

bool

hashAngle

Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.

hashLength

Returns the length of hash symbols.

hashLengthMapUnitScale

Returns the map unit scale for the hash length.

hashLengthUnit

Returns the units for the length of hash symbols.

installMasks

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

layerType

rtype:

str

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

renderPolyline

param points:

renderSymbol

param point:

restoreOldDataDefinedProperties

Restores older data defined properties from string map.

setColor

param color:

setCommonProperties

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

setDataDefinedProperty

param key:

setHashAngle

Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.

setHashLength

Sets the length of hash symbols.

setHashLengthMapUnitScale

Sets the map unit scale for the hash length.

setHashLengthUnit

Sets the unit for the length of hash symbols.

setOutputUnit

param unit:

setSubSymbol

param symbol:

setSymbolAngle

param angle:

setSymbolLineAngle

param angle:

setWidth

param width:

shouldRenderUsingSelectionColor

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

startRender

param context:

stopRender

param context:

subSymbol

rtype:

QgsSymbol

symbolAngle

rtype:

float

usedAttributes

param context:

usesMapUnits

rtype:

bool

width

rtype:

float

clone(self) QgsHashedLineSymbolLayer
Return type:

QgsHashedLineSymbolLayer

color(self) QColor
Return type:

QColor

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

copyTemplateSymbolProperties(self, destLayer: QgsTemplatedLineSymbolLayerBase)

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

create(properties: Dict[str, Any] = {}) QgsSymbolLayer

Creates a new QgsHashedLineSymbolLayer, using the settings serialized in the properties map (corresponding to the output from QgsHashedLineSymbolLayer.properties() ).

Parameters:

properties (Dict[str) –

Return type:

QgsSymbolLayer

estimateMaxBleed(self, context: QgsRenderContext) float
Parameters:

context (QgsRenderContext) –

Return type:

float

hasDataDefinedProperties(self) bool
Return type:

bool

hashAngle(self) float

Returns the angle to use when drawing the hashed lines sections, in degrees clockwise.

See also

setHashAngle()

Return type:

float

hashLength(self) float

Returns the length of hash symbols. Units are specified through hashLengthUnits().

See also

setHashLength()

See also

hashLengthUnit()

Return type:

float

hashLengthMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale for the hash length.

See also

hashLengthUnit()

See also

hashLength()

Return type:

QgsMapUnitScale

hashLengthUnit(self) Qgis.RenderUnit

Returns the units for the length of hash symbols.

See also

hashLength()

Return type:

Qgis.RenderUnit

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

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.

renderPolyline(self, points: QPolygonF, context: QgsSymbolRenderContext)
Parameters:
renderSymbol(self, point: QPointF | QPoint, feature: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)
Parameters:
  • point (Union[QPointF) –

  • feature (QgsFeature) –

  • context (QgsRenderContext) –

  • layer (int = -1) –

  • selected (bool = False) –

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

Restores older data defined properties from string map.

setColor(self, color: QColor | Qt.GlobalColor | QGradient)
Parameters:

color (Union[QColor) –

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

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

setDataDefinedProperty(self, key: QgsSymbolLayer.Property, property: QgsProperty)
Parameters:
setHashAngle(self, angle: float)

Sets the angle to use when drawing the hashed lines sections, in degrees clockwise.

See also

hashAngle()

Parameters:

angle (float) –

setHashLength(self, length: float)

Sets the length of hash symbols. Units are specified through setHashLengthUnit()

See also

hashLength()

Parameters:

length (float) –

setHashLengthMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale for the hash length.

See also

setHashLength()

Parameters:

scale (QgsMapUnitScale) –

setHashLengthUnit(self, unit: Qgis.RenderUnit)

Sets the unit for the length of hash symbols.

See also

hashLengthUnit()

See also

setHashLength()

Parameters:

unit (Qgis.RenderUnit) –

setOutputUnit(self, unit: Qgis.RenderUnit)
Parameters:

unit (Qgis.RenderUnit) –

setSubSymbol(self, symbol: QgsSymbol) bool
Parameters:

symbol (QgsSymbol) –

Return type:

bool

setSymbolAngle(self, angle: float)
Parameters:

angle (float) –

setSymbolLineAngle(self, angle: float)
Parameters:

angle (float) –

setWidth(self, width: float)
Parameters:

width (float) –

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

subSymbol(self) QgsSymbol
Return type:

QgsSymbol

symbolAngle(self) float
Return type:

float

usedAttributes(self, context: QgsRenderContext) Set[str]
Parameters:

context (QgsRenderContext) –

Return type:

Set[str]

usesMapUnits(self) bool
Return type:

bool

width(self) float
width(self, context: QgsRenderContext) float
Return type:

float