QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
QgsPalLayerSettings Class Reference

#include <qgspallabeling.h>

Public Types

enum  DirectionSymbols { SymbolLeftRight, SymbolAbove, SymbolBelow }
 
enum  LinePlacementFlags { OnLine = 1, AboveLine = 2, BelowLine = 4, MapOrientation = 8 }
 Line placement flags, which control how candidates are generated for a linear feature. More...
 
enum  MultiLineAlign { MultiLeft = 0, MultiCenter, MultiRight, MultiFollowPlacement }
 
enum  ObstacleType { PolygonInterior, PolygonBoundary, PolygonWhole }
 Valid obstacle types, which affect how features within the layer will act as obstacles for labels. More...
 
enum  OffsetType { FromPoint, FromSymbolBounds }
 Behavior modifier for label offset and distance, only applies in some label placement modes. More...
 
enum  Placement {
  AroundPoint, OverPoint, Line, Curved,
  Horizontal, Free, OrderedPositionsAroundPoint, PerimeterCurved
}
 Placement modes which determine how label candidates are generated for a feature. More...
 
enum  PredefinedPointPosition {
  TopLeft, TopSlightlyLeft, TopMiddle, TopSlightlyRight,
  TopRight, MiddleLeft, MiddleRight, BottomLeft,
  BottomSlightlyLeft, BottomMiddle, BottomSlightlyRight, BottomRight
}
 Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode. More...
 
enum  Property {
  Size = 0, Bold = 1, Italic = 2, Underline = 3,
  Color = 4, Strikeout = 5, Family = 6, FontStyle = 21,
  FontSizeUnit = 22, FontTransp = 18, FontOpacity = 92, FontCase = 27,
  FontLetterSpacing = 28, FontWordSpacing = 29, FontBlendMode = 30, MultiLineWrapChar = 31,
  AutoWrapLength = 101, MultiLineHeight = 32, MultiLineAlignment = 33, DirSymbDraw = 34,
  DirSymbLeft = 35, DirSymbRight = 36, DirSymbPlacement = 37, DirSymbReverse = 38,
  NumFormat = 39, NumDecimals = 40, NumPlusSign = 41, BufferDraw = 42,
  BufferSize = 7, BufferUnit = 43, BufferColor = 8, BufferTransp = 19,
  BufferOpacity = 94, BufferJoinStyle = 44, BufferBlendMode = 45, ShapeDraw = 46,
  ShapeKind = 47, ShapeSVGFile = 48, ShapeSizeType = 49, ShapeSizeX = 50,
  ShapeSizeY = 85, ShapeSizeUnits = 51, ShapeRotationType = 52, ShapeRotation = 53,
  ShapeOffset = 54, ShapeOffsetUnits = 55, ShapeRadii = 56, ShapeRadiiUnits = 57,
  ShapeTransparency = 63, ShapeOpacity = 93, ShapeBlendMode = 64, ShapeFillColor = 58,
  ShapeStrokeColor = 59, ShapeStrokeWidth = 60, ShapeStrokeWidthUnits = 61, ShapeJoinStyle = 62,
  ShadowDraw = 65, ShadowUnder = 66, ShadowOffsetAngle = 67, ShadowOffsetDist = 68,
  ShadowOffsetUnits = 69, ShadowRadius = 70, ShadowRadiusUnits = 71, ShadowTransparency = 72,
  ShadowOpacity = 95, ShadowScale = 73, ShadowColor = 74, ShadowBlendMode = 75,
  CentroidWhole = 76, OffsetQuad = 77, OffsetXY = 78, OffsetUnits = 80,
  LabelDistance = 13, DistanceUnits = 81, OffsetRotation = 82, CurvedCharAngleInOut = 83,
  PositionX = 9, PositionY = 10, Hali = 11, Vali = 12,
  Rotation = 14, LabelRotation = 96, RepeatDistance = 84, RepeatDistanceUnit = 86,
  Priority = 87, PredefinedPositionOrder = 91, LinePlacementOptions = 99, ScaleVisibility = 23,
  MinScale = 16, MinimumScale = 97, MaxScale = 17, MaximumScale = 98,
  FontLimitPixel = 24, FontMinPixel = 25, FontMaxPixel = 26, IsObstacle = 88,
  ObstacleFactor = 89, ZIndex = 90, Show = 15, AlwaysShow = 20
}
 Data definable properties. More...
 
enum  QuadrantPosition {
  QuadrantAboveLeft, QuadrantAbove, QuadrantAboveRight, QuadrantLeft,
  QuadrantOver, QuadrantRight, QuadrantBelowLeft, QuadrantBelow,
  QuadrantBelowRight
}
 
enum  UpsideDownLabels { Upright, ShowDefined, ShowAll }
 

Public Member Functions

 QgsPalLayerSettings ()
 
 QgsPalLayerSettings (const QgsPalLayerSettings &s)
 
 ~QgsPalLayerSettings ()
 
void calculateLabelSize (const QFontMetricsF *fm, QString text, double &labelX, double &labelY, QgsFeature *f=nullptr, QgsRenderContext *context=nullptr)
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the label's property collection, used for data defined overrides. More...
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the label's property collection, used for data defined overrides. More...
 
const QgsTextFormatformat () const
 Returns the label text formatting settings, e.g., font settings, buffer settings, etc. More...
 
QgsExpressiongetLabelExpression ()
 Returns the QgsExpression for this label settings. More...
 
QgsPalLayerSettingsoperator= (const QgsPalLayerSettings &s)
 copy operator - only copies the permanent members More...
 
void readXml (QDomElement &elem, const QgsReadWriteContext &context)
 Read settings from a DOM element. More...
 
void registerFeature (QgsFeature &f, QgsRenderContext &context, QgsLabelFeature **labelFeature=nullptr, QgsGeometry obstacleGeometry=QgsGeometry())
 Register a feature for labeling. More...
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the label's property collection, used for data defined overrides. More...
 
void setFormat (const QgsTextFormat &format)
 Sets the label text formatting settings, e.g., font settings, buffer settings, etc. More...
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context)
 Write settings into a DOM element. More...
 

Static Public Member Functions

static const QgsPropertiesDefinitionpropertyDefinitions ()
 Returns the labeling property definitions. More...
 

Public Attributes

bool addDirectionSymbol
 If true, '<' 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...
 
double angleOffset
 Label rotation, in degrees clockwise. More...
 
int autoWrapLength = 0
 If non-zero, indicates that label text should be automatically wrapped to (ideally) the specified number of characters. More...
 
bool centroidInside
 True if centroid positioned labels must be placed inside their corresponding feature polygon, or false if centroids which fall outside the polygon are permitted. More...
 
bool centroidWhole
 True if feature centroid should be calculated from the whole feature, or false if only the visible part of the feature should be considered. More...
 
QgsCoordinateTransform ct
 
int decimals
 Number of decimal places to show for numeric labels. More...
 
bool displayAll
 If true, all features will be labelled even when overlaps occur. More...
 
double dist
 Distance from feature to the label. More...
 
QgsMapUnitScale distMapUnitScale
 Map unit scale for label feature distance. More...
 
QgsUnitTypes::RenderUnit distUnits
 Units the distance from feature to the label. More...
 
bool drawLabels
 Whether to draw labels for this layer. More...
 
QgsGeometry extentGeom
 
int fieldIndex
 
QString fieldName
 Name of field (or an expression) to use for label text. More...
 
bool fitInPolygonOnly
 True if only labels which completely fit within a polygon are allowed. More...
 
bool fontLimitPixelSize
 True if label sizes should be limited by pixel size. More...
 
int fontMaxPixelSize
 Maximum pixel size for showing rendered map unit labels (1 - 10000). More...
 
int fontMinPixelSize
 Minimum pixel size for showing rendered map unit labels (1 - 1000). More...
 
bool formatNumbers
 Set to true to format numeric label text as numbers (e.g. More...
 
bool isExpression
 True if this label is made from a expression string, e.g., FieldName || 'mm'. More...
 
QgsMapUnitScale labelOffsetMapUnitScale
 Map unit scale for label offset. More...
 
bool labelPerPart
 True if every part of a multi-part feature should be labeled. More...
 
QString leftDirectionSymbol
 String to use for left direction arrows. More...
 
bool limitNumLabels
 True if the number of labels drawn should be limited. More...
 
double maxCurvedCharAngleIn
 Maximum angle between inside curved label characters (valid range 20.0 to 60.0). More...
 
double maxCurvedCharAngleOut
 Maximum angle between outside curved label characters (valid range -20.0 to -95.0) More...
 
double maximumScale
 The maximum map scale (i.e. More...
 
int maxNumLabels
 The maximum number of labels which should be drawn for this layer. More...
 
QgsFeaturemCurFeat = nullptr
 
QgsFields mCurFields
 
bool mergeLines
 True if connected line features with identical label text should be merged prior to generating label positions. More...
 
int mFeatsRegPal = 0
 
int mFeatsSendingToPal = 0
 
int mFeaturesToLabel = 0
 
double minFeatureSize
 Minimum feature size (in millimeters) for a feature to be labelled. More...
 
double minimumScale
 The minimum map scale (i.e. More...
 
MultiLineAlign multilineAlign
 Horizontal alignment of multi-line labels. More...
 
bool obstacle
 True if features for layer are obstacles to labels of other layers. More...
 
double obstacleFactor
 Obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,

1.0 less likely to be covered

More...
 
ObstacleType obstacleType
 Controls how features act as obstacles for labels. More...
 
OffsetType offsetType
 Offset type for layer (only applies in certain placement modes) More...
 
QgsUnitTypes::RenderUnit offsetUnits
 Units for offsets of label. More...
 
DirectionSymbols placeDirectionSymbol
 Placement option for direction symbols. More...
 
Placement placement
 
unsigned int placementFlags
 
bool plusSign
 Whether '+' signs should be prepended to positive numeric labels. More...
 
QVector< PredefinedPointPositionpredefinedPositionOrder
 Ordered list of predefined label positions for points. More...
 
bool preserveRotation
 True if label rotation should be preserved during label pin/unpin operations. More...
 
QColor previewBkgrdColor
 
int priority
 Label priority. More...
 
QgsPointXY ptOne
 
QgsPointXY ptZero
 
QuadrantPosition quadOffset
 Sets the quadrant in which to offset labels from feature. More...
 
double repeatDistance
 Distance for repeating labels for a single feature. More...
 
QgsMapUnitScale repeatDistanceMapUnitScale
 Map unit scale for repeating labels for a single feature. More...
 
QgsUnitTypes::RenderUnit repeatDistanceUnit
 Units for repeating labels for a single feature. More...
 
bool reverseDirectionSymbol
 True if direction symbols should be reversed. More...
 
QString rightDirectionSymbol
 String to use for right direction arrows. More...
 
bool scaleVisibility
 Set to true to limit label visibility to a range of scales. More...
 
QgsStringReplacementCollection substitutions
 Substitution collection for automatic text substitution with labels. More...
 
UpsideDownLabels upsidedownLabels = Upright
 Controls whether upside down labels are displayed and how they are handled. More...
 
bool useMaxLineLengthForAutoWrap = true
 If true, indicates that when auto wrapping label text the autoWrapLength length indicates the maximum ideal length of text lines. More...
 
bool useSubstitutions
 True if substitutions should be applied. More...
 
QString wrapChar
 Wrapping character string. More...
 
const QgsMapToPixelxform = nullptr
 
double xOffset
 Horizontal offset of label. More...
 
double yOffset
 Vertical offset of label. More...
 
double zIndex
 Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-index. More...
 

Friends

class QgsVectorLayer
 

Detailed Description

Definition at line 193 of file qgspallabeling.h.

Member Enumeration Documentation

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 287 of file qgspallabeling.h.

Line placement flags, which control how candidates are generated for a linear feature.

Enumerator
OnLine 

Labels can be placed directly over a line feature.

AboveLine 

Labels can be placed above a line feature.

Unless MapOrientation is also specified this mode respects the direction of the line feature, so a line from right to left labels will have labels placed placed below the line feature.

BelowLine 

Labels can be placed below a line feature.

Unless MapOrientation is also specified this mode respects the direction of the line feature, so a line from right to left labels will have labels placed placed above the line feature.

MapOrientation 

Signifies that the AboveLine and BelowLine flags should respect the map's orientation rather than the feature's orientation.

For example, AboveLine will always result in label's being placed above a line, regardless of the line's direction.

Definition at line 253 of file qgspallabeling.h.

Enumerator
MultiLeft 
MultiCenter 
MultiRight 
MultiFollowPlacement 

Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right alignment

Definition at line 294 of file qgspallabeling.h.

Valid obstacle types, which affect how features within the layer will act as obstacles for labels.

Enumerator
PolygonInterior 

avoid placing labels over interior of polygon (prefer placing labels totally outside or just slightly inside polygon)

PolygonBoundary 

avoid placing labels over boundary of polygon (prefer placing outside or completely inside polygon)

PolygonWhole 

avoid placing labels over ANY part of polygon. Where PolygonInterior will prefer to place labels with the smallest area of intersection between the label and the polygon, PolygonWhole will penalise any label which intersects with the polygon by an equal amount, so that placing labels over any part of the polygon is avoided.

Definition at line 308 of file qgspallabeling.h.

Behavior modifier for label offset and distance, only applies in some label placement modes.

Enumerator
FromPoint 

Offset distance applies from point geometry.

FromSymbolBounds 

Offset distance applies from rendered symbol bounds.

Definition at line 242 of file qgspallabeling.h.

Placement modes which determine how label candidates are generated for a feature.

Enumerator
AroundPoint 

Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygon layers only.

OverPoint 
Line 

Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point. Applies to point or polygon layers only.

Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon's perimeter. Applies to line or polygon layers only.

Curved 
Horizontal 

Arranges candidates following the curvature of a line feature. Applies to line layers only.

Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only.

Free 

Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the polygon's orientation. Applies to polygon layers only.

OrderedPositionsAroundPoint 

Candidates are placed in predefined positions around a point. Preference is given to positions with greatest cartographic appeal, e.g., top right, bottom right, etc. Applies to point layers only.

PerimeterCurved 

Definition at line 207 of file qgspallabeling.h.

Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode.

Enumerator
TopLeft 

Label on top-left of point.

TopSlightlyLeft 
TopMiddle 

Label on top of point, slightly left of center.

Label directly above point

TopSlightlyRight 
TopRight 

Label on top of point, slightly right of center.

Label on top-right of point

MiddleLeft 

Label on left of point.

MiddleRight 

Label on right of point.

BottomLeft 

Label on bottom-left of point.

BottomSlightlyLeft 
BottomMiddle 

Label below point, slightly left of center.

Label directly below point

BottomSlightlyRight 
BottomRight 

Label below point, slightly right of center.

Label on bottom right of point

Definition at line 221 of file qgspallabeling.h.

Data definable properties.

Enumerator
Size 

Label size.

Bold 

Use bold style.

Italic 

Use italic style.

Underline 

Use underline.

Color 

Text color.

Strikeout 

Use strikeout.

Family 

Font family.

FontStyle 

Font style name.

FontSizeUnit 

Font size units.

FontTransp 

Text transparency (deprecated)

FontOpacity 

Text opacity.

FontCase 

Label text case.

FontLetterSpacing 

Letter spacing.

FontWordSpacing 

Word spacing.

FontBlendMode 
MultiLineWrapChar 

Text blend mode.

AutoWrapLength 
MultiLineHeight 
MultiLineAlignment 
DirSymbDraw 
DirSymbLeft 
DirSymbRight 
DirSymbPlacement 
DirSymbReverse 
NumFormat 
NumDecimals 
NumPlusSign 
BufferDraw 
BufferSize 
BufferUnit 
BufferColor 
BufferTransp 

Buffer transparency (deprecated)

BufferOpacity 

Buffer opacity.

BufferJoinStyle 
BufferBlendMode 
ShapeDraw 
ShapeKind 
ShapeSVGFile 
ShapeSizeType 
ShapeSizeX 
ShapeSizeY 
ShapeSizeUnits 
ShapeRotationType 
ShapeRotation 
ShapeOffset 
ShapeOffsetUnits 
ShapeRadii 
ShapeRadiiUnits 
ShapeTransparency 

Shape transparency (deprecated)

ShapeOpacity 

Shape opacity.

ShapeBlendMode 
ShapeFillColor 
ShapeStrokeColor 
ShapeStrokeWidth 
ShapeStrokeWidthUnits 
ShapeJoinStyle 
ShadowDraw 
ShadowUnder 
ShadowOffsetAngle 
ShadowOffsetDist 
ShadowOffsetUnits 
ShadowRadius 
ShadowRadiusUnits 
ShadowTransparency 

Shadow transparency (deprecated)

ShadowOpacity 

Shadow opacity.

ShadowScale 
ShadowColor 
ShadowBlendMode 
CentroidWhole 
OffsetQuad 
OffsetXY 
OffsetUnits 
LabelDistance 
DistanceUnits 
OffsetRotation 
CurvedCharAngleInOut 
PositionX 

X-coordinate data defined label position.

PositionY 

Y-coordinate data defined label position.

Hali 

Horizontal alignment for data defined label position (Left, Center, Right)

Vali 

Vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)

Rotation 

Label rotation (deprecated, for old project compatibility only)

LabelRotation 

Label rotation.

RepeatDistance 
RepeatDistanceUnit 
Priority 
PredefinedPositionOrder 
LinePlacementOptions 

Line placement flags.

ScaleVisibility 
MinScale 

Min scale (deprecated, for old project compatibility only)

MinimumScale 

Minimum map scale (ie most "zoomed out")

MaxScale 

Max scale (deprecated, for old project compatibility only)

MaximumScale 

Maximum map scale (ie most "zoomed in")

FontLimitPixel 
FontMinPixel 
FontMaxPixel 
IsObstacle 
ObstacleFactor 
ZIndex 
Show 
AlwaysShow 

Definition at line 321 of file qgspallabeling.h.

Enumerator
QuadrantAboveLeft 
QuadrantAbove 
QuadrantAboveRight 
QuadrantLeft 
QuadrantOver 
QuadrantRight 
QuadrantBelowLeft 
QuadrantBelow 
QuadrantBelowRight 

Definition at line 267 of file qgspallabeling.h.

Enumerator
Upright 

Upside-down labels (90 <= angle < 270) are shown upright.

ShowDefined 

Show upside down when rotation is layer- or data-defined.

ShowAll 

Show upside down for all labels, including dynamic ones.

Definition at line 280 of file qgspallabeling.h.

Constructor & Destructor Documentation

QgsPalLayerSettings::QgsPalLayerSettings ( )

Definition at line 241 of file qgspallabeling.cpp.

QgsPalLayerSettings::QgsPalLayerSettings ( const QgsPalLayerSettings s)

Definition at line 306 of file qgspallabeling.cpp.

QgsPalLayerSettings::~QgsPalLayerSettings ( )

Definition at line 395 of file qgspallabeling.cpp.

Member Function Documentation

void QgsPalLayerSettings::calculateLabelSize ( const QFontMetricsF *  fm,
QString  text,
double &  labelX,
double &  labelY,
QgsFeature f = nullptr,
QgsRenderContext context = nullptr 
)

Definition at line 1047 of file qgspallabeling.cpp.

QgsPropertyCollection& QgsPalLayerSettings::dataDefinedProperties ( )
inline

Returns a reference to the label's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Since
QGIS 3.0

Definition at line 862 of file qgspallabeling.h.

const QgsPropertyCollection& QgsPalLayerSettings::dataDefinedProperties ( ) const
inline

Returns a reference to the label's property collection, used for data defined overrides.

See also
setDataDefinedProperties()
Property
Note
not available in Python bindings
Since
QGIS 3.0

Definition at line 871 of file qgspallabeling.h.

const QgsTextFormat& QgsPalLayerSettings::format ( ) const
inline

Returns the label text formatting settings, e.g., font settings, buffer settings, etc.

See also
setFormat()
Since
QGIS 3.0

Definition at line 887 of file qgspallabeling.h.

QgsExpression * QgsPalLayerSettings::getLabelExpression ( )

Returns the QgsExpression for this label settings.

May be nullptr if isExpression is false.

Definition at line 409 of file qgspallabeling.cpp.

QgsPalLayerSettings & QgsPalLayerSettings::operator= ( const QgsPalLayerSettings s)

copy operator - only copies the permanent members

Definition at line 313 of file qgspallabeling.cpp.

const QgsPropertiesDefinition & QgsPalLayerSettings::propertyDefinitions ( )
static

Returns the labeling property definitions.

Since
QGIS 3.0

Definition at line 403 of file qgspallabeling.cpp.

void QgsPalLayerSettings::readXml ( QDomElement &  elem,
const QgsReadWriteContext context 
)

Read settings from a DOM element.

Since
QGIS 2.12

Definition at line 739 of file qgspallabeling.cpp.

void QgsPalLayerSettings::registerFeature ( QgsFeature f,
QgsRenderContext context,
QgsLabelFeature **  labelFeature = nullptr,
QgsGeometry  obstacleGeometry = QgsGeometry() 
)

Register a feature for labeling.

Parameters
ffeature to label
contextrender context. The QgsExpressionContext contained within the render context must have already had the feature and fields sets prior to calling this method.
labelFeatureif using QgsLabelingEngine, this will receive the label feature. Not available in Python bindings.
obstacleGeometryoptional obstacle geometry, if a different geometry to the feature's geometry should be used as an obstacle for labels (e.g., if the feature has been rendered with an offset point symbol, the obstacle geometry should represent the bounds of the offset symbol). If not set, the feature's original geometry will be used as an obstacle for labels. Not available in Python bindings.

Definition at line 1195 of file qgspallabeling.cpp.

void QgsPalLayerSettings::setDataDefinedProperties ( const QgsPropertyCollection collection)
inline

Sets the label's property collection, used for data defined overrides.

Parameters
collectionproperty collection. Existing properties will be replaced.
See also
dataDefinedProperties()
Property
Since
QGIS 3.0

Definition at line 880 of file qgspallabeling.h.

void QgsPalLayerSettings::setFormat ( const QgsTextFormat format)
inline

Sets the label text formatting settings, e.g., font settings, buffer settings, etc.

Parameters
formatlabel text format
See also
format()
Since
QGIS 3.0

Definition at line 895 of file qgspallabeling.h.

QDomElement QgsPalLayerSettings::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
)

Write settings into a DOM element.

Since
QGIS 2.12

Definition at line 954 of file qgspallabeling.cpp.

Friends And Related Function Documentation

friend class QgsVectorLayer
friend

Definition at line 913 of file qgspallabeling.h.

Member Data Documentation

bool QgsPalLayerSettings::addDirectionSymbol

If true, '<' 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.

This setting only affects line or perimeter based labels.

See also
leftDirectionSymbol
rightDirectionSymbol
placeDirectionSymbol
reverseDirectionSymbol

Definition at line 526 of file qgspallabeling.h.

double QgsPalLayerSettings::angleOffset

Label rotation, in degrees clockwise.

Definition at line 687 of file qgspallabeling.h.

int QgsPalLayerSettings::autoWrapLength = 0

If non-zero, indicates that label text should be automatically wrapped to (ideally) the specified number of characters.

If zero, auto wrapping is disabled.

See also
useMaxLineLengthForAutoWrap
Since
QGIS 3.4

Definition at line 499 of file qgspallabeling.h.

bool QgsPalLayerSettings::centroidInside

True if centroid positioned labels must be placed inside their corresponding feature polygon, or false if centroids which fall outside the polygon are permitted.

Definition at line 589 of file qgspallabeling.h.

bool QgsPalLayerSettings::centroidWhole

True if feature centroid should be calculated from the whole feature, or false if only the visible part of the feature should be considered.

Definition at line 582 of file qgspallabeling.h.

QgsCoordinateTransform QgsPalLayerSettings::ct

Definition at line 902 of file qgspallabeling.h.

int QgsPalLayerSettings::decimals

Number of decimal places to show for numeric labels.

formatNumbers must be true for this setting to have an effect.

See also
formatNumbers

Definition at line 564 of file qgspallabeling.h.

bool QgsPalLayerSettings::displayAll

If true, all features will be labelled even when overlaps occur.

Definition at line 765 of file qgspallabeling.h.

double QgsPalLayerSettings::dist

Distance from feature to the label.

Units are specified via distUnits.

See also
distUnits
distMapUnitScale

Definition at line 609 of file qgspallabeling.h.

QgsMapUnitScale QgsPalLayerSettings::distMapUnitScale

Map unit scale for label feature distance.

See also
dist
distUnits

Definition at line 623 of file qgspallabeling.h.

QgsUnitTypes::RenderUnit QgsPalLayerSettings::distUnits

Units the distance from feature to the label.

See also
dist
distMapUnitScale

Definition at line 616 of file qgspallabeling.h.

bool QgsPalLayerSettings::drawLabels

Whether to draw labels for this layer.

For some layers it may be desirable to register their features as obstacles for other labels without requiring labels to be drawn for the layer itself. In this case drawLabels can be set to false and obstacle set to true, which will result in the layer acting as an obstacle but having no labels of its own.

Since
QGIS 2.12

Definition at line 455 of file qgspallabeling.h.

QgsGeometry QgsPalLayerSettings::extentGeom

Definition at line 906 of file qgspallabeling.h.

int QgsPalLayerSettings::fieldIndex

Definition at line 900 of file qgspallabeling.h.

QString QgsPalLayerSettings::fieldName

Name of field (or an expression) to use for label text.

If fieldName is an expression, then isExpression should be set to true.

See also
isExpression

Definition at line 464 of file qgspallabeling.h.

bool QgsPalLayerSettings::fitInPolygonOnly

True if only labels which completely fit within a polygon are allowed.

Definition at line 602 of file qgspallabeling.h.

bool QgsPalLayerSettings::fontLimitPixelSize

True if label sizes should be limited by pixel size.

See also
fontMinPixelSize
fontMaxPixelSize

Definition at line 748 of file qgspallabeling.h.

int QgsPalLayerSettings::fontMaxPixelSize

Maximum pixel size for showing rendered map unit labels (1 - 10000).

See also
fontLimitPixelSize
fontMinPixelSize

Definition at line 762 of file qgspallabeling.h.

int QgsPalLayerSettings::fontMinPixelSize

Minimum pixel size for showing rendered map unit labels (1 - 1000).

See also
fontLimitPixelSize
fontMaxPixelSize

Definition at line 755 of file qgspallabeling.h.

bool QgsPalLayerSettings::formatNumbers

Set to true to format numeric label text as numbers (e.g.

inserting thousand separators and fixed number of decimal places).

See also
decimals
plusSign

Definition at line 557 of file qgspallabeling.h.

bool QgsPalLayerSettings::isExpression

True if this label is made from a expression string, e.g., FieldName || 'mm'.

See also
fieldName

Definition at line 470 of file qgspallabeling.h.

QgsMapUnitScale QgsPalLayerSettings::labelOffsetMapUnitScale

Map unit scale for label offset.

See also
xOffset
yOffset
offsetUnits

Definition at line 684 of file qgspallabeling.h.

bool QgsPalLayerSettings::labelPerPart

True if every part of a multi-part feature should be labeled.

If false, only the largest part will be labeled.

Definition at line 774 of file qgspallabeling.h.

QString QgsPalLayerSettings::leftDirectionSymbol

String to use for left direction arrows.

See also
addDirectionSymbol
rightDirectionSymbol

Definition at line 533 of file qgspallabeling.h.

bool QgsPalLayerSettings::limitNumLabels

True if the number of labels drawn should be limited.

See also
maxNumLabels

Definition at line 786 of file qgspallabeling.h.

double QgsPalLayerSettings::maxCurvedCharAngleIn

Maximum angle between inside curved label characters (valid range 20.0 to 60.0).

See also
maxCurvedCharAngleOut

Definition at line 696 of file qgspallabeling.h.

double QgsPalLayerSettings::maxCurvedCharAngleOut

Maximum angle between outside curved label characters (valid range -20.0 to -95.0)

See also
maxCurvedCharAngleIn

Definition at line 702 of file qgspallabeling.h.

double QgsPalLayerSettings::maximumScale

The maximum map scale (i.e.

most "zoomed in" scale) at which the labels will be visible. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

This setting is only considered if scaleVisibility is true.

See also
minimumScale
scaleVisibility

Definition at line 729 of file qgspallabeling.h.

int QgsPalLayerSettings::maxNumLabels

The maximum number of labels which should be drawn for this layer.

This only has an effect if limitNumLabels is true.

See also
limitNumLabels

Definition at line 793 of file qgspallabeling.h.

QgsFeature* QgsPalLayerSettings::mCurFeat = nullptr

Definition at line 898 of file qgspallabeling.h.

QgsFields QgsPalLayerSettings::mCurFields

Definition at line 899 of file qgspallabeling.h.

bool QgsPalLayerSettings::mergeLines

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

Definition at line 780 of file qgspallabeling.h.

int QgsPalLayerSettings::mFeatsRegPal = 0

Definition at line 909 of file qgspallabeling.h.

int QgsPalLayerSettings::mFeatsSendingToPal = 0

Definition at line 908 of file qgspallabeling.h.

int QgsPalLayerSettings::mFeaturesToLabel = 0

Definition at line 907 of file qgspallabeling.h.

double QgsPalLayerSettings::minFeatureSize

Minimum feature size (in millimeters) for a feature to be labelled.

Definition at line 798 of file qgspallabeling.h.

double QgsPalLayerSettings::minimumScale

The minimum map scale (i.e.

most "zoomed out" scale) at which the labels will be visible. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

This setting is only considered if scaleVisibility is true.

See also
maximumScale
scaleVisibility

Definition at line 741 of file qgspallabeling.h.

MultiLineAlign QgsPalLayerSettings::multilineAlign

Horizontal alignment of multi-line labels.

Definition at line 514 of file qgspallabeling.h.

bool QgsPalLayerSettings::obstacle

True if features for layer are obstacles to labels of other layers.

See also
obstacleFactor
obstacleType

Definition at line 805 of file qgspallabeling.h.

double QgsPalLayerSettings::obstacleFactor

Obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels,

1.0 less likely to be covered

See also
obstacle
obstacleType

Definition at line 813 of file qgspallabeling.h.

ObstacleType QgsPalLayerSettings::obstacleType

Controls how features act as obstacles for labels.

See also
obstacle
obstacleFactor

Definition at line 820 of file qgspallabeling.h.

OffsetType QgsPalLayerSettings::offsetType

Offset type for layer (only applies in certain placement modes)

Definition at line 626 of file qgspallabeling.h.

QgsUnitTypes::RenderUnit QgsPalLayerSettings::offsetUnits

Units for offsets of label.

See also
xOffset
yOffset
labelOffsetMapUnitScale

Definition at line 676 of file qgspallabeling.h.

DirectionSymbols QgsPalLayerSettings::placeDirectionSymbol

Placement option for direction symbols.

Controls whether to place symbols to the left/right, above or below label.

See also
addDirectionSymbol

Definition at line 546 of file qgspallabeling.h.

Placement QgsPalLayerSettings::placement

Definition at line 575 of file qgspallabeling.h.

unsigned int QgsPalLayerSettings::placementFlags

Definition at line 576 of file qgspallabeling.h.

bool QgsPalLayerSettings::plusSign

Whether '+' signs should be prepended to positive numeric labels.

formatNumbers must be true for this setting to have an effect.

See also
formatNumbers

Definition at line 571 of file qgspallabeling.h.

QVector< PredefinedPointPosition > QgsPalLayerSettings::predefinedPositionOrder

Ordered list of predefined label positions for points.

Positions earlier in the list will be prioritized over later positions. Only used when the placement is set to QgsPalLayerSettings::OrderedPositionsAroundPoint.

Note
not available in Python bindings

Definition at line 597 of file qgspallabeling.h.

bool QgsPalLayerSettings::preserveRotation

True if label rotation should be preserved during label pin/unpin operations.

Definition at line 690 of file qgspallabeling.h.

QColor QgsPalLayerSettings::previewBkgrdColor

Definition at line 477 of file qgspallabeling.h.

int QgsPalLayerSettings::priority

Label priority.

Valid ranges are from 0 to 10, where 0 = lowest priority and 10 = highest priority.

Definition at line 708 of file qgspallabeling.h.

QgsPointXY QgsPalLayerSettings::ptOne

Definition at line 905 of file qgspallabeling.h.

QgsPointXY QgsPalLayerSettings::ptZero

Definition at line 904 of file qgspallabeling.h.

QuadrantPosition QgsPalLayerSettings::quadOffset

Sets the quadrant in which to offset labels from feature.

Definition at line 652 of file qgspallabeling.h.

double QgsPalLayerSettings::repeatDistance

Distance for repeating labels for a single feature.

See also
repeatDistanceUnit
repeatDistanceMapUnitScale

Definition at line 633 of file qgspallabeling.h.

QgsMapUnitScale QgsPalLayerSettings::repeatDistanceMapUnitScale

Map unit scale for repeating labels for a single feature.

See also
repeatDistance
repeatDistanceUnit

Definition at line 647 of file qgspallabeling.h.

QgsUnitTypes::RenderUnit QgsPalLayerSettings::repeatDistanceUnit

Units for repeating labels for a single feature.

See also
repeatDistance
repeatDistanceMapUnitScale

Definition at line 640 of file qgspallabeling.h.

bool QgsPalLayerSettings::reverseDirectionSymbol

True if direction symbols should be reversed.

Definition at line 549 of file qgspallabeling.h.

QString QgsPalLayerSettings::rightDirectionSymbol

String to use for right direction arrows.

See also
addDirectionSymbol
leftDirectionSymbol

Definition at line 540 of file qgspallabeling.h.

bool QgsPalLayerSettings::scaleVisibility

Set to true to limit label visibility to a range of scales.

See also
maximumScale
minimumScale

Definition at line 717 of file qgspallabeling.h.

QgsStringReplacementCollection QgsPalLayerSettings::substitutions

Substitution collection for automatic text substitution with labels.

Definition at line 480 of file qgspallabeling.h.

UpsideDownLabels QgsPalLayerSettings::upsidedownLabels = Upright

Controls whether upside down labels are displayed and how they are handled.

Definition at line 768 of file qgspallabeling.h.

bool QgsPalLayerSettings::useMaxLineLengthForAutoWrap = true

If true, indicates that when auto wrapping label text the autoWrapLength length indicates the maximum ideal length of text lines.

If false, then autoWrapLength indicates the ideal minimum length of text lines.

If autoWrapLength is 0 then this value has no effect.

See also
autoWrapLength
Since
QGIS 3.4

Definition at line 511 of file qgspallabeling.h.

bool QgsPalLayerSettings::useSubstitutions

True if substitutions should be applied.

Definition at line 482 of file qgspallabeling.h.

QString QgsPalLayerSettings::wrapChar

Wrapping character string.

If set, any occurrences of this string in the calculated label text will be replaced with new line characters.

Definition at line 490 of file qgspallabeling.h.

const QgsMapToPixel* QgsPalLayerSettings::xform = nullptr

Definition at line 901 of file qgspallabeling.h.

double QgsPalLayerSettings::xOffset

Horizontal offset of label.

Units are specified via offsetUnits.

See also
yOffset
offsetUnits
labelOffsetMapUnitScale

Definition at line 660 of file qgspallabeling.h.

double QgsPalLayerSettings::yOffset

Vertical offset of label.

Units are specified via offsetUnits.

See also
xOffset
offsetUnits
labelOffsetMapUnitScale

Definition at line 668 of file qgspallabeling.h.

double QgsPalLayerSettings::zIndex

Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-index.

Definition at line 823 of file qgspallabeling.h.


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