QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgspallabeling.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspallabeling.h
3  Smart labeling for vector layers
4  -------------------
5  begin : June 2009
6  copyright : (C) Martin Dobias
7  email : wonder dot sk at gmail dot com
8 
9  ***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 //Note: although this file is in the core library, it is not part of the stable API
19 //and might change at any time!
20 
21 #ifndef QGSPALLABELING_H
22 #define QGSPALLABELING_H
23 
24 #include "qgis_core.h"
25 #include "qgis_sip.h"
26 #include "qgis.h"
27 #include <QString>
28 #include <QFont>
29 #include <QFontDatabase>
30 #include <QColor>
31 #include <QHash>
32 #include <QList>
33 #include <QPainter>
34 #include <QRectF>
35 #include <QMap>
36 #include "qgsfeature.h"
37 #include "qgsgeometry.h"
38 #include "qgsfields.h"
40 #include "qgspointxy.h"
41 #include "qgsmapunitscale.h"
42 #include "qgsstringutils.h"
43 #include "qgstextrenderer.h"
44 #include "qgspropertycollection.h"
45 
46 namespace pal SIP_SKIP
47 {
48  class Pal;
49  class Layer;
50  class LabelPosition;
51 }
52 
54 class QgsRectangle;
55 class QgsMapToPixel;
56 class QgsFeature;
58 class QgsVectorLayer;
59 class QgsExpression;
60 class QFontMetricsF;
61 class QPainter;
62 class QPicture;
63 class QgsGeometry;
65 class QgsLabelSearchTree;
66 class QgsMapSettings;
67 class QgsLabelFeature;
68 class QgsLabelingEngine;
71 class QgsDxfExport;
74 
75 
80 class CORE_EXPORT QgsLabelPosition
81 {
82  public:
83 
101  QgsLabelPosition( QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram = false, bool pinned = false, const QString &providerId = QString(),
102  const QgsGeometry &labelGeometry = QgsGeometry() )
103  : featureId( id )
104  , rotation( r )
105  , cornerPoints( corners )
106  , labelRect( rect )
107  , labelGeometry( labelGeometry )
108  , width( w )
109  , height( h )
110  , layerID( layer )
111  , labelText( labeltext )
112  , labelFont( labelfont )
113  , upsideDown( upside_down )
114  , isDiagram( diagram )
115  , isPinned( pinned )
116  , providerID( providerId )
117  {}
118 
120  QgsLabelPosition() = default;
121 
125  QgsFeatureId featureId = FID_NULL;
126 
130  double rotation = 0;
131 
132  QVector< QgsPointXY > cornerPoints;
134 
140 
144  double width = 0;
145 
149  double height = 0;
150 
154  QString layerID;
155 
159  QString labelText;
160 
164  QFont labelFont;
165 
169  bool upsideDown = false;
170 
174  bool isDiagram = false;
175 
179  bool isPinned = false;
180 
185  QString providerID;
186 };
187 
188 
193 class CORE_EXPORT QgsPalLayerSettings
194 {
195  public:
199 
201  QgsPalLayerSettings &operator=( const QgsPalLayerSettings &s );
202 
206  //TODO QGIS 3.0 - move to QgsLabelingEngine
208  {
217  };
218 
220  //TODO QGIS 3.0 - move to QgsLabelingEngine
222  {
235  };
236 
241  //TODO QGIS 3.0 - move to QgsLabelingEngine
243  {
246  };
247 
251  //TODO QGIS 3.0 - move to QgsLabelingEngine, rename to LinePlacementFlag, use Q_DECLARE_FLAGS to make
252  //LinePlacementFlags type, and replace use of pal::LineArrangementFlag
254  {
255  OnLine = 1,
256  AboveLine = 2,
259  BelowLine = 4,
262  MapOrientation = 8,
265  };
266 
268  {
278  };
279 
281  {
284  ShowAll
285  };
286 
288  {
291  SymbolBelow
292  };
293 
295  {
296  MultiLeft = 0,
299  MultiFollowPlacement
301  };
302 
307  //TODO QGIS 3.0 - Move to QgsLabelingEngine
309  {
310  PolygonInterior,
312  PolygonBoundary,
314  PolygonWhole
318  };
319 
321  enum Property
322  {
323  // text style
324  Size = 0,
325  Bold = 1,
326  Italic = 2,
327  Underline = 3,
328  Color = 4,
329  Strikeout = 5,
330  Family = 6,
331  FontStyle = 21,
332  FontSizeUnit = 22,
333  FontTransp = 18,
334  FontOpacity = 92,
335  FontCase = 27,
336  FontLetterSpacing = 28,
337  FontWordSpacing = 29,
338  FontBlendMode = 30,
339 
340  // text formatting
341  MultiLineWrapChar = 31,
342  AutoWrapLength = 101,
343  MultiLineHeight = 32,
344  MultiLineAlignment = 33,
345  DirSymbDraw = 34,
346  DirSymbLeft = 35,
347  DirSymbRight = 36,
348  DirSymbPlacement = 37,
349  DirSymbReverse = 38,
350  NumFormat = 39,
351  NumDecimals = 40,
352  NumPlusSign = 41,
353 
354  // text buffer
355  BufferDraw = 42,
356  BufferSize = 7,
357  BufferUnit = 43,
358  BufferColor = 8,
359  BufferTransp = 19,
360  BufferOpacity = 94,
361  BufferJoinStyle = 44,
362  BufferBlendMode = 45,
363 
364  // background
365  ShapeDraw = 46,
366  ShapeKind = 47,
367  ShapeSVGFile = 48,
368  ShapeSizeType = 49,
369  ShapeSizeX = 50,
370  ShapeSizeY = 85,
371  ShapeSizeUnits = 51,
372  ShapeRotationType = 52,
373  ShapeRotation = 53,
374  ShapeOffset = 54,
375  ShapeOffsetUnits = 55,
376  ShapeRadii = 56,
377  ShapeRadiiUnits = 57,
378  ShapeTransparency = 63,
379  ShapeOpacity = 93,
380  ShapeBlendMode = 64,
381  ShapeFillColor = 58,
382  ShapeStrokeColor = 59,
383  ShapeStrokeWidth = 60,
384  ShapeStrokeWidthUnits = 61,
385  ShapeJoinStyle = 62,
386 
387  // drop shadow
388  ShadowDraw = 65,
389  ShadowUnder = 66,
390  ShadowOffsetAngle = 67,
391  ShadowOffsetDist = 68,
392  ShadowOffsetUnits = 69,
393  ShadowRadius = 70,
394  ShadowRadiusUnits = 71,
395  ShadowTransparency = 72,
396  ShadowOpacity = 95,
397  ShadowScale = 73,
398  ShadowColor = 74,
399  ShadowBlendMode = 75,
400 
401  // placement
402  CentroidWhole = 76,
403  OffsetQuad = 77,
404  OffsetXY = 78,
405  OffsetUnits = 80,
406  LabelDistance = 13,
407  DistanceUnits = 81,
408  OffsetRotation = 82,
409  CurvedCharAngleInOut = 83,
410  // (data defined only)
411  PositionX = 9,
412  PositionY = 10,
413  Hali = 11,
414  Vali = 12,
415  Rotation = 14,
416  LabelRotation = 96,
417  RepeatDistance = 84,
418  RepeatDistanceUnit = 86,
419  Priority = 87,
420  PredefinedPositionOrder = 91,
421  LinePlacementOptions = 99,
422 
423  // rendering
424  ScaleVisibility = 23,
425  MinScale = 16,
426  MinimumScale = 97,
427  MaxScale = 17,
428  MaximumScale = 98,
429  FontLimitPixel = 24,
430  FontMinPixel = 25,
431  FontMaxPixel = 26,
432  IsObstacle = 88,
433  ObstacleFactor = 89,
434  ZIndex = 90,
435 
436  // (data defined only)
437  Show = 15,
438  AlwaysShow = 20
439  };
440 
445  static const QgsPropertiesDefinition &propertyDefinitions();
446 
456 
457  //-- text style
458 
464  QString fieldName;
465 
471 
475  QgsExpression *getLabelExpression();
476 
478 
483 
484  //-- text formatting
485 
490  QString wrapChar;
491 
499  int autoWrapLength = 0;
500 
511  bool useMaxLineLengthForAutoWrap = true;
512 
515 
527 
534 
541 
547 
550 
558 
564  int decimals;
565 
571  bool plusSign;
572 
573  //-- placement
574 
576  unsigned int placementFlags;
577 
583 
590 
597  QVector< PredefinedPointPosition > predefinedPositionOrder SIP_SKIP;
598 
603 
609  double dist;
610 
617 
624 
627 
634 
641 
648 
653 
660  double xOffset;
661 
668  double yOffset;
669 
677 
685 
687  double angleOffset;
688 
691 
697 
703 
708  int priority;
709 
710  //-- rendering
711 
718 
729  double maximumScale;
730 
741  double minimumScale;
742 
749 
756 
763 
766 
768  UpsideDownLabels upsidedownLabels = Upright;
769 
775 
781 
787 
794 
799 
805  bool obstacle;
806 
814 
821 
823  double zIndex;
824 
825  // called from register feature hook
826  void calculateLabelSize( const QFontMetricsF *fm, QString text, double &labelX, double &labelY, QgsFeature *f = nullptr, QgsRenderContext *context = nullptr );
827 
841  void registerFeature( QgsFeature &f, QgsRenderContext &context,
842  QgsLabelFeature **labelFeature SIP_PYARGREMOVE = nullptr,
843  QgsGeometry obstacleGeometry SIP_PYARGREMOVE = QgsGeometry() );
844 
849  void readXml( QDomElement &elem, const QgsReadWriteContext &context );
850 
855  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context );
856 
862  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
863 
871  const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
872 
880  void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
881 
887  const QgsTextFormat &format() const { return mFormat; }
888 
895  void setFormat( const QgsTextFormat &format ) { mFormat = format; }
896 
897  // temporary stuff: set when layer gets prepared or labeled
898  QgsFeature *mCurFeat = nullptr;
901  const QgsMapToPixel *xform = nullptr;
903 
907  int mFeaturesToLabel = 0; // total features that will probably be labeled, may be less (figured before PAL)
908  int mFeatsSendingToPal = 0; // total features tested for sending into PAL (relative to maxNumLabels)
909  int mFeatsRegPal = 0; // number of features registered in PAL, when using limitNumLabels
910 
911  private:
912 
913  friend class QgsVectorLayer; // to allow calling readFromLayerCustomProperties()
914 
919  void readFromLayerCustomProperties( QgsVectorLayer *layer );
920 
924  void readOldDataDefinedPropertyMap( QgsVectorLayer *layer, QDomElement *parentElem );
925 
929  void readOldDataDefinedProperty( QgsVectorLayer *layer, QgsPalLayerSettings::Property p );
930 
931  enum DataDefinedValueType
932  {
933  DDBool,
934  DDInt,
935  DDIntPos,
936  DDDouble,
937  DDDoublePos,
938  DDRotation180,
939  DDOpacity,
940  DDString,
941  DDUnits,
942  DDColor,
943  DDJoinStyle,
944  DDBlendMode,
945  DDPointF,
946  DDSizeF,
947  };
948 
949  // convenience data defined evaluation function
950  bool dataDefinedValEval( DataDefinedValueType valType,
952  QVariant &exprVal, QgsExpressionContext &context, const QVariant &originalValue = QVariant() );
953 
954  void parseTextStyle( QFont &labelFont,
955  QgsUnitTypes::RenderUnit fontunits,
956  QgsRenderContext &context );
957 
958  void parseTextBuffer( QgsRenderContext &context );
959 
960  void parseTextFormatting( QgsRenderContext &context );
961 
962  void parseShapeBackground( QgsRenderContext &context );
963 
964  void parseDropShadow( QgsRenderContext &context );
965 
969  bool checkMinimumSizeMM( const QgsRenderContext &ct, const QgsGeometry &geom, double minSize ) const;
970 
974  void registerObstacleFeature( QgsFeature &f, QgsRenderContext &context, QgsLabelFeature **obstacleFeature, const QgsGeometry &obstacleGeometry = QgsGeometry() );
975 
976  QMap<Property, QVariant> dataDefinedValues;
977 
979  QgsPropertyCollection mDataDefinedProperties;
980 
981  QgsExpression *expression = nullptr;
982 
983  QFontDatabase mFontDB;
984 
985  QgsTextFormat mFormat;
986 
987  static const QVector< PredefinedPointPosition > DEFAULT_PLACEMENT_ORDER;
988 
989  static void initPropertyDefinitions();
990 
992  static QgsPropertiesDefinition sPropertyDefinitions;
993 
994 };
995 
999 class CORE_EXPORT QgsLabelCandidate
1000 {
1001  public:
1002  QgsLabelCandidate( const QRectF &r, double c ): rect( r ), cost( c ) {}
1003 
1004  QRectF rect;
1005  double cost;
1006 };
1007 
1008 
1009 
1010 
1016 class CORE_EXPORT QgsLabelingResults
1017 {
1018  public:
1020  ~QgsLabelingResults();
1021 
1023  QgsLabelingResults( const QgsLabelingResults & ) = delete;
1025  QgsLabelingResults &operator=( const QgsLabelingResults &rh ) = delete;
1026 
1028  QList<QgsLabelPosition> labelsAtPosition( const QgsPointXY &p ) const;
1030  QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle &r ) const;
1031 
1036  void setMapSettings( const QgsMapSettings &settings );
1037 
1038  private:
1039 #ifdef SIP_RUN
1041 #endif
1042 
1043  std::unique_ptr< QgsLabelSearchTree > mLabelSearchTree;
1044 
1045  friend class QgsPalLabeling;
1048 };
1049 
1054 class CORE_EXPORT QgsPalLabeling
1055 {
1056  public:
1057 
1062  static bool staticWillUseLayer( QgsVectorLayer *layer );
1063 
1065  static void drawLabelCandidateRect( pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform, QList<QgsLabelCandidate> *candidates = nullptr ) SIP_SKIP;
1066 
1077  static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) SIP_FACTORY;
1078 
1089  static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
1090 
1103  static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
1104 
1113  static QStringList splitToGraphemes( const QString &text );
1114 
1115  private:
1117  static void dataDefinedTextStyle( QgsPalLayerSettings &tmpLyr,
1118  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1119 
1121  static void dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr,
1122  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1123 
1125  static void dataDefinedTextBuffer( QgsPalLayerSettings &tmpLyr,
1126  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1127 
1129  static void dataDefinedShapeBackground( QgsPalLayerSettings &tmpLyr,
1130  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1131 
1133  static void dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr,
1134  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1135 
1136  friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
1137  friend class QgsDxfExport; // to allow calling the static methods above
1138 
1147  static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry &geom, double minSize );
1148 
1149  friend class QgsPalLayerSettings;
1150 };
1151 
1152 #endif // QGSPALLABELING_H
Label below point, slightly right of center.
QgsRectangle labelRect
Class for parsing and evaluation of expressions (formerly called "search strings").
double xOffset
Horizontal offset of label.
The class is used as a container of context for various read/write operations on other objects...
QString labelText
String shown in label.
A rectangle specified with double values.
Definition: qgsrectangle.h:40
Label on bottom-left of point.
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0) ...
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the label&#39;s property collection, used for data defined overrides.
double maximumScale
The maximum map scale (i.e.
QString leftDirectionSymbol
String to use for left direction arrows.
QgsUnitTypes::RenderUnit repeatDistanceUnit
Units for repeating labels for a single feature.
double angleOffset
Label rotation, in degrees clockwise.
bool formatNumbers
Set to true to format numeric label text as numbers (e.g.
A class to query the labeling structure at a given point (small wrapper around pal RTree class) ...
double obstacleFactor
Obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels, 1.0 less likely to be covered
Label on top-left of point.
QgsLabelCandidate(const QRectF &r, double c)
#define FID_NULL
Definition: qgsfeatureid.h:26
PredefinedPointPosition
Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode...
A class to represent a 2D point.
Definition: qgspointxy.h:43
QString layerID
ID of associated map layer.
bool obstacle
True if features for layer are obstacles to labels of other layers.
int decimals
Number of decimal places to show for numeric labels.
double repeatDistance
Distance for repeating labels for a single feature.
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
qint64 QgsFeatureId
Definition: qgsfeatureid.h:25
QuadrantPosition quadOffset
Sets the quadrant in which to offset labels from feature.
QgsUnitTypes::RenderUnit offsetUnits
Units for offsets of label.
double yOffset
Vertical offset of label.
Class that adds extra information to QgsLabelFeature for text labels.
Container of fields for a vector layer.
Definition: qgsfields.h:42
Label on top of point, slightly right of center.
bool addDirectionSymbol
If true, &#39;<&#39; or &#39;>&#39; (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be ...
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:106
bool drawLabels
Whether to draw labels for this layer.
bool mergeLines
True if connected line features with identical label text should be merged prior to generating label ...
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
MultiLineAlign multilineAlign
Horizontal alignment of multi-line labels.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
QgsGeometry labelGeometry
A polygon geometry representing the label&#39;s bounds in map coordinates.
double maxCurvedCharAngleIn
Maximum angle between inside curved label characters (valid range 20.0 to 60.0).
QgsCoordinateTransform ct
bool reverseDirectionSymbol
True if direction symbols should be reversed.
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
double zIndex
Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-ind...
QgsStringReplacementCollection substitutions
Substitution collection for automatic text substitution with labels.
Arranges candidates following the curvature of a line feature. Applies to line layers only...
The QgsMapSettings class contains configuration for rendering of the map.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Place direction symbols on left/right of label.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:36
Property
Data definable properties.
ObstacleType obstacleType
Controls how features act as obstacles for labels.
bool displayAll
If true, all features will be labelled even when overlaps occur.
Label on left of point.
Offset distance applies from point geometry.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the label&#39;s property collection, used for data defined overrides.
int fontMaxPixelSize
Maximum pixel size for showing rendered map unit labels (1 - 10000).
#define SIP_SKIP
Definition: qgis_sip.h:119
The QgsVectorLayerDiagramProvider class implements support for diagrams within the labeling engine...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QVector< QgsPointXY > cornerPoints
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Upside-down labels (90 <= angle < 270) are shown upright.
QgsLabelPosition(QgsFeatureId id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString(), const QgsGeometry &labelGeometry=QgsGeometry())
Constructor for QgsLabelPosition.
OffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes...
#define SIP_FACTORY
Definition: qgis_sip.h:69
Offset distance applies from rendered symbol bounds.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
int maxNumLabels
The maximum number of labels which should be drawn for this layer.
Place direction symbols on above label.
Stores the settings for rendering of all diagrams for a layer.
bool plusSign
Whether &#39;+&#39; signs should be prepended to positive numeric labels.
unsigned int placementFlags
QString wrapChar
Wrapping character string.
Placement
Placement modes which determine how label candidates are generated for a feature. ...
#define SIP_PYARGREMOVE
Definition: qgis_sip.h:139
QString rightDirectionSymbol
String to use for right direction arrows.
The QgsLabelingEngine class provides map labeling functionality.
bool preserveRotation
True if label rotation should be preserved during label pin/unpin operations.
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point...
Contains information about the context of a rendering operation.
bool centroidWhole
True if feature centroid should be calculated from the whole feature, or false if only the visible pa...
bool scaleVisibility
Set to true to limit label visibility to a range of scales.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QgsGeometry extentGeom
QgsMapUnitScale distMapUnitScale
Map unit scale for label feature distance.
Struct for storing maximum and minimum scales for measurements in map units.
bool fitInPolygonOnly
True if only labels which completely fit within a polygon are allowed.
A collection of string replacements (specified using QgsStringReplacement objects).
OffsetType offsetType
Offset type for layer (only applies in certain placement modes)
double dist
Distance from feature to the label.
bool useSubstitutions
True if substitutions should be applied.
Label below point, slightly left of center.
QFont labelFont
Font which the label is rendered using.
Class for doing transforms between two map coordinate systems.
LabelPosition is a candidate feature label position.
Definition: labelposition.h:55
Label on top of point, slightly left of center.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Label on right of point.
bool limitNumLabels
True if the number of labels drawn should be limited.
bool isExpression
True if this label is made from a expression string, e.g., FieldName || &#39;mm&#39;.
Class that stores computed placement from labeling engine.
LinePlacementFlags
Line placement flags, which control how candidates are generated for a linear feature.
Show upside down when rotation is layer- or data-defined.
QString providerID
ID of the associated label provider.
Container for all settings relating to text rendering.
bool centroidInside
True if centroid positioned labels must be placed inside their corresponding feature polygon...
Represents a vector layer which manages a vector based data sets.
double minFeatureSize
Minimum feature size (in millimeters) for a feature to be labelled.
int fontMinPixelSize
Minimum pixel size for showing rendered map unit labels (1 - 1000).
int priority
Label priority.
bool labelPerPart
True if every part of a multi-part feature should be labeled.
QgsUnitTypes::RenderUnit distUnits
Units the distance from feature to the label.
QgsMapUnitScale labelOffsetMapUnitScale
Map unit scale for label offset.
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:110
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the label&#39;s property collection, used for data defined overrides.
double minimumScale
The minimum map scale (i.e.
QString fieldName
Name of field (or an expression) to use for label text.
bool fontLimitPixelSize
True if label sizes should be limited by pixel size.
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels...
DirectionSymbols placeDirectionSymbol
Placement option for direction symbols.
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...