QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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#ifndef QGSPALLABELING_H
19#define QGSPALLABELING_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
24#include "qgsexpression.h"
25#include "qgsfeature.h"
26#include "qgsfields.h"
27#include "qgsgeometry.h"
33#include "qgsmapunitscale.h"
34#include "qgspointxy.h"
36#include "qgsstringutils.h"
37#include "qgstextformat.h"
38
39#include <QColor>
40#include <QFont>
41#include <QFontDatabase>
42#include <QHash>
43#include <QList>
44#include <QMap>
45#include <QPainter>
46#include <QRectF>
47#include <QString>
48
49class QgsTextDocument;
51
52namespace pal SIP_SKIP
53{
54 class Pal;
55 class Layer;
56 class LabelPosition;
57}
58
60class QgsRectangle;
61class QgsMapToPixel;
62class QgsFeature;
64class QgsVectorLayer;
65class QgsExpression;
66class QFontMetricsF;
67class QPainter;
68class QPicture;
69class QgsGeometry;
72class QgsMapLayer;
73class QgsMapSettings;
74class QgsLabelFeature;
78class QgsDxfExport;
81class QgsCallout;
82class QMimeData;
83
89class CORE_EXPORT QgsPalLayerSettings
90{
91 public:
95
98
99 // *INDENT-OFF*
102 {
103 // text style
104 Size = 0,
105 Bold = 1,
106 Italic = 2,
107 Underline = 3,
108 Color = 4,
109 Strikeout = 5,
110 Family = 6,
111 FontStyle = 21,
112 FontSizeUnit = 22,
113 FontTransp = 18,
114 FontOpacity = 92,
115 FontCase = 27,
116 FontLetterSpacing = 28,
117 FontWordSpacing = 29,
118 FontBlendMode = 30,
119 FontStretchFactor = 113,
120
121 // text formatting
122 MultiLineWrapChar = 31,
123 AutoWrapLength = 101,
124 MultiLineHeight = 32,
125 MultiLineAlignment = 33,
126 TextOrientation = 110,
127 TabStopDistance = 120,
128 DirSymbDraw = 34,
129 DirSymbLeft = 35,
130 DirSymbRight = 36,
131 DirSymbPlacement = 37,
132 DirSymbReverse = 38,
133 NumFormat = 39,
134 NumDecimals = 40,
135 NumPlusSign = 41,
136
137 // text buffer
138 BufferDraw = 42,
139 BufferSize = 7,
140 BufferUnit = 43,
141 BufferColor = 8,
142 BufferTransp = 19,
143 BufferOpacity = 94,
144 BufferJoinStyle = 44,
145 BufferBlendMode = 45,
146
147 // mask buffer
148 MaskEnabled = 104,
149 MaskBufferSize = 105,
150 MaskBufferUnit = 106,
151 MaskOpacity = 107,
152 MaskJoinStyle = 108,
153
154 // background
155 ShapeDraw = 46,
156 ShapeKind = 47,
157 ShapeSVGFile = 48,
158 ShapeSizeType = 49,
159 ShapeSizeX = 50,
160 ShapeSizeY = 85,
161 ShapeSizeUnits = 51,
162 ShapeRotationType = 52,
163 ShapeRotation = 53,
164 ShapeOffset = 54,
165 ShapeOffsetUnits = 55,
166 ShapeRadii = 56,
167 ShapeRadiiUnits = 57,
168 ShapeTransparency = 63,
169 ShapeOpacity = 93,
170 ShapeBlendMode = 64,
171 ShapeFillColor = 58,
172 ShapeStrokeColor = 59,
173 ShapeStrokeWidth = 60,
174 ShapeStrokeWidthUnits = 61,
175 ShapeJoinStyle = 62,
176
177 // drop shadow
178 ShadowDraw = 65,
179 ShadowUnder = 66,
180 ShadowOffsetAngle = 67,
181 ShadowOffsetDist = 68,
182 ShadowOffsetUnits = 69,
183 ShadowRadius = 70,
184 ShadowRadiusUnits = 71,
185 ShadowTransparency = 72,
186 ShadowOpacity = 95,
187 ShadowScale = 73,
188 ShadowColor = 74,
189 ShadowBlendMode = 75,
190
191 // placement
192 CentroidWhole = 76,
193 OffsetQuad = 77,
194 OffsetXY = 78,
195 OffsetUnits = 80,
196 LabelDistance = 13,
197 MaximumDistance = 119,
198 DistanceUnits = 81,
199 OffsetRotation = 82,
200 CurvedCharAngleInOut = 83,
201 // (data defined only)
202 PositionX = 9,
203 PositionY = 10,
204 PositionPoint = 114,
205 Hali = 11,
206 Vali = 12,
207 Rotation = 14,
208 LabelRotation = 96,
209 RepeatDistance = 84,
210 RepeatDistanceUnit = 86,
211 Priority = 87,
212 PredefinedPositionOrder = 91,
213 LinePlacementOptions = 99,
214 OverrunDistance = 102,
215 LabelAllParts = 103,
216 PolygonLabelOutside = 109,
217 LineAnchorPercent = 111,
218 LineAnchorClipping = 112,
219 LineAnchorType = 115,
220 LineAnchorTextPoint = 116,
221
222 // rendering
223 ScaleVisibility = 23,
224 MinScale = 16,
225 MinimumScale = 97,
226 MaxScale = 17,
227 MaximumScale = 98,
228 FontLimitPixel = 24,
229 FontMinPixel = 25,
230 FontMaxPixel = 26,
231 IsObstacle = 88,
232 ObstacleFactor = 89,
233 ZIndex = 90,
234 CalloutDraw = 100,
235
236 AllowDegradedPlacement = 117,
237 OverlapHandling = 118,
238
239 LabelMarginDistance = 121,
240 RemoveDuplicateLabels = 122,
241 RemoveDuplicateLabelDistance = 123,
242
243 // (data defined only)
244 Show = 15,
245 AlwaysShow = 20
246 };
247 // *INDENT-ON*
248
260 bool prepare( QgsRenderContext &context, QSet<QString> &attributeNames SIP_INOUT, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs );
261
266 QSet<QString> referencedFields( const QgsRenderContext &context ) const;
267
276 void startRender( QgsRenderContext &context );
277
285 void stopRender( QgsRenderContext &context );
286
292 bool containsAdvancedEffects() const;
293
297 static const QgsPropertiesDefinition &propertyDefinitions();
298
306 bool drawLabels = true;
307
308 //-- text style
309
315 QString fieldName;
316
321 bool isExpression = false;
322
327
331 Q_DECL_DEPRECATED QColor previewBkgrdColor = Qt::white;
332
336 bool useSubstitutions = false;
337
338 //-- text formatting
339
344 QString wrapChar;
345
354
366
369
376 bool formatNumbers = false;
377
383 int decimals = 3;
384
390 bool plusSign = false;
391
392 //-- placement
393
396
403 Qgis::LabelPolygonPlacementFlags polygonPlacementFlags() const { return mPolygonPlacementFlags; }
404
411 void setPolygonPlacementFlags( Qgis::LabelPolygonPlacementFlags flags ) { mPolygonPlacementFlags = flags; }
412
417 bool centroidWhole = false;
418
424 bool centroidInside = false;
425
429 bool fitInPolygonOnly = false;
430
436 double dist = 0;
437
444
451
454
460 double repeatDistance = 0;
461
468
475
482 double xOffset = 0;
483
490 double yOffset = 0;
491
499
507
509 double angleOffset = 0;
510
512 bool preserveRotation = true;
513
520
526 void setRotationUnit( Qgis::AngleUnit angleUnit );
527
532 double maxCurvedCharAngleIn = 25.0;
533
538 double maxCurvedCharAngleOut = -25.0;
539
544 int priority = 5;
545
546 //-- rendering
547
553 bool scaleVisibility = false;
554
565 double maximumScale = 0;
566
577 double minimumScale = 0;
578
584 bool fontLimitPixelSize = false;
585
592
598 int fontMaxPixelSize = 10000;
599
602
607 bool labelPerPart = false;
608
610 double zIndex = 0;
611
614
617
620
626
631 void setLegendString( const QString &legendString ) { mLegendString = legendString; }
632
637 QString legendString() const { return mLegendString; }
638
651 Q_DECL_DEPRECATED void calculateLabelSize( const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f = nullptr, QgsRenderContext *context = nullptr, double *rotatedLabelX SIP_OUT = nullptr, double *rotatedLabelY SIP_OUT = nullptr ) SIP_DEPRECATED;
652
662 void registerFeature( const QgsFeature &f, QgsRenderContext &context );
663
664#ifndef SIP_RUN
665
682 std::unique_ptr< QgsLabelFeature > registerFeatureWithDetails( const QgsFeature &feature, QgsRenderContext &context,
683 QgsGeometry obstacleGeometry = QgsGeometry(), const QgsSymbol *symbol = nullptr );
684
685#endif
686
690 void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
691
695 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
696
701 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
702
709 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
710
717 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
718
723 const QgsTextFormat &format() const { return mFormat; }
724
730 void setFormat( const QgsTextFormat &format ) { mFormat = format; }
731
740 QgsCallout *callout() const { return mCallout.get(); }
741
750 void setCallout( QgsCallout *callout SIP_TRANSFER );
751
760 const QgsLabelLineSettings &lineSettings() const SIP_SKIP { return mLineSettings; }
761
769 QgsLabelLineSettings &lineSettings() { return mLineSettings; }
770
778 void setLineSettings( const QgsLabelLineSettings &settings ) { mLineSettings = settings; }
779
789 const QgsLabelPointSettings &pointSettings() const SIP_SKIP { return mPointSettings; }
790
799 QgsLabelPointSettings &pointSettings() { return mPointSettings; }
800
809 void setPointSettings( const QgsLabelPointSettings &settings ) { mPointSettings = settings; }
810
817 const QgsLabelObstacleSettings &obstacleSettings() const SIP_SKIP { return mObstacleSettings; }
818
824 QgsLabelObstacleSettings &obstacleSettings() { return mObstacleSettings; }
825
831 void setObstacleSettings( const QgsLabelObstacleSettings &settings ) { mObstacleSettings = settings; }
832
839 const QgsLabelThinningSettings &thinningSettings() const SIP_SKIP { return mThinningSettings; }
840
846 QgsLabelThinningSettings &thinningSettings() { return mThinningSettings; }
847
853 void setThinningSettings( const QgsLabelThinningSettings &settings ) { mThinningSettings = settings; }
854
861 const QgsLabelPlacementSettings &placementSettings() const SIP_SKIP { return mPlacementSettings; }
862
868 QgsLabelPlacementSettings &placementSettings() { return mPlacementSettings; }
869
875 void setPlacementSettings( const QgsLabelPlacementSettings &settings ) { mPlacementSettings = settings; }
876
886 static QPixmap labelSettingsPreviewPixmap( const QgsPalLayerSettings &settings, QSize size, const QString &previewText = QString(), int padding = 0, const QgsScreenProperties &screen = QgsScreenProperties() );
887
894 Qgis::UnplacedLabelVisibility unplacedVisibility() const;
895
902 void setUnplacedVisibility( Qgis::UnplacedLabelVisibility visibility );
903
911 QMimeData *toMimeData() const SIP_FACTORY;
912
920 static QgsPalLayerSettings fromMimeData( const QMimeData *data, bool *ok SIP_OUT = nullptr );
921
922 // temporary stuff: set when layer gets prepared or labeled
923 const QgsFeature *mCurFeat = nullptr;
925 int fieldIndex = 0;
926 const QgsMapToPixel *xform = nullptr;
928
932 int mFeaturesToLabel = 0; // total features that will probably be labeled, may be less (figured before PAL)
933 int mFeatsSendingToPal = 0; // total features tested for sending into PAL (relative to maxNumLabels)
934 int mFeatsRegPal = 0; // number of features registered in PAL, when using limitNumLabels
935
936 private:
937
938 friend class QgsVectorLayer; // to allow calling readFromLayerCustomProperties()
939
943 void readFromLayerCustomProperties( QgsVectorLayer *layer );
944
948 void readOldDataDefinedPropertyMap( QgsVectorLayer *layer, QDomElement *parentElem );
949
953 void readOldDataDefinedProperty( QgsVectorLayer *layer, QgsPalLayerSettings::Property p );
954
962 void calculateLabelSize( const QFontMetricsF &fm, const QString &text, QgsRenderContext &context,
963 const QgsTextFormat &format,
964 QgsTextDocument *document,
965 QgsTextDocumentMetrics *documentMetrics,
966 QSizeF &size, QSizeF &rotatedSize,
967 QRectF &outerBounds );
968
969
970 enum DataDefinedValueType
971 {
972 DDBool,
973 DDInt,
974 DDIntPos,
975 DDDouble,
976 DDDoublePos,
977 DDRotation180,
978 DDOpacity,
979 DDString,
980 DDUnits,
981 DDColor,
982 DDJoinStyle,
983 DDBlendMode,
984 DDPointF,
985 DDSizeF,
986 };
987
988 // convenience data defined evaluation function
989 bool dataDefinedValEval( DataDefinedValueType valType,
991 QVariant &exprVal, QgsExpressionContext &context, const QVariant &originalValue = QVariant() );
992
993 void parseTextStyle( QFont &labelFont,
994 Qgis::RenderUnit fontunits,
995 QgsRenderContext &context );
996
997 void parseTextBuffer( QgsRenderContext &context );
998
999 void parseTextMask( QgsRenderContext &context );
1000
1001 void parseTextFormatting( QgsRenderContext &context );
1002
1003 void parseShapeBackground( QgsRenderContext &context );
1004
1005 void parseDropShadow( QgsRenderContext &context );
1006
1011 bool checkMinimumSizeMM( const QgsRenderContext &ct, const QgsGeometry &geom, double minSize ) const;
1012
1016 std::unique_ptr< QgsLabelFeature > registerObstacleFeature( const QgsFeature &f, QgsRenderContext &context, const QgsGeometry &obstacleGeometry = QgsGeometry() );
1017
1018 QMap<Property, QVariant> dataDefinedValues;
1019
1021 QgsPropertyCollection mDataDefinedProperties;
1022
1023 std::unique_ptr<QgsExpression> expression;
1024
1025 std::unique_ptr< QFontDatabase > mFontDB;
1026
1027 QgsTextFormat mFormat;
1028
1029 std::unique_ptr< QgsCallout > mCallout;
1030
1031 QgsLabelPlacementSettings mPlacementSettings;
1032 QgsLabelLineSettings mLineSettings;
1033 QgsLabelPointSettings mPointSettings;
1034 QgsLabelObstacleSettings mObstacleSettings;
1035 QgsLabelThinningSettings mThinningSettings;
1036
1038
1039 QgsExpression mGeometryGeneratorExpression;
1040
1041 bool mRenderStarted = false;
1042
1043 QString mLegendString = QObject::tr( "Aa" );
1044
1046
1049
1050 static void initPropertyDefinitions();
1051};
1052
1053
1059class CORE_EXPORT QgsPalLabeling
1060{
1061 public:
1062
1066 static bool staticWillUseLayer( const QgsMapLayer *layer );
1067
1077 static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) SIP_FACTORY;
1078
1088 static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
1089
1101 static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
1102
1110 static QStringList splitToGraphemes( const QString &text );
1111
1112 private:
1114 static void dataDefinedTextStyle( QgsPalLayerSettings &tmpLyr,
1115 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1116
1118 static void dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr,
1119 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1120
1122 static void dataDefinedTextBuffer( QgsPalLayerSettings &tmpLyr,
1123 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1124
1126 static void dataDefinedTextMask( QgsPalLayerSettings &tmpLyr,
1127 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1128
1130 static void dataDefinedShapeBackground( QgsPalLayerSettings &tmpLyr,
1131 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1132
1134 static void dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr,
1135 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1136
1137 friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
1138 friend class QgsDxfExport; // to allow calling the static methods above
1139
1147 static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry &geom, double minSize );
1148
1150};
1151
1152
1153#endif // QGSPALLABELING_H
AngleUnit
Units of angles.
Definition qgis.h:5138
@ Degrees
Degrees.
Definition qgis.h:5139
LabelOffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
Definition qgis.h:1241
@ FromPoint
Offset distance applies from point geometry.
Definition qgis.h:1242
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
Definition qgis.h:1194
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Definition qgis.h:1195
@ AllowPlacementInsideOfPolygon
Labels can be placed inside a polygon feature.
Definition qgis.h:1302
QFlags< LabelPolygonPlacementFlag > LabelPolygonPlacementFlags
Polygon placement flags, which control how candidates are generated for a polygon feature.
Definition qgis.h:1312
UnplacedLabelVisibility
Unplaced label visibility.
Definition qgis.h:1155
@ FollowEngineSetting
Respect the label engine setting.
Definition qgis.h:1156
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:358
@ Point
Points.
Definition qgis.h:359
@ Unknown
Unknown types.
Definition qgis.h:362
LabelMultiLineAlignment
Text alignment for multi-line labels.
Definition qgis.h:1338
@ FollowPlacement
Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right ...
Definition qgis.h:1342
RenderUnit
Rendering size units.
Definition qgis.h:5183
@ Millimeters
Millimeters.
Definition qgis.h:5184
UpsideDownLabelHandling
Handling techniques for upside down labels.
Definition qgis.h:1323
@ FlipUpsideDownLabels
Upside-down labels (90 <= angle < 270) are shown upright.
Definition qgis.h:1324
Abstract base class for callout renderers.
Definition qgscallout.h:55
Represents a coordinate reference system (CRS).
Handles coordinate transforms between two coordinate systems.
Stores the settings for rendering of all diagrams for a layer.
Exports QGIS layers to the DXF format.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Handles parsing and evaluation of expressions (formerly called "search strings").
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
Container of fields for a vector layer.
Definition qgsfields.h:46
A geometry is the spatial representation of a feature.
Describes a feature that should be used within the labeling engine.
Contains settings related to how the label engine places and formats labels for line features (or pol...
Contains settings related to how the label engine treats features as obstacles.
Contains general settings related to how labels are placed.
Contains settings related to how the label engine places and formats labels for point-like features.
Queries the labeling structure at a given point.
Contains settings related to how the label engine removes candidate label positions and reduces the n...
Provides map labeling functionality.
Base class for all map layer types.
Definition qgsmaplayer.h:80
Contains configuration for rendering maps.
Perform transforms between map coordinates and device coordinates.
Struct for storing maximum and minimum scales for measurements in map units.
PAL labeling utilities.
friend class QgsVectorLayerLabelProvider
friend class QgsDxfExport
static QStringList splitToLines(const QString &text, const QString &wrapCharacter, int autoWrapLength=0, bool useMaxLineLengthWhenAutoWrapping=true)
Splits a text string to a list of separate lines, using a specified wrap character (wrapCharacter).
static QgsGeometry prepareGeometry(const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
Prepares a geometry for registration with PAL.
static bool geometryRequiresPreparation(const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
Checks whether a geometry requires preparation before registration with PAL.
friend class QgsPalLayerSettings
static bool staticWillUseLayer(const QgsMapLayer *layer)
Called to find out whether a specified layer is used for labeling.
static QStringList splitToGraphemes(const QString &text)
Splits a text string to a list of graphemes, which are the smallest allowable character divisions in ...
Contains settings for how a map layer will be labeled.
bool fitInPolygonOnly
true if only labels which completely fit within a polygon are allowed.
double yOffset
Vertical offset of label.
QgsMapUnitScale labelOffsetMapUnitScale
Map unit scale for label offset.
const QgsLabelObstacleSettings & obstacleSettings() const
Returns the label obstacle settings.
int fontMaxPixelSize
Maximum pixel size for showing rendered map unit labels (1 - 10000).
void setObstacleSettings(const QgsLabelObstacleSettings &settings)
Sets the label obstacle settings.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the label's property collection, used for data defined overrides.
const QgsLabelPlacementSettings & placementSettings() const
Returns the label placement settings.
double maxCurvedCharAngleIn
Maximum angle between inside curved label characters (valid range 20.0 to 60.0).
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...
const QgsMapToPixel * xform
void setPolygonPlacementFlags(Qgis::LabelPolygonPlacementFlags flags)
Sets the polygon placement flags, which dictate how polygon labels can be placed.
QString wrapChar
Wrapping character string.
Qgis::LabelOffsetType offsetType
Offset type for layer (only applies in certain placement modes).
double xOffset
Horizontal offset of label.
Qgis::LabelPlacement placement
Label placement mode.
QgsCoordinateTransform ct
bool drawLabels
Whether to draw labels for this layer.
bool fontLimitPixelSize
true if label sizes should be limited by pixel size.
QgsExpression * getLabelExpression()
Returns the QgsExpression for this label settings.
QString legendString() const
legendString
friend class QgsVectorLayer
double minimumScale
The minimum map scale (i.e.
Q_DECL_DEPRECATED void calculateLabelSize(const QFontMetricsF *fm, const QString &text, double &labelX, double &labelY, const QgsFeature *f=nullptr, QgsRenderContext *context=nullptr, double *rotatedLabelX=nullptr, double *rotatedLabelY=nullptr)
Calculates the space required to render the provided text in map units.
QgsLabelPointSettings & pointSettings()
Returns the label point settings, which contain settings related to how the label engine places and f...
QgsPalLayerSettings & operator=(const QgsPalLayerSettings &s)
copy operator - only copies the permanent members
void setLineSettings(const QgsLabelLineSettings &settings)
Sets the label line settings, which contain settings related to how the label engine places and forma...
bool scaleVisibility
Set to true to limit label visibility to a range of scales.
double repeatDistance
Distance for repeating labels for a single feature.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the label's property collection, used for data defined overrides.
QgsLabelLineSettings & lineSettings()
Returns the label line settings, which contain settings related to how the label engine places and fo...
bool geometryGeneratorEnabled
Defines if the geometry generator is enabled or not. If disabled, the standard geometry will be taken...
Qgis::LabelMultiLineAlignment multilineAlign
Horizontal alignment of multi-line labels.
bool centroidInside
true if centroid positioned labels must be placed inside their corresponding feature polygon,...
int priority
Label priority.
Qgis::GeometryType geometryGeneratorType
The type of the result geometry of the geometry generator.
bool labelPerPart
true if every part of a multi-part feature should be labeled.
QgsCallout * callout() const
Returns the label callout renderer, responsible for drawing label callouts.
int fontMinPixelSize
Minimum pixel size for showing rendered map unit labels (1 - 1000).
double angleOffset
Label rotation, in degrees clockwise.
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0).
const QgsLabelThinningSettings & thinningSettings() const
Returns the label thinning settings.
Qgis::AngleUnit rotationUnit() const
Unit for rotation of labels.
Qgis::GeometryType layerType
Geometry type of layers associated with these settings.
void setLegendString(const QString &legendString)
setLegendString
void setThinningSettings(const QgsLabelThinningSettings &settings)
Sets the label thinning settings.
Qgis::RenderUnit offsetUnits
Units for offsets of label.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the label's property collection, used for data defined overrides.
bool isExpression
true if this label is made from a expression string, e.g., FieldName || 'mm'
bool preserveRotation
True if label rotation should be preserved during label pin/unpin operations.
void setPlacementSettings(const QgsLabelPlacementSettings &settings)
Sets the label placement settings.
bool plusSign
Whether '+' signs should be prepended to positive numeric labels.
QgsLabelThinningSettings & thinningSettings()
Returns the label thinning settings.
QString geometryGenerator
The geometry generator expression. Null if disabled.
const QgsLabelLineSettings & lineSettings() const
Returns the label line settings, which contain settings related to how the label engine places and fo...
QgsMapUnitScale distMapUnitScale
Map unit scale for label feature distance.
QgsStringReplacementCollection substitutions
Substitution collection for automatic text substitution with labels.
Q_DECL_DEPRECATED QColor previewBkgrdColor
const QgsFeature * mCurFeat
int decimals
Number of decimal places to show for numeric labels.
double dist
Distance from feature to the label.
void setRotationUnit(Qgis::AngleUnit angleUnit)
Set unit for rotation of labels.
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
Qgis::RenderUnit distUnits
Units the distance from feature to the label.
bool centroidWhole
true if feature centroid should be calculated from the whole feature, or false if only the visible pa...
Property
Data definable properties.
Qgis::RenderUnit repeatDistanceUnit
Units for repeating labels for a single feature.
Qgis::UpsideDownLabelHandling upsidedownLabels
Controls whether upside down labels are displayed and how they are handled.
QString fieldName
Name of field (or an expression) to use for label text.
void setPointSettings(const QgsLabelPointSettings &settings)
Sets the label point settings, which contain settings related to how the label engine places and form...
bool formatNumbers
Set to true to format numeric label text as numbers (e.g.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc.
QgsLabelPlacementSettings & placementSettings()
Returns the label placement settings.
double maximumScale
The maximum map scale (i.e.
int autoWrapLength
If non-zero, indicates that label text should be automatically wrapped to (ideally) the specified num...
bool useMaxLineLengthForAutoWrap
If true, indicates that when auto wrapping label text the autoWrapLength length indicates the maximum...
const QgsLabelPointSettings & pointSettings() const
Returns the label point settings, which contain settings related to how the label engine places and f...
Qgis::LabelPolygonPlacementFlags polygonPlacementFlags() const
Returns the polygon placement flags, which dictate how polygon labels can be placed.
QgsLabelObstacleSettings & obstacleSettings()
Returns the label obstacle settings.
bool useSubstitutions
True if substitutions should be applied.
Represents a 2D point.
Definition qgspointxy.h:60
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Stores properties relating to a screen.
A collection of string replacements (specified using QgsStringReplacement objects).
Abstract base class for all rendered symbols.
Definition qgssymbol.h:231
Contains pre-calculated metrics of a QgsTextDocument.
Represents a document consisting of one or more QgsTextBlock objects.
Container for all settings relating to text rendering.
Adds extra information to QgsLabelFeature for text labels.
Implements support for diagrams within the labeling engine.
Implements a label provider for vector layers.
Represents a vector layer which manages a vector based dataset.
LabelPosition is a candidate feature label position.
A set of features which influence the labeling process.
Definition layer.h:64
Main Pal labeling class.
Definition pal.h:84
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:268
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:84
#define SIP_INOUT
Definition qgis_sip.h:79
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.