Class: QgsTemplatedLineSymbolLayerBase¶
- class qgis.core.QgsTemplatedLineSymbolLayerBase¶
Bases:
QgsLineSymbolLayer
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.
QgsTemplatedLineSymbolLayerBase(rotateSymbol: bool = True, interval: float = 3) Constructor for
QgsTemplatedLineSymbolLayerBase
. Creates a template line placed at the specifiedinterval
(in millimeters).The
rotateSymbol
argument specifies whether individual symbols should be rotated to match the line segment alignment.Enums
alias of
MarkerLinePlacement
Methods
Returns the length of line over which the line's direction is averaged when calculating individual symbol angles.
Returns the map unit scale for the length over which the line's direction is averaged when calculating individual symbol angles.
Returns the unit for the length over which the line's direction is averaged when calculating individual symbol angles.
- rtype:
bool
Copies all data defined properties of this layer to another symbol layer.
Copies paint effect of this layer to another symbol layer
Copies all common properties of this layer to another templated symbol layer.
When rendering, install masks on
context
painter ifrecursive
isTrue
masks are installed recursively for all children symbol layersReturns the interval between individual symbols.
Returns the map unit scale for the interval between symbols.
Returns the units for the interval between symbols.
- rtype:
QgsMapUnitScale
Returns the offset along the line for the symbol placement.
Returns the map unit scale used for calculating the offset in map units along line for symbols.
Returns the unit used for calculating the offset along line for symbols.
- rtype:
Qgis.RenderUnit
Returns
True
if the placement applies for every part of multi-part feature geometries.Returns the placement of the symbols.
Returns the placement of the symbols.
- rtype:
Dict[str, Any]
When rendering, remove previously installed masks from
context
painter ifrecursive
isTrue
masks are removed recursively for all children symbol layers- param points:
- param points:
Renders the templated symbol at the specified
point
, using the given rendercontext
.Restores older data defined properties from string map.
Returns
True
if the repeating symbols be rotated to match their line segment orientation.Sets the
length
of line over which the line's direction is averaged when calculating individual symbol angles.Sets the map unit
scale
for the length over which the line's direction is averaged when calculating individual symbol angles.Sets the
unit
for the length over which the line's direction is averaged when calculating individual symbol angles.Sets all common symbol properties in the
destLayer
, using the settings serialized in theproperties
map.Sets the interval between individual symbols.
Sets the map unit
scale
for the interval between symbols.Sets the units for the interval between symbols.
- param scale:
Sets the the offset along the line for the symbol placement.
Sets the map unit
scale
used for calculating the offset in map units along line for symbols.Sets the unit used for calculating the offset along line for symbols.
- param unit:
Sets whether the placement applies for every part of multi-part feature geometries.
Sets the
placement
of the symbols.Sets the
placement
of the symbols.Sets whether the repeating symbols should be rotated to match their line segment orientation.
Sets the symbol's
angle
, in degrees clockwise.Sets the line
angle
modification for the symbol's angle.- param feature:
- param feature:
Returns the symbol's current angle, in degrees clockwise.
- Placement¶
alias of
MarkerLinePlacement
- 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()
See also
See also
See also
- Return type:
float
- averageAngleMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the length over which the line’s direction is averaged when calculating individual symbol angles.
See also
See also
See also
- Return type:
- averageAngleUnit(self) Qgis.RenderUnit ¶
Returns the unit for the length over which the line’s direction is averaged when calculating individual symbol angles.
See also
See also
See also
- Return type:
- canCauseArtifactsBetweenAdjacentTiles(self) bool ¶
- Return type:
bool
- 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
New in version 2.9.
- copyTemplateSymbolProperties(self, destLayer: QgsTemplatedLineSymbolLayerBase)¶
Copies all common properties of this layer to another templated symbol layer.
- Parameters:
destLayer (QgsTemplatedLineSymbolLayerBase) –
- installMasks(self, context: QgsRenderContext, recursive: bool)¶
When rendering, install masks on
context
painter ifrecursive
isTrue
masks are installed recursively for all children symbol layersSee also
prepareMasks()
See also
New in version 3.30.
- interval(self) float ¶
Returns the interval between individual symbols. Units are specified through
intervalUnits()
.See also
See also
- Return type:
float
- intervalMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the interval between symbols.
See also
See also
See also
- Return type:
- intervalUnit(self) Qgis.RenderUnit ¶
Returns the units for the interval between symbols.
See also
See also
- Return type:
- mapUnitScale(self) QgsMapUnitScale ¶
- Return type:
- 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.
- Return type:
float
- Returns:
The offset along the line. The unit for the offset is retrievable via offsetAlongLineUnit.
See also
See also
See also
- offsetAlongLineMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale used for calculating the offset in map units along line for symbols.
See also
- Return type:
- offsetAlongLineUnit(self) Qgis.RenderUnit ¶
Returns the unit used for calculating the offset along line for symbols.
- Return type:
- Returns:
Offset along line unit type.
See also
See also
- outputUnit(self) Qgis.RenderUnit ¶
- Return type:
- placeOnEveryPart(self) bool ¶
Returns
True
if the placement applies for every part of multi-part feature geometries.The default is
True
, which means thatQgis
.MarkerLinePlacement.FirstVertex orQgis
.MarkerLinePlacement.LastVertex placements will result in a symbol on the first/last vertex of EVERY part of a multipart feature.If
False
, thenQgis
.MarkerLinePlacement.FirstVertex orQgis
.MarkerLinePlacement.LastVertex placements will result in a symbol on the first/last vertex of the overall multipart geometry only.See also
New in version 3.24.
- Return type:
bool
- placement(self) Qgis.MarkerLinePlacement ¶
Returns the placement of the symbols.
See also
Deprecated since version use:
placements()
instead- Return type:
- placements(self) Qgis.MarkerLinePlacements ¶
Returns the placement of the symbols.
See also
New in version 3.24.
- Return type:
- 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 ifrecursive
isTrue
masks are removed recursively for all children symbol layersSee also
prepareMasks()
See also
New in version 3.30.
- renderPolygonStroke(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)¶
- Parameters:
points (QPolygonF) –
rings (Iterable[QPolygonF]) –
context (QgsSymbolRenderContext) –
- renderPolyline(self, points: QPolygonF, context: QgsSymbolRenderContext)¶
- Parameters:
points (QPolygonF) –
context (QgsSymbolRenderContext) –
- renderSymbol(self, point: QPointF | QPoint, feature: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)¶
Renders the templated symbol at the specified
point
, using the given rendercontext
.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. Alayer
of -1 indicates that all symbol layers should be rendered.If
selected
isTrue
then the symbol will be drawn using the “selected feature” style and colors instead of the symbol’s normal style.- 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.
New in version 3.0.
- rotateSymbols(self) bool ¶
Returns
True
if the repeating symbols be rotated to match their line segment orientation.See also
- Return type:
bool
- 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()
See also
See also
See also
- Parameters:
length (float) –
- 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.See also
See also
See also
- Parameters:
scale (QgsMapUnitScale) –
- setAverageAngleUnit(self, unit: Qgis.RenderUnit)¶
Sets the
unit
for the length over which the line’s direction is averaged when calculating individual symbol angles.See also
See also
See also
- Parameters:
unit (Qgis.RenderUnit) –
- setCommonProperties(destLayer: QgsTemplatedLineSymbolLayerBase, properties: Dict[str, Any])¶
Sets all common symbol properties in the
destLayer
, using the settings serialized in theproperties
map.- Parameters:
destLayer (QgsTemplatedLineSymbolLayerBase) –
properties (Dict[str) –
- setInterval(self, interval: float)¶
Sets the interval between individual symbols.
- Parameters:
interval (float) – interval size. Units are specified through
setIntervalUnit()
See also
See also
- setIntervalMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the interval between symbols.See also
See also
See also
- Parameters:
scale (QgsMapUnitScale) –
- setIntervalUnit(self, unit: Qgis.RenderUnit)¶
Sets the units for the interval between symbols.
- Parameters:
unit (Qgis.RenderUnit) – interval units
See also
See also
- setMapUnitScale(self, scale: QgsMapUnitScale)¶
- Parameters:
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 (float) – Distance to offset markers along the line. The offset unit is set via setOffsetAlongLineUnit.
See also
See also
See also
- setOffsetAlongLineMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
used for calculating the offset in map units along line for symbols.See also
- Parameters:
scale (QgsMapUnitScale) –
- setOffsetAlongLineUnit(self, unit: Qgis.RenderUnit)¶
Sets the unit used for calculating the offset along line for symbols.
- Parameters:
unit (Qgis.RenderUnit) – Offset along line unit type.
See also
See also
- setOutputUnit(self, unit: Qgis.RenderUnit)¶
- Parameters:
unit (Qgis.RenderUnit) –
- setPlaceOnEveryPart(self, respect: bool)¶
Sets whether the placement applies for every part of multi-part feature geometries.
The default is
True
, which means thatQgis
.MarkerLinePlacement.FirstVertex orQgis
.MarkerLinePlacement.LastVertex placements will result in a symbol on the first/last vertex of EVERY part of a multipart feature.If
False
, thenQgis
.MarkerLinePlacement.FirstVertex orQgis
.MarkerLinePlacement.LastVertex placements will result in a symbol on the first/last vertex of the overall multipart geometry only.See also
New in version 3.24.
- Parameters:
respect (bool) –
- setPlacement(self, placement: Qgis.MarkerLinePlacement)¶
Sets the
placement
of the symbols.See also
Deprecated since version use:
setPlacements()
instead- Parameters:
placement (Qgis.MarkerLinePlacement) –
- setPlacements(self, placements: Qgis.MarkerLinePlacements | Qgis.MarkerLinePlacement)¶
Sets the
placement
of the symbols.See also
New in version 3.24.
- Parameters:
placements (Union[Qgis.MarkerLinePlacements) –
- setRotateSymbols(self, rotate: bool)¶
Sets whether the repeating symbols should be rotated to match their line segment orientation.
See also
- Parameters:
rotate (bool) –
- setSymbolAngle(self, angle: float)¶
Sets the symbol’s
angle
, in degrees clockwise.- Parameters:
angle (float) –
- 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 (float) – Angle in degrees, valid values are between 0 and 360
- startFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)¶
- Parameters:
feature (QgsFeature) –
context (QgsRenderContext) –
- stopFeatureRender(self, feature: QgsFeature, context: QgsRenderContext)¶
- Parameters:
feature (QgsFeature) –
context (QgsRenderContext) –
- symbolAngle(self) float ¶
Returns the symbol’s current angle, in degrees clockwise.
- Return type:
float