QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 <QString>
27 #include <QFont>
28 #include <QFontDatabase>
29 #include <QColor>
30 #include <QHash>
31 #include <QList>
32 #include <QPainter>
33 #include <QRectF>
34 #include <QMap>
35 #include "qgsfeature.h"
36 #include "qgsgeometry.h"
37 #include "qgsfields.h"
39 #include "qgspointxy.h"
40 #include "qgsmapunitscale.h"
41 #include "qgsstringutils.h"
42 #include "qgstextrenderer.h"
43 #include "qgspropertycollection.h"
44 
45 namespace pal SIP_SKIP
46 {
47  class Pal;
48  class Layer;
49  class LabelPosition;
50 }
51 
53 class QgsRectangle;
54 class QgsMapToPixel;
55 class QgsFeature;
57 class QgsVectorLayer;
58 class QgsExpression;
59 class QFontMetricsF;
60 class QPainter;
61 class QPicture;
62 class QgsGeometry;
64 class QgsLabelSearchTree;
65 class QgsMapSettings;
66 class QgsLabelFeature;
67 class QgsLabelingEngine;
70 class QgsDxfExport;
73 
74 
79 class CORE_EXPORT QgsLabelPosition
80 {
81  public:
82 
100  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(),
101  const QgsGeometry &labelGeometry = QgsGeometry() )
102  : featureId( id )
103  , rotation( r )
104  , cornerPoints( corners )
105  , labelRect( rect )
106  , labelGeometry( labelGeometry )
107  , width( w )
108  , height( h )
109  , layerID( layer )
110  , labelText( labeltext )
111  , labelFont( labelfont )
112  , upsideDown( upside_down )
113  , isDiagram( diagram )
114  , isPinned( pinned )
115  , providerID( providerId )
116  {}
117 
119  QgsLabelPosition() = default;
120 
124  QgsFeatureId featureId = FID_NULL;
125 
129  double rotation = 0;
130 
131  QVector< QgsPointXY > cornerPoints;
133 
139 
143  double width = 0;
144 
148  double height = 0;
149 
153  QString layerID;
154 
158  QString labelText;
159 
163  QFont labelFont;
164 
168  bool upsideDown = false;
169 
173  bool isDiagram = false;
174 
178  bool isPinned = false;
179 
184  QString providerID;
185 };
186 
187 
192 class CORE_EXPORT QgsPalLayerSettings
193 {
194  public:
198 
200  QgsPalLayerSettings &operator=( const QgsPalLayerSettings &s );
201 
202  //TODO QGIS 4.0 - move to QgsLabelingEngine
203 
208  {
217  };
218 
219  //TODO QGIS 4.0 - move to QgsLabelingEngine
222  {
235  };
236 
237  //TODO QGIS 4.0 - move to QgsLabelingEngine
238 
244  {
247  };
248 
249  //TODO QGIS 4.0 - move to QgsLabelingEngine, rename to LinePlacementFlag, use Q_DECLARE_FLAGS to make
250  //LinePlacementFlags type, and replace use of pal::LineArrangementFlag
251 
256  {
257  OnLine = 1,
258  AboveLine = 2,
261  BelowLine = 4,
264  MapOrientation = 8,
267  };
268 
270  {
280  };
281 
283  {
286  ShowAll
287  };
288 
290  {
293  SymbolBelow
294  };
295 
297  {
298  MultiLeft = 0,
301  MultiFollowPlacement
303  };
304 
305  //TODO QGIS 4.0 - Move to QgsLabelingEngine
306 
312  {
313  PolygonInterior,
315  PolygonBoundary,
317  PolygonWhole
321  };
322 
324  enum Property
325  {
326  // text style
327  Size = 0,
328  Bold = 1,
329  Italic = 2,
330  Underline = 3,
331  Color = 4,
332  Strikeout = 5,
333  Family = 6,
334  FontStyle = 21,
335  FontSizeUnit = 22,
336  FontTransp = 18,
337  FontOpacity = 92,
338  FontCase = 27,
339  FontLetterSpacing = 28,
340  FontWordSpacing = 29,
341  FontBlendMode = 30,
342 
343  // text formatting
344  MultiLineWrapChar = 31,
345  AutoWrapLength = 101,
346  MultiLineHeight = 32,
347  MultiLineAlignment = 33,
348  DirSymbDraw = 34,
349  DirSymbLeft = 35,
350  DirSymbRight = 36,
351  DirSymbPlacement = 37,
352  DirSymbReverse = 38,
353  NumFormat = 39,
354  NumDecimals = 40,
355  NumPlusSign = 41,
356 
357  // text buffer
358  BufferDraw = 42,
359  BufferSize = 7,
360  BufferUnit = 43,
361  BufferColor = 8,
362  BufferTransp = 19,
363  BufferOpacity = 94,
364  BufferJoinStyle = 44,
365  BufferBlendMode = 45,
366 
367  // background
368  ShapeDraw = 46,
369  ShapeKind = 47,
370  ShapeSVGFile = 48,
371  ShapeSizeType = 49,
372  ShapeSizeX = 50,
373  ShapeSizeY = 85,
374  ShapeSizeUnits = 51,
375  ShapeRotationType = 52,
376  ShapeRotation = 53,
377  ShapeOffset = 54,
378  ShapeOffsetUnits = 55,
379  ShapeRadii = 56,
380  ShapeRadiiUnits = 57,
381  ShapeTransparency = 63,
382  ShapeOpacity = 93,
383  ShapeBlendMode = 64,
384  ShapeFillColor = 58,
385  ShapeStrokeColor = 59,
386  ShapeStrokeWidth = 60,
387  ShapeStrokeWidthUnits = 61,
388  ShapeJoinStyle = 62,
389 
390  // drop shadow
391  ShadowDraw = 65,
392  ShadowUnder = 66,
393  ShadowOffsetAngle = 67,
394  ShadowOffsetDist = 68,
395  ShadowOffsetUnits = 69,
396  ShadowRadius = 70,
397  ShadowRadiusUnits = 71,
398  ShadowTransparency = 72,
399  ShadowOpacity = 95,
400  ShadowScale = 73,
401  ShadowColor = 74,
402  ShadowBlendMode = 75,
403 
404  // placement
405  CentroidWhole = 76,
406  OffsetQuad = 77,
407  OffsetXY = 78,
408  OffsetUnits = 80,
409  LabelDistance = 13,
410  DistanceUnits = 81,
411  OffsetRotation = 82,
412  CurvedCharAngleInOut = 83,
413  // (data defined only)
414  PositionX = 9,
415  PositionY = 10,
416  Hali = 11,
417  Vali = 12,
418  Rotation = 14,
419  LabelRotation = 96,
420  RepeatDistance = 84,
421  RepeatDistanceUnit = 86,
422  Priority = 87,
423  PredefinedPositionOrder = 91,
424  LinePlacementOptions = 99,
425 
426  // rendering
427  ScaleVisibility = 23,
428  MinScale = 16,
429  MinimumScale = 97,
430  MaxScale = 17,
431  MaximumScale = 98,
432  FontLimitPixel = 24,
433  FontMinPixel = 25,
434  FontMaxPixel = 26,
435  IsObstacle = 88,
436  ObstacleFactor = 89,
437  ZIndex = 90,
438 
439  // (data defined only)
440  Show = 15,
441  AlwaysShow = 20
442  };
443 
444 
456  bool prepare( const QgsRenderContext &context, QSet<QString> &attributeNames SIP_INOUT, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs );
457 
462  static const QgsPropertiesDefinition &propertyDefinitions();
463 
473 
474  //-- text style
475 
481  QString fieldName;
482 
488 
492  QgsExpression *getLabelExpression();
493 
495 
500 
501  //-- text formatting
502 
507  QString wrapChar;
508 
516  int autoWrapLength = 0;
517 
528  bool useMaxLineLengthForAutoWrap = true;
529 
532 
544 
551 
558 
564 
567 
575 
581  int decimals;
582 
588  bool plusSign;
589 
590  //-- placement
591 
593  unsigned int placementFlags;
594 
600 
607 
614  QVector< PredefinedPointPosition > predefinedPositionOrder SIP_SKIP;
615 
620 
626  double dist;
627 
634 
641 
644 
651 
658 
665 
670 
677  double xOffset;
678 
685  double yOffset;
686 
694 
702 
704  double angleOffset;
705 
708 
714 
720 
725  int priority;
726 
727  //-- rendering
728 
735 
746  double maximumScale;
747 
758  double minimumScale;
759 
766 
773 
780 
783 
785  UpsideDownLabels upsidedownLabels = Upright;
786 
792 
798 
804 
811 
816 
822  bool obstacle;
823 
831 
838 
840  double zIndex;
841 
844 
846  QgsWkbTypes::GeometryType geometryGeneratorType = QgsWkbTypes::GeometryType::PointGeometry;
847 
849  bool geometryGeneratorEnabled = false;
850 
855  void calculateLabelSize( const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f = nullptr, QgsRenderContext *context = nullptr );
856 
870  void registerFeature( const QgsFeature &f, QgsRenderContext &context,
871  QgsLabelFeature **labelFeature SIP_PYARGREMOVE = nullptr,
872  QgsGeometry obstacleGeometry SIP_PYARGREMOVE = QgsGeometry() );
873 
878  void readXml( QDomElement &elem, const QgsReadWriteContext &context );
879 
884  QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context );
885 
891  QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
892 
900  const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
901 
909  void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
910 
916  const QgsTextFormat &format() const { return mFormat; }
917 
924  void setFormat( const QgsTextFormat &format ) { mFormat = format; }
925 
926  // temporary stuff: set when layer gets prepared or labeled
927  const QgsFeature *mCurFeat = nullptr;
930  const QgsMapToPixel *xform = nullptr;
932 
936  int mFeaturesToLabel = 0; // total features that will probably be labeled, may be less (figured before PAL)
937  int mFeatsSendingToPal = 0; // total features tested for sending into PAL (relative to maxNumLabels)
938  int mFeatsRegPal = 0; // number of features registered in PAL, when using limitNumLabels
939  private:
940 
941  friend class QgsVectorLayer; // to allow calling readFromLayerCustomProperties()
942 
947  void readFromLayerCustomProperties( QgsVectorLayer *layer );
948 
952  void readOldDataDefinedPropertyMap( QgsVectorLayer *layer, QDomElement *parentElem );
953 
957  void readOldDataDefinedProperty( QgsVectorLayer *layer, QgsPalLayerSettings::Property p );
958 
959  enum DataDefinedValueType
960  {
961  DDBool,
962  DDInt,
963  DDIntPos,
964  DDDouble,
965  DDDoublePos,
966  DDRotation180,
967  DDOpacity,
968  DDString,
969  DDUnits,
970  DDColor,
971  DDJoinStyle,
972  DDBlendMode,
973  DDPointF,
974  DDSizeF,
975  };
976 
977  // convenience data defined evaluation function
978  bool dataDefinedValEval( DataDefinedValueType valType,
980  QVariant &exprVal, QgsExpressionContext &context, const QVariant &originalValue = QVariant() );
981 
982  void parseTextStyle( QFont &labelFont,
983  QgsUnitTypes::RenderUnit fontunits,
984  QgsRenderContext &context );
985 
986  void parseTextBuffer( QgsRenderContext &context );
987 
988  void parseTextFormatting( QgsRenderContext &context );
989 
990  void parseShapeBackground( QgsRenderContext &context );
991 
992  void parseDropShadow( QgsRenderContext &context );
993 
997  bool checkMinimumSizeMM( const QgsRenderContext &ct, const QgsGeometry &geom, double minSize ) const;
998 
1002  void registerObstacleFeature( const QgsFeature &f, QgsRenderContext &context, QgsLabelFeature **obstacleFeature, const QgsGeometry &obstacleGeometry = QgsGeometry() );
1003 
1004  QMap<Property, QVariant> dataDefinedValues;
1005 
1007  QgsPropertyCollection mDataDefinedProperties;
1008 
1009  QgsExpression *expression = nullptr;
1010 
1011  QFontDatabase mFontDB;
1012 
1013  QgsTextFormat mFormat;
1014 
1015  QgsExpression mGeometryGeneratorExpression;
1016 
1017  static const QVector< PredefinedPointPosition > DEFAULT_PLACEMENT_ORDER;
1018 
1019  static void initPropertyDefinitions();
1020 
1022  static QgsPropertiesDefinition sPropertyDefinitions;
1023 
1024 };
1025 
1029 class CORE_EXPORT QgsLabelCandidate
1030 {
1031  public:
1032  QgsLabelCandidate( const QRectF &r, double c ): rect( r ), cost( c ) {}
1033 
1034  QRectF rect;
1035  double cost;
1036 };
1037 
1038 
1039 
1040 
1046 class CORE_EXPORT QgsLabelingResults
1047 {
1048  public:
1050  ~QgsLabelingResults();
1051 
1053  QgsLabelingResults( const QgsLabelingResults & ) = delete;
1055  QgsLabelingResults &operator=( const QgsLabelingResults &rh ) = delete;
1056 
1058  QList<QgsLabelPosition> labelsAtPosition( const QgsPointXY &p ) const;
1060  QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle &r ) const;
1061 
1066  void setMapSettings( const QgsMapSettings &settings );
1067 
1068  private:
1069 #ifdef SIP_RUN
1071 #endif
1072 
1073  std::unique_ptr< QgsLabelSearchTree > mLabelSearchTree;
1074 
1075  friend class QgsPalLabeling;
1078 };
1079 
1084 class CORE_EXPORT QgsPalLabeling
1085 {
1086  public:
1087 
1092  static bool staticWillUseLayer( QgsVectorLayer *layer );
1093 
1095  static void drawLabelCandidateRect( pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform, QList<QgsLabelCandidate> *candidates = nullptr ) SIP_SKIP;
1096 
1107  static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) SIP_FACTORY;
1108 
1119  static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
1120 
1133  static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
1134 
1143  static QStringList splitToGraphemes( const QString &text );
1144 
1145  private:
1147  static void dataDefinedTextStyle( QgsPalLayerSettings &tmpLyr,
1148  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1149 
1151  static void dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr,
1152  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1153 
1155  static void dataDefinedTextBuffer( QgsPalLayerSettings &tmpLyr,
1156  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1157 
1159  static void dataDefinedShapeBackground( QgsPalLayerSettings &tmpLyr,
1160  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1161 
1163  static void dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr,
1164  const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1165 
1166  friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
1167  friend class QgsDxfExport; // to allow calling the static methods above
1168 
1177  static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry &geom, double minSize );
1178 
1179  friend class QgsPalLayerSettings;
1180 };
1181 
1182 #endif // QGSPALLABELING_H
Label on bottom right of point.
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 geometryGenerator
The geometry generator expression. Null if disabled.
QString labelText
String shown in label.
A rectangle specified with double values.
Definition: qgsrectangle.h:41
Label on bottom-left of point.
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0) ...
double maximumScale
The maximum map scale (i.e.
QString leftDirectionSymbol
String to use for left direction arrows.
Label on top of point, slightly left of center.
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
Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point...
Arranges candidates following the curvature of a line feature. Applies to line layers only...
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-right of point.
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:111
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 ...
#define SIP_INOUT
Definition: qgis_sip.h:64
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
MultiLineAlign multilineAlign
Horizontal alignment of multi-line labels.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:55
const QgsCoordinateReferenceSystem & crs
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 horizontal candidates scattered throughout a polygon feature. Applies to polygon 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:37
Property
Data definable properties.
ObstacleType obstacleType
Controls how features act as obstacles for labels.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the label&#39;s property collection, used for data defined overrides.
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
Label below point, slightly right of center.
Offset distance applies from rendered symbol bounds.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc...
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.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Definition: qgswkbtypes.h:139
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 parallel to a generalised line representing the feature or parallel to a polygon&#39;...
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
Label below point, slightly left of center.
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.
Label on top of point, slightly right of center.
bool useSubstitutions
True if substitutions should be applied.
This class represents a coordinate reference system (CRS).
Label directly below point.
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 directly above point.
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.
Arranges candidates following the curvature of a polygon&#39;s boundary. Applies to polygon layers only...
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:111
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...