Class: QgsLabelLineSettings¶
Contains settings related to how the label engine places and formats labels for line features (or polygon features which are labeled in a “perimeter” style mode).
Added in version 3.16.
Enums
Clipping behavior for line anchor calculation. |
|
Anchor point of label text. |
|
Line anchor types |
|
Placement options for direction symbols. |
Methods
Returns |
|
Returns the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement. |
|
Returns the line anchor text point, which dictates which part of the label text should be placed at the |
|
Returns the line anchor type, which dictates how the |
|
Returns the placement for direction symbols. |
|
Returns the string to use for left direction arrows. |
|
Returns the percent along the line at which labels should be placed. |
|
Returns |
|
Returns the distance which labels are allowed to overrun past the start or end of line features. |
|
Returns the map unit scale for label overrun distance. |
|
Returns the units for label overrun distance. |
|
Returns the line placement flags, which dictate how line labels can be placed above or below the lines. |
|
Returns |
|
Returns the string to use for right direction arrows. |
|
Sets whether '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be automatically added to the label text, pointing in the direction of the line or polygon ring. |
|
Sets the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement. |
|
Sets the line anchor text point, which dictates which part of the label text should be placed at the |
|
Sets the line anchor type, which dictates how the |
|
Sets the placement for direction symbols. |
|
Sets the string to use for left direction arrows. |
|
Sets the percent along the line at which labels should be placed. |
|
Sets whether connected line features with identical label text should be merged prior to generating label positions. |
|
Sets the distance which labels are allowed to overrun past the start or end of line features. |
|
Sets the map unit scale for label overrun distance. |
|
Sets the unit for label overrun distance. |
|
Returns the line placement flags, which dictate how line labels can be placed above or below the lines. |
|
Sets whether the direction symbols should be reversed. |
|
Sets the string to use for right direction arrows. |
|
Updates the line settings to respect any data defined properties set within the specified properties collection. |
- class qgis.core.QgsLabelLineSettings[source]¶
Bases:
object
- class AnchorClipping(*values)¶
Bases:
IntEnum
Clipping behavior for line anchor calculation.
Added in version 3.20.
UseVisiblePartsOfLine
: Only visible parts of lines are considered when calculating the line anchor for labelsUseEntireLine
: Entire original feature line geometry is used when calculating the line anchor for labels
- UseEntireLine = 1¶
- UseVisiblePartsOfLine = 0¶
- class AnchorTextPoint(*values)¶
Bases:
IntEnum
Anchor point of label text.
Added in version 3.26.
StartOfText
: Anchor using start of textCenterOfText
: Anchor using center of textEndOfText
: Anchor using end of textFollowPlacement
: Automatically set the anchor point based on the lineAnchorPercent() value. Values <25% will use the start of text, values > 75% will use the end of text, and values in between will use the center of the text
- CenterOfText = 1¶
- EndOfText = 2¶
- FollowPlacement = 3¶
- StartOfText = 0¶
- class AnchorType(*values)¶
Bases:
IntEnum
Line anchor types
HintOnly
: Line anchor is a hint for preferred placement only, but other placements close to the hint are permittedStrict
: Line anchor is a strict placement, and other placements are not permitted
- HintOnly = 0¶
- Strict = 1¶
- class DirectionSymbolPlacement(*values)¶
Bases:
IntEnum
Placement options for direction symbols.
SymbolLeftRight
: Place direction symbols on left/right of labelSymbolAbove
: Place direction symbols on above labelSymbolBelow
: Place direction symbols on below label
- SymbolAbove = 1¶
- SymbolBelow = 2¶
- SymbolLeftRight = 0¶
- addDirectionSymbol(self) bool [source]¶
Returns
True
if ‘<’ or ‘>’ (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be automatically added to the label text, pointing in the direction of the line or polygon ring.See also
See also
See also
See also
See also
- Return type:
bool
- anchorClipping(self) QgsLabelLineSettings.AnchorClipping [source]¶
Returns the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement.
See also
See also
See also
Added in version 3.20.
- Return type:
- anchorTextPoint(self) QgsLabelLineSettings.AnchorTextPoint [source]¶
Returns the line anchor text point, which dictates which part of the label text should be placed at the
lineAnchorPercent()
.See also
Added in version 3.26.
- Return type:
- anchorType(self) QgsLabelLineSettings.AnchorType [source]¶
Returns the line anchor type, which dictates how the
lineAnchorPercent()
setting is handled.See also
See also
See also
- Return type:
- directionSymbolPlacement(self) QgsLabelLineSettings.DirectionSymbolPlacement [source]¶
Returns the placement for direction symbols.
This setting controls whether to place direction symbols to the left/right, above or below label.
See also
See also
- Return type:
- leftDirectionSymbol(self) str [source]¶
Returns the string to use for left direction arrows.
See also
See also
See also
- Return type:
str
- lineAnchorPercent(self) float [source]¶
Returns the percent along the line at which labels should be placed.
By default, this is 0.5 which indicates that labels should be placed as close to the center of the line as possible. A value of 0.0 indicates that the labels should be placed as close to the start of the line as possible, while a value of 1.0 pushes labels towards the end of the line.
See also
See also
See also
See also
- Return type:
float
- mergeLines(self) bool [source]¶
Returns
True
if connected line features with identical label text should be merged prior to generating label positions.See also
- Return type:
bool
- overrunDistance(self) float [source]¶
Returns the distance which labels are allowed to overrun past the start or end of line features.
See also
See also
See also
- Return type:
float
- overrunDistanceMapUnitScale(self) QgsMapUnitScale [source]¶
Returns the map unit scale for label overrun distance.
See also
See also
See also
- Return type:
- overrunDistanceUnit(self) Qgis.RenderUnit [source]¶
Returns the units for label overrun distance.
See also
See also
See also
- Return type:
- placementFlags(self) Qgis.LabelLinePlacementFlags [source]¶
Returns the line placement flags, which dictate how line labels can be placed above or below the lines.
See also
- Return type:
- reverseDirectionSymbol(self) bool [source]¶
Returns
True
if direction symbols should be reversed.See also
- Return type:
bool
- rightDirectionSymbol(self) str [source]¶
Returns the string to use for right direction arrows.
See also
See also
See also
- Return type:
str
- setAddDirectionSymbol(self, enabled: bool)[source]¶
Sets whether ‘<’ or ‘>’ (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be automatically added to the label text, pointing in the direction of the line or polygon ring.
See also
See also
See also
See also
See also
- Parameters:
enabled (bool)
- setAnchorClipping(self, clipping: QgsLabelLineSettings.AnchorClipping)[source]¶
Sets the line anchor
clipping
mode, which dictates how line strings are clipped before calculating the line anchor placement.See also
See also
See also
Added in version 3.20.
- Parameters:
clipping (QgsLabelLineSettings.AnchorClipping)
- setAnchorTextPoint(self, point: QgsLabelLineSettings.AnchorTextPoint)[source]¶
Sets the line anchor text
point
, which dictates which part of the label text should be placed at thelineAnchorPercent()
.See also
Added in version 3.26.
- Parameters:
- setAnchorType(self, type: QgsLabelLineSettings.AnchorType)[source]¶
Sets the line anchor
type
, which dictates how thelineAnchorPercent()
setting is handled.See also
See also
See also
- Parameters:
- setDirectionSymbolPlacement(self, placement: QgsLabelLineSettings.DirectionSymbolPlacement)[source]¶
Sets the
placement
for direction symbols.This setting controls whether to place direction symbols to the left/right, above or below label.
See also
See also
- Parameters:
placement (QgsLabelLineSettings.DirectionSymbolPlacement)
- setLeftDirectionSymbol(self, symbol: str | None)[source]¶
Sets the string to use for left direction arrows.
See also
See also
See also
- Parameters:
symbol (Optional[str])
- setLineAnchorPercent(self, percent: float)[source]¶
Sets the
percent
along the line at which labels should be placed.By default, this is 0.5 which indicates that labels should be placed as close to the center of the line as possible. A value of 0.0 indicates that the labels should be placed as close to the start of the line as possible, while a value of 1.0 pushes labels towards the end of the line.
See also
See also
See also
See also
- Parameters:
percent (float)
- setMergeLines(self, merge: bool)[source]¶
Sets whether connected line features with identical label text should be merged prior to generating label positions.
See also
- Parameters:
merge (bool)
- setOverrunDistance(self, distance: float)[source]¶
Sets the
distance
which labels are allowed to overrun past the start or end of line features.See also
See also
See also
- Parameters:
distance (float)
- setOverrunDistanceMapUnitScale(self, scale: QgsMapUnitScale)[source]¶
Sets the map unit
scale
for label overrun distance.See also
See also
See also
- Parameters:
scale (QgsMapUnitScale)
- setOverrunDistanceUnit(self, unit: Qgis.RenderUnit)[source]¶
Sets the
unit
for label overrun distance.See also
See also
See also
- Parameters:
unit (Qgis.RenderUnit)
- setPlacementFlags(self, flags: Qgis.LabelLinePlacementFlags | Qgis.LabelLinePlacementFlag)[source]¶
Returns the line placement
flags
, which dictate how line labels can be placed above or below the lines.See also
- Parameters:
flags (Union[Qgis.LabelLinePlacementFlags, Qgis.LabelLinePlacementFlag])
- setReverseDirectionSymbol(self, reversed: bool)[source]¶
Sets whether the direction symbols should be
reversed
.See also
- Parameters:
reversed (bool)
- setRightDirectionSymbol(self, symbol: str | None)[source]¶
Sets the string to use for right direction arrows.
See also
See also
See also
- Parameters:
symbol (Optional[str])
- updateDataDefinedProperties(self, properties: QgsPropertyCollection, context: QgsExpressionContext)[source]¶
Updates the line settings to respect any data defined properties set within the specified
properties
collection.- Parameters:
properties (QgsPropertyCollection)
context (QgsExpressionContext)