QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
Public Types | Public Member Functions | List of all members
QgsLabelLineSettings Class Reference

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). More...

#include <qgslabellinesettings.h>

Public Types

enum class  AnchorClipping : int { UseVisiblePartsOfLine , UseEntireLine }
 Clipping behavior for line anchor calculation. More...
 
enum class  AnchorType : int { HintOnly , Strict }
 Line anchor types. More...
 
enum class  DirectionSymbolPlacement : int { SymbolLeftRight , SymbolAbove , SymbolBelow }
 Placement options for direction symbols. More...
 

Public Member Functions

bool addDirectionSymbol () const
 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. More...
 
AnchorClipping anchorClipping () const
 Returns the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement. More...
 
AnchorType anchorType () const
 Returns the line anchor type, which dictates how the lineAnchorPercent() setting is handled. More...
 
DirectionSymbolPlacement directionSymbolPlacement () const
 Returns the placement for direction symbols. More...
 
QString leftDirectionSymbol () const
 Returns the string to use for left direction arrows. More...
 
double lineAnchorPercent () const
 Returns the percent along the line at which labels should be placed. More...
 
bool mergeLines () const
 Returns true if connected line features with identical label text should be merged prior to generating label positions. More...
 
double overrunDistance () const
 Returns the distance which labels are allowed to overrun past the start or end of line features. More...
 
QgsMapUnitScale overrunDistanceMapUnitScale () const
 Returns the map unit scale for label overrun distance. More...
 
QgsUnitTypes::RenderUnit overrunDistanceUnit () const
 Returns the units for label overrun distance. More...
 
QgsLabeling::LinePlacementFlags placementFlags () const
 Returns the line placement flags, which dictate how line labels can be placed above or below the lines. More...
 
bool reverseDirectionSymbol () const
 Returns true if direction symbols should be reversed. More...
 
QString rightDirectionSymbol () const
 Returns the string to use for right direction arrows. More...
 
void setAddDirectionSymbol (bool enabled)
 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. More...
 
void setAnchorClipping (AnchorClipping clipping)
 Sets the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement. More...
 
void setAnchorType (AnchorType type)
 Sets the line anchor type, which dictates how the lineAnchorPercent() setting is handled. More...
 
void setDirectionSymbolPlacement (DirectionSymbolPlacement placement)
 Sets the placement for direction symbols. More...
 
void setLeftDirectionSymbol (const QString &symbol)
 Sets the string to use for left direction arrows. More...
 
void setLineAnchorPercent (double percent)
 Sets the percent along the line at which labels should be placed. More...
 
void setMergeLines (bool merge)
 Sets whether connected line features with identical label text should be merged prior to generating label positions. More...
 
void setOverrunDistance (double distance)
 Sets the distance which labels are allowed to overrun past the start or end of line features. More...
 
void setOverrunDistanceMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale for label overrun distance. More...
 
void setOverrunDistanceUnit (const QgsUnitTypes::RenderUnit &unit)
 Sets the unit for label overrun distance. More...
 
void setPlacementFlags (QgsLabeling::LinePlacementFlags flags)
 Returns the line placement flags, which dictate how line labels can be placed above or below the lines. More...
 
void setReverseDirectionSymbol (bool reversed)
 Sets whether the direction symbols should be reversed. More...
 
void setRightDirectionSymbol (const QString &symbol)
 Sets the string to use for right direction arrows. More...
 
void updateDataDefinedProperties (const QgsPropertyCollection &properties, QgsExpressionContext &context)
 Updates the thinning settings to respect any data defined properties set within the specified properties collection. More...
 

Detailed Description

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

Since
QGIS 3.16

Definition at line 39 of file qgslabellinesettings.h.

Member Enumeration Documentation

◆ AnchorClipping

Clipping behavior for line anchor calculation.

Since
QGIS 3.20
Enumerator
UseVisiblePartsOfLine 

Only visible parts of lines are considered when calculating the line anchor for labels.

UseEntireLine 

Entire original feature line geometry is used when calculating the line anchor for labels.

Definition at line 67 of file qgslabellinesettings.h.

◆ AnchorType

Line anchor types.

Enumerator
HintOnly 

Line anchor is a hint for preferred placement only, but other placements close to the hint are permitted.

Strict 

Line anchor is a strict placement, and other placements are not permitted.

Definition at line 56 of file qgslabellinesettings.h.

◆ DirectionSymbolPlacement

Placement options for direction symbols.

Enumerator
SymbolLeftRight 

Place direction symbols on left/right of label.

SymbolAbove 

Place direction symbols on above label.

SymbolBelow 

Place direction symbols on below label.

Definition at line 46 of file qgslabellinesettings.h.

Member Function Documentation

◆ addDirectionSymbol()

bool QgsLabelLineSettings::addDirectionSymbol ( ) const
inline

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
setAddDirectionSymbol()
leftDirectionSymbol()
rightDirectionSymbol()
directionSymbolPlacement()
reverseDirectionSymbol()

Definition at line 122 of file qgslabellinesettings.h.

◆ anchorClipping()

AnchorClipping QgsLabelLineSettings::anchorClipping ( ) const
inline

Returns the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement.

See also
setAnchorClipping()
anchorType()
lineAnchorPercent()
Since
QGIS 3.20

Definition at line 313 of file qgslabellinesettings.h.

◆ anchorType()

AnchorType QgsLabelLineSettings::anchorType ( ) const
inline

Returns the line anchor type, which dictates how the lineAnchorPercent() setting is handled.

See also
setAnchorType()
lineAnchorPercent()
anchorClipping()

Definition at line 291 of file qgslabellinesettings.h.

◆ directionSymbolPlacement()

DirectionSymbolPlacement QgsLabelLineSettings::directionSymbolPlacement ( ) const
inline

Returns the placement for direction symbols.

This setting controls whether to place direction symbols to the left/right, above or below label.

See also
setDirectionSymbolPlacement()
addDirectionSymbol()

Definition at line 195 of file qgslabellinesettings.h.

◆ leftDirectionSymbol()

QString QgsLabelLineSettings::leftDirectionSymbol ( ) const
inline

Returns the string to use for left direction arrows.

See also
setLeftDirectionSymbol()
addDirectionSymbol()
rightDirectionSymbol()

Definition at line 144 of file qgslabellinesettings.h.

◆ lineAnchorPercent()

double QgsLabelLineSettings::lineAnchorPercent ( ) const
inline

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
setLineAnchorPercent()
anchorType()
anchorClipping()

Definition at line 267 of file qgslabellinesettings.h.

◆ mergeLines()

bool QgsLabelLineSettings::mergeLines ( ) const
inline

Returns true if connected line features with identical label text should be merged prior to generating label positions.

See also
setMergeLines()

Definition at line 95 of file qgslabellinesettings.h.

◆ overrunDistance()

double QgsLabelLineSettings::overrunDistance ( ) const
inline

Returns the distance which labels are allowed to overrun past the start or end of line features.

See also
setOverrunDistance()
overrunDistanceUnit()
overrunDistanceMapUnitScale()

Definition at line 213 of file qgslabellinesettings.h.

◆ overrunDistanceMapUnitScale()

QgsMapUnitScale QgsLabelLineSettings::overrunDistanceMapUnitScale ( ) const
inline

Returns the map unit scale for label overrun distance.

See also
setOverrunDistanceMapUnitScale()
overrunDistance()
overrunDistanceUnit()

Definition at line 245 of file qgslabellinesettings.h.

◆ overrunDistanceUnit()

QgsUnitTypes::RenderUnit QgsLabelLineSettings::overrunDistanceUnit ( ) const
inline

Returns the units for label overrun distance.

See also
setOverrunDistanceUnit()
overrunDistance()
overrunDistanceMapUnitScale()

Definition at line 229 of file qgslabellinesettings.h.

◆ placementFlags()

QgsLabeling::LinePlacementFlags QgsLabelLineSettings::placementFlags ( ) const
inline

Returns the line placement flags, which dictate how line labels can be placed above or below the lines.

See also
setPlacementFlags()

Definition at line 79 of file qgslabellinesettings.h.

◆ reverseDirectionSymbol()

bool QgsLabelLineSettings::reverseDirectionSymbol ( ) const
inline

Returns true if direction symbols should be reversed.

See also
setReverseDirectionSymbol()

Definition at line 178 of file qgslabellinesettings.h.

◆ rightDirectionSymbol()

QString QgsLabelLineSettings::rightDirectionSymbol ( ) const
inline

Returns the string to use for right direction arrows.

See also
setRightDirectionSymbol()
addDirectionSymbol()
leftDirectionSymbol()

Definition at line 162 of file qgslabellinesettings.h.

◆ setAddDirectionSymbol()

void QgsLabelLineSettings::setAddDirectionSymbol ( bool  enabled)
inline

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
addDirectionSymbol()
setLeftDirectionSymbol()
setRightDirectionSymbol()
setDirectionSymbolPlacement()
setReverseDirectionSymbol()

Definition at line 135 of file qgslabellinesettings.h.

◆ setAnchorClipping()

void QgsLabelLineSettings::setAnchorClipping ( AnchorClipping  clipping)
inline

Sets the line anchor clipping mode, which dictates how line strings are clipped before calculating the line anchor placement.

See also
anchorClipping()
setAnchorType()
setLineAnchorPercent()
Since
QGIS 3.20

Definition at line 325 of file qgslabellinesettings.h.

◆ setAnchorType()

void QgsLabelLineSettings::setAnchorType ( AnchorType  type)
inline

Sets the line anchor type, which dictates how the lineAnchorPercent() setting is handled.

See also
anchorType()
setLineAnchorPercent()
setAnchorClipping()

Definition at line 301 of file qgslabellinesettings.h.

◆ setDirectionSymbolPlacement()

void QgsLabelLineSettings::setDirectionSymbolPlacement ( DirectionSymbolPlacement  placement)
inline

Sets the placement for direction symbols.

This setting controls whether to place direction symbols to the left/right, above or below label.

See also
directionSymbolPlacement()
addDirectionSymbol()

Definition at line 205 of file qgslabellinesettings.h.

◆ setLeftDirectionSymbol()

void QgsLabelLineSettings::setLeftDirectionSymbol ( const QString &  symbol)
inline

Sets the string to use for left direction arrows.

See also
leftDirectionSymbol()
addDirectionSymbol()
rightDirectionSymbol()

Definition at line 153 of file qgslabellinesettings.h.

◆ setLineAnchorPercent()

void QgsLabelLineSettings::setLineAnchorPercent ( double  percent)
inline

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
lineAnchorPercent()
setAnchorType()
setAnchorClipping()

Definition at line 281 of file qgslabellinesettings.h.

◆ setMergeLines()

void QgsLabelLineSettings::setMergeLines ( bool  merge)
inline

Sets whether connected line features with identical label text should be merged prior to generating label positions.

See also
mergeLines()

Definition at line 103 of file qgslabellinesettings.h.

◆ setOverrunDistance()

void QgsLabelLineSettings::setOverrunDistance ( double  distance)
inline

Sets the distance which labels are allowed to overrun past the start or end of line features.

See also
overrunDistance()
overrunDistanceUnit()
overrunDistanceMapUnitScale()

Definition at line 221 of file qgslabellinesettings.h.

◆ setOverrunDistanceMapUnitScale()

void QgsLabelLineSettings::setOverrunDistanceMapUnitScale ( const QgsMapUnitScale scale)
inline

Sets the map unit scale for label overrun distance.

See also
overrunDistanceMapUnitScale()
overrunDistance()
overrunDistanceUnit()

Definition at line 253 of file qgslabellinesettings.h.

◆ setOverrunDistanceUnit()

void QgsLabelLineSettings::setOverrunDistanceUnit ( const QgsUnitTypes::RenderUnit unit)
inline

Sets the unit for label overrun distance.

See also
overrunDistanceUnit()
overrunDistance()
overrunDistanceMapUnitScale()

Definition at line 237 of file qgslabellinesettings.h.

◆ setPlacementFlags()

void QgsLabelLineSettings::setPlacementFlags ( QgsLabeling::LinePlacementFlags  flags)
inline

Returns the line placement flags, which dictate how line labels can be placed above or below the lines.

See also
placementFlags()

Definition at line 87 of file qgslabellinesettings.h.

◆ setReverseDirectionSymbol()

void QgsLabelLineSettings::setReverseDirectionSymbol ( bool  reversed)
inline

Sets whether the direction symbols should be reversed.

See also
reverseDirectionSymbol()

Definition at line 185 of file qgslabellinesettings.h.

◆ setRightDirectionSymbol()

void QgsLabelLineSettings::setRightDirectionSymbol ( const QString &  symbol)
inline

Sets the string to use for right direction arrows.

See also
setLeftDirectionSymbol()
addDirectionSymbol()
rightDirectionSymbol()

Definition at line 171 of file qgslabellinesettings.h.

◆ updateDataDefinedProperties()

void QgsLabelLineSettings::updateDataDefinedProperties ( const QgsPropertyCollection properties,
QgsExpressionContext context 
)

Updates the thinning settings to respect any data defined properties set within the specified properties collection.

Definition at line 23 of file qgslabellinesettings.cpp.


The documentation for this class was generated from the following files: