QGIS API Documentation  2.99.0-Master (0a63d1f)
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 <QString>
26 #include <QFont>
27 #include <QFontDatabase>
28 #include <QColor>
29 #include <QHash>
30 #include <QList>
31 #include <QPainter>
32 #include <QRectF>
33 #include "qgsfeature.h"
34 #include "qgsgeometry.h"
35 #include "qgsfields.h"
36 #include "qgspoint.h"
37 #include "qgsmapunitscale.h"
38 #include "qgsstringutils.h"
39 #include "qgstextrenderer.h"
40 
41 namespace pal
42 {
43  class Pal;
44  class Layer;
45  class LabelPosition;
46 }
47 
49 class QgsRectangle;
50 class QgsMapToPixel;
51 class QgsFeature;
53 class QgsVectorLayer;
54 class QgsDataDefined;
55 class QgsExpression;
56 class QFontMetricsF;
57 class QPainter;
58 class QPicture;
59 class QgsGeometry;
61 class QgsLabelSearchTree;
62 class QgsMapSettings;
63 class QgsLabelFeature;
64 class QgsLabelingEngine;
67 class QgsDxfExport;
69 
70 
71 
75 class CORE_EXPORT QgsLabelPosition
76 {
77  public:
78  QgsLabelPosition( int id, double r, const QVector< QgsPoint >& 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() )
79  : featureId( id )
80  , rotation( r )
81  , cornerPoints( corners )
82  , labelRect( rect )
83  , width( w )
84  , height( h )
85  , layerID( layer )
86  , labelText( labeltext )
87  , labelFont( labelfont )
88  , upsideDown( upside_down )
89  , isDiagram( diagram )
90  , isPinned( pinned )
91  , providerID( providerId )
92  {}
94  : featureId( -1 )
95  , rotation( 0 )
96  , labelRect( QgsRectangle() )
97  , width( 0 )
98  , height( 0 )
99  , layerID( QLatin1String( "" ) )
100  , labelText( QLatin1String( "" ) )
101  , labelFont( QFont() )
102  , upsideDown( false )
103  , isDiagram( false )
104  , isPinned( false )
105  {}
107  double rotation;
108  QVector< QgsPoint > cornerPoints;
110  double width;
111  double height;
112  QString layerID;
113  QString labelText;
114  QFont labelFont;
116  bool isDiagram;
117  bool isPinned;
119  QString providerID;
120 };
121 
122 
126 class CORE_EXPORT QgsPalLayerSettings
127 {
128  public:
132 
134  QgsPalLayerSettings &operator=( const QgsPalLayerSettings & s );
135 
137  static QgsPalLayerSettings fromLayer( QgsVectorLayer* layer );
138 
141  //TODO QGIS 3.0 - move to QgsLabelingEngine
143  {
152  };
153 
155  //TODO QGIS 3.0 - move to QgsLabelingEngine
157  {
170  };
171 
174  //TODO QGIS 3.0 - move to QgsLabelingEngine
176  {
179  };
180 
183  //TODO QGIS 3.0 - move to QgsLabelingEngine, rename to LinePlacementFlag, use Q_DECLARE_FLAGS to make
184  //LinePlacementFlags type, and replace use of pal::LineArrangementFlag
186  {
187  OnLine = 1,
188  AboveLine = 2,
191  BelowLine = 4,
194  MapOrientation = 8,
197  };
198 
200  {
209  QuadrantBelowRight
210  };
211 
213  {
216  ShowAll
217  };
218 
220  {
223  SymbolBelow
224  };
225 
227  {
228  MultiLeft = 0,
231  MultiFollowPlacement
233  };
234 
238  //TODO QGIS 3.0 - Move to QgsLabelingEngine
240  {
241  PolygonInterior,
243  PolygonBoundary,
245  PolygonWhole
249  };
250 
251 
253  enum SizeUnit
254  {
255  Points = 0,
256  MM,
258  Percent
259  };
260 
261  // update mDataDefinedNames QMap in constructor when adding/deleting enum value
263  {
264  // text style
265  Size = 0,
266  Bold = 1,
267  Italic = 2,
268  Underline = 3,
269  Color = 4,
270  Strikeout = 5,
271  Family = 6,
272  FontStyle = 21,
273  FontSizeUnit = 22,
274  FontTransp = 18,
275  FontCase = 27,
276  FontLetterSpacing = 28,
277  FontWordSpacing = 29,
278  FontBlendMode = 30,
279 
280  // text formatting
281  MultiLineWrapChar = 31,
282  MultiLineHeight = 32,
283  MultiLineAlignment = 33,
284  DirSymbDraw = 34,
285  DirSymbLeft = 35,
286  DirSymbRight = 36,
287  DirSymbPlacement = 37,
288  DirSymbReverse = 38,
289  NumFormat = 39,
290  NumDecimals = 40,
291  NumPlusSign = 41,
292 
293  // text buffer
294  BufferDraw = 42,
295  BufferSize = 7,
296  BufferUnit = 43,
297  BufferColor = 8,
298  BufferTransp = 19,
299  BufferJoinStyle = 44,
300  BufferBlendMode = 45,
301 
302  // background
303  ShapeDraw = 46,
304  ShapeKind = 47,
305  ShapeSVGFile = 48,
306  ShapeSizeType = 49,
307  ShapeSizeX = 50,
308  ShapeSizeY = 85,
309  ShapeSizeUnits = 51,
310  ShapeRotationType = 52,
311  ShapeRotation = 53,
312  ShapeOffset = 54,
313  ShapeOffsetUnits = 55,
314  ShapeRadii = 56,
315  ShapeRadiiUnits = 57,
316  ShapeTransparency = 63,
317  ShapeBlendMode = 64,
318  ShapeFillColor = 58,
319  ShapeBorderColor = 59,
320  ShapeBorderWidth = 60,
321  ShapeBorderWidthUnits = 61,
322  ShapeJoinStyle = 62,
323 
324  // drop shadow
325  ShadowDraw = 65,
326  ShadowUnder = 66,
327  ShadowOffsetAngle = 67,
328  ShadowOffsetDist = 68,
329  ShadowOffsetUnits = 69,
330  ShadowRadius = 70,
331  ShadowRadiusUnits = 71,
332  ShadowTransparency = 72,
333  ShadowScale = 73,
334  ShadowColor = 74,
335  ShadowBlendMode = 75,
336 
337  // placement
338  CentroidWhole = 76,
339  OffsetQuad = 77,
340  OffsetXY = 78,
341  OffsetUnits = 80,
342  LabelDistance = 13,
343  DistanceUnits = 81,
344  OffsetRotation = 82,
345  CurvedCharAngleInOut = 83,
346  // (data defined only)
347  PositionX = 9, //x-coordinate data defined label position
348  PositionY = 10, //y-coordinate data defined label position
349  Hali = 11, //horizontal alignment for data defined label position (Left, Center, Right)
350  Vali = 12, //vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)
351  Rotation = 14, //data defined rotation
352  RepeatDistance = 84,
353  RepeatDistanceUnit = 86,
354  Priority = 87,
355  PredefinedPositionOrder = 91,
356 
357  // rendering
358  ScaleVisibility = 23,
359  MinScale = 16,
360  MaxScale = 17,
361  FontLimitPixel = 24,
362  FontMinPixel = 25,
363  FontMaxPixel = 26,
364  IsObstacle = 88,
365  ObstacleFactor = 89,
366  ZIndex = 90,
367 
368  // (data defined only)
369  Show = 15,
370  AlwaysShow = 20
371  };
372 
373  // whether to label this layer
374  bool enabled;
375 
384 
385  //-- text style
386 
387  QString fieldName;
388 
392 
395  QgsExpression* getLabelExpression();
396 
398 
403 
404  //-- text formatting
405 
406  QString wrapChar;
407  MultiLineAlign multilineAlign; // horizontal alignment of multi-line labels
408 
409  // Adds '<' or '>', or user-defined symbol to the label string pointing to the
410  // direction of the line / polygon ring
411  // Works only if Placement == Line
415  DirectionSymbols placeDirectionSymbol; // whether to place left/right, above or below label
417 
419  int decimals;
420  bool plusSign;
421 
422  //-- placement
423 
425  unsigned int placementFlags;
426 
427  bool centroidWhole; // whether centroid calculated from whole or visible polygon
428  bool centroidInside; // whether centroid-point calculated must be inside polygon
429 
435  QVector< PredefinedPointPosition > predefinedPositionOrder;
436 
440  double dist; // distance from the feature (in mm)
441  bool distInMapUnits; //true if distance is in map units (otherwise in mm)
445 
449 
450  // offset labels of point/centroid features default to center
451  // move label to quadrant: left/down, don't move, right/up (-1, 0, 1)
453 
454  double xOffset; // offset from point in mm or map units
455  double yOffset; // offset from point in mm or map units
456  bool labelOffsetInMapUnits; //true if label offset is in map units (otherwise in mm)
458  double angleOffset; // rotation applied to offset labels
459  bool preserveRotation; // preserve predefined rotation data during label pin/unpin operations
460 
461  double maxCurvedCharAngleIn; // maximum angle between inside curved label characters (defaults to 20.0, range 20.0 to 60.0)
462  double maxCurvedCharAngleOut; // maximum angle between outside curved label characters (defaults to -20.0, range -20.0 to -95.0)
463 
464  int priority; // 0 = low, 10 = high
465 
466  //-- rendering
467 
469  int scaleMin;
470  int scaleMax;
471 
472  bool fontLimitPixelSize; // true is label should be limited by fontMinPixelSize/fontMaxPixelSize
473  int fontMinPixelSize; // minimum pixel size for showing rendered map unit labels (1 - 1000)
474  int fontMaxPixelSize; // maximum pixel size for showing rendered map unit labels (1 - 10000)
475 
476  bool displayAll; // if true, all features will be labelled even though overlaps occur
477  UpsideDownLabels upsidedownLabels; // whether, or how, to show upsidedown labels
478 
479  bool labelPerPart; // whether to label every feature's part or only the biggest one
481 
482  bool limitNumLabels; // whether to limit the number of labels to be drawn
483  int maxNumLabels; // maximum number of labels to be drawn
484 
485  double minFeatureSize; // minimum feature size to be labelled (in mm)
486  bool obstacle; // whether features for layer are obstacles to labels of other layers
487 
492 
496 
498  double zIndex;
499 
500  // called from register feature hook
501  void calculateLabelSize( const QFontMetricsF* fm, QString text, double& labelX, double& labelY, QgsFeature* f = nullptr, QgsRenderContext* context = nullptr );
502 
515  void registerFeature( QgsFeature& f, QgsRenderContext& context, QgsLabelFeature** labelFeature = nullptr, QgsGeometry* obstacleGeometry = nullptr );
516 
517  void readFromLayer( QgsVectorLayer* layer );
518  void writeToLayer( QgsVectorLayer* layer );
519 
523  void readXml( QDomElement& elem );
524 
528  QDomElement writeXml( QDomDocument& doc );
529 
534 
538  void setDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p,
539  bool active, bool useExpr, const QString& expr, const QString& field );
540 
542  void removeDataDefinedProperty( QgsPalLayerSettings::DataDefinedProperties p );
543 
547  void removeAllDataDefinedProperties();
548 
552  QString updateDataDefinedString( const QString& value );
553 
557  QMap<QString, QString> dataDefinedMap( QgsPalLayerSettings::DataDefinedProperties p ) const;
558 
563  QVariant dataDefinedValue( QgsPalLayerSettings::DataDefinedProperties p, QgsFeature& f, const QgsFields& fields,
564  const QgsExpressionContext* context = nullptr ) const;
565 
570  bool dataDefinedEvaluate( QgsPalLayerSettings::DataDefinedProperties p, QVariant& exprVal, QgsExpressionContext* context = nullptr, const QVariant& originalValue = QVariant() ) const;
571 
574  bool dataDefinedIsActive( QgsPalLayerSettings::DataDefinedProperties p ) const;
575 
578  bool dataDefinedUseExpression( QgsPalLayerSettings::DataDefinedProperties p ) const;
579 
584  QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > dataDefinedProperties;
585 
590  QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > dataDefinedNames() const { return mDataDefinedNames; }
591 
596  const QgsTextFormat& format() const { return mFormat; }
597 
603  void setFormat( const QgsTextFormat& format ) { mFormat = format; }
604 
605  // temporary stuff: set when layer gets prepared or labeled
611 
615  int mFeaturesToLabel; // total features that will probably be labeled, may be less (figured before PAL)
616  int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
617  int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
618 
619  private:
620 
621  void readDataDefinedPropertyMap( QgsVectorLayer* layer, QDomElement* parentElem,
623  QgsDataDefined* > & propertyMap );
624  void writeDataDefinedPropertyMap( QgsVectorLayer* layer, QDomElement* parentElem,
626  QgsDataDefined* > & propertyMap );
627  void readDataDefinedProperty( QgsVectorLayer* layer,
630  QgsDataDefined* > & propertyMap );
631 
632  enum DataDefinedValueType
633  {
634  DDBool,
635  DDInt,
636  DDIntPos,
637  DDDouble,
638  DDDoublePos,
639  DDRotation180,
640  DDTransparency,
641  DDString,
642  DDUnits,
643  DDColor,
644  DDJoinStyle,
645  DDBlendMode,
646  DDPointF
647  };
648 
649  // convenience data defined evaluation function
650  bool dataDefinedValEval( DataDefinedValueType valType,
652  QVariant& exprVal, QgsExpressionContext &context, const QVariant& originalValue = QVariant() );
653 
654  void parseTextStyle( QFont& labelFont,
655  QgsUnitTypes::RenderUnit fontunits,
656  QgsRenderContext& context );
657 
658  void parseTextBuffer( QgsRenderContext& context );
659 
660  void parseTextFormatting( QgsRenderContext& context );
661 
662  void parseShapeBackground( QgsRenderContext& context );
663 
664  void parseDropShadow( QgsRenderContext& context );
665 
668  bool checkMinimumSizeMM( const QgsRenderContext& ct, const QgsGeometry& geom, double minSize ) const;
669 
672  void registerObstacleFeature( QgsFeature &f, QgsRenderContext &context, QgsLabelFeature** obstacleFeature, QgsGeometry* obstacleGeometry = nullptr );
673 
674  QMap<DataDefinedProperties, QVariant> dataDefinedValues;
675  QgsExpression* expression;
676  QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> > mDataDefinedNames;
677 
678  QFontDatabase mFontDB;
679 
680  QgsTextFormat mFormat;
681 
682  static const QVector< PredefinedPointPosition > DEFAULT_PLACEMENT_ORDER;
683 };
684 
687 class CORE_EXPORT QgsLabelCandidate
688 {
689  public:
690  QgsLabelCandidate( const QRectF& r, double c ): rect( r ), cost( c ) {}
691 
692  QRectF rect;
693  double cost;
694 };
695 
696 
697 
698 
703 class CORE_EXPORT QgsLabelingResults
704 {
705  public:
708 
710  QgsLabelingResults( const QgsLabelingResults& ) = delete;
712  QgsLabelingResults& operator=( const QgsLabelingResults& rh ) = delete;
713 
715  QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) const;
717  QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) const;
718 
719  private:
720 
721  QgsLabelSearchTree* mLabelSearchTree;
722 
723  friend class QgsPalLabeling;
726 };
727 
731 class CORE_EXPORT QgsPalLabeling
732 {
733  public:
734 
735  QgsPalLabeling();
736  ~QgsPalLabeling();
737 
738  void numCandidatePositions( int& candPoint, int& candLine, int& candPolygon );
739  void setNumCandidatePositions( int candPoint, int candLine, int candPolygon );
740 
741  enum Search { Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain, Falp };
742 
743  void setSearchMethod( Search s );
744  Search searchMethod() const;
745 
746  bool isShowingCandidates() const;
747  void setShowingCandidates( bool showing );
748 
749  bool isShowingAllLabels() const;
750  void setShowingAllLabels( bool showing );
751 
752  bool isShowingPartialsLabels() const;
753  void setShowingPartialsLabels( bool showing );
754 
756  bool isDrawingOutlineLabels() const;
757  void setDrawingOutlineLabels( bool outline );
758 
764  bool drawLabelRectOnly() const;
765 
772  void setDrawLabelRectOnly( bool drawRect );
773 
776  static bool staticWillUseLayer( QgsVectorLayer* layer );
777  static bool staticWillUseLayer( const QString& layerID );
778 
780  static void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter, const QgsMapToPixel* xform, QList<QgsLabelCandidate>* candidates = nullptr );
781 
783  void loadEngineSettings();
784  void saveEngineSettings();
785  void clearEngineSettings();
786 
795  static QgsGeometry prepareGeometry( const QgsGeometry& geometry, QgsRenderContext &context, const QgsCoordinateTransform& ct, QgsGeometry *clipGeometry = nullptr );
796 
805  static bool geometryRequiresPreparation( const QgsGeometry& geometry, QgsRenderContext &context, const QgsCoordinateTransform& ct, QgsGeometry *clipGeometry = nullptr );
806 
814  static QStringList splitToLines( const QString& text, const QString& wrapCharacter );
815 
823  static QStringList splitToGraphemes( const QString& text );
824 
825  protected:
826  // update temporary QgsPalLayerSettings with any data defined text style values
827  static void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr,
828  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
829 
830  // update temporary QgsPalLayerSettings with any data defined text formatting values
831  static void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr,
832  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
833 
834  // update temporary QgsPalLayerSettings with any data defined text buffer values
835  static void dataDefinedTextBuffer( QgsPalLayerSettings& tmpLyr,
836  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
837 
838  // update temporary QgsPalLayerSettings with any data defined shape background values
839  static void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr,
840  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
841 
842  // update temporary QgsPalLayerSettings with any data defined drop shadow values
843  static void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr,
844  const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant >& ddValues );
845 
846  friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
847  friend class QgsDxfExport; // to allow calling the static methods above
848 
849  void deleteTemporaryData();
850 
858  static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry *geom, double minSize );
859 
861  QHash<QString, QgsVectorLayerLabelProvider*> mLabelProviders;
863  QHash<QString, QgsVectorLayerDiagramProvider*> mDiagramProviders;
865 
868 
869  // list of candidates from last labeling
870  QList<QgsLabelCandidate> mCandidates;
871 
872  friend class QgsPalLayerSettings;
873 };
874 
875 #endif // QGSPALLABELING_H
Label below point, slightly right of center.
QgsRectangle labelRect
Class for parsing and evaluation of expressions (formerly called "search strings").
A rectangle specified with double values.
Definition: qgsrectangle.h:36
Label on bottom-left of point.
QHash< QString, QgsVectorLayerLabelProvider * > mLabelProviders
hashtable of label providers, being filled during labeling (key = layer ID)
A container class for data source field mapping or expression.
A class to query the labeling structure at a given point (small wraper around pal RTree class) ...
UpsideDownLabels upsidedownLabels
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)
PredefinedPointPosition
Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode...
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
QuadrantPosition quadOffset
Class that adds extra information to QgsLabelFeature for text labels.
Container of fields for a vector layer.
Definition: qgsfields.h:39
Label on top of point, slightly right of center.
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:79
bool drawLabels
Whether to draw labels for this layer.
QHash< QString, QgsVectorLayerDiagramProvider * > mDiagramProviders
hashtable of diagram providers (key = layer ID)
QgsMapUnitScale repeatDistanceMapUnitScale
MultiLineAlign multilineAlign
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:136
QMap< QgsPalLayerSettings::DataDefinedProperties, QPair< QString, int > > dataDefinedNames() const
Map of data defined enum to names and old-style indecies The QPair contains a new string for layer pr...
QVector< PredefinedPointPosition > predefinedPositionOrder
Ordered list of predefined label positions for points.
QVector< QgsPoint > cornerPoints
QgsCoordinateTransform ct
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.
Place direction symbols on left/right of label.
Perform transforms between map coordinates and device coordinates.
Definition: qgsmaptopixel.h:34
ObstacleType obstacleType
Controls how features act as obstacles for labels.
Label on left of point.
Offset distance applies from point geometry.
QgsPalLayerSettings mInvalidLayerSettings
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...
struct pal::_chain Chain
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
const QgsMapToPixel * xform
QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined *> dataDefinedProperties
Map of current data defined properties.
Upside-down labels (90 <= angle < 270) are shown upright.
OffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes...
QgsFeature * mCurFeat
SizeUnit
Units used for option sizes, before being converted to rendered sizes.
A class to represent a point.
Definition: qgspoint.h:143
Offset distance applies from rendered symbol bounds.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc...
Place direction symbols on above label.
Stores the settings for rendering of all diagrams for a layer.
unsigned int placementFlags
Placement
Placement modes which determine how label candidates are generated for a feature. ...
The QgsLabelingEngine class provides map labeling functionality.
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.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QgsGeometry extentGeom
QgsLabelPosition(int id, double r, const QVector< QgsPoint > &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())
QgsMapUnitScale distMapUnitScale
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).
QgsLabelingEngine * mEngine
New labeling engine to interface with PAL.
OffsetType offsetType
Offset type for layer (only applies in certain placement modes)
bool useSubstitutions
True if substitutions should be applied.
Label below point, slightly left of center.
Class for doing transforms between two map coordinate systems.
LabelPosition is a candidate feature label position.
Definition: labelposition.h:52
Label on top of point, slightly left of center.
Label on right of point.
bool isExpression
Is this label 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.
QList< QgsLabelCandidate > mCandidates
Show upside down when rotation is layer- or data-defined.
Container for all settings relating to text rendering.
Represents a vector layer which manages a vector based data sets.
QgsMapUnitScale labelOffsetMapUnitScale
RenderUnit
Rendering size units.
Definition: qgsunittypes.h:92
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels...
DirectionSymbols placeDirectionSymbol
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...