QGIS API Documentation 3.99.0-Master (a8882ad4560)
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
216 // TODO QGIS 5.0 - rename this
217 LabelAllParts = 103,
218
219 PolygonLabelOutside = 109,
220 LineAnchorPercent = 111,
221 LineAnchorClipping = 112,
222 LineAnchorType = 115,
223 LineAnchorTextPoint = 116,
224 CurvedLabelMode = 124,
225
226 // rendering
227 ScaleVisibility = 23,
228 MinScale = 16,
229 MinimumScale = 97,
230 MaxScale = 17,
231 MaximumScale = 98,
232 FontLimitPixel = 24,
233 FontMinPixel = 25,
234 FontMaxPixel = 26,
235 IsObstacle = 88,
236 ObstacleFactor = 89,
237 ZIndex = 90,
238 CalloutDraw = 100,
239
240 AllowDegradedPlacement = 117,
241 OverlapHandling = 118,
242 WhitespaceCollisionHandling = 125,
243
244 LabelMarginDistance = 121,
245 RemoveDuplicateLabels = 122,
246 RemoveDuplicateLabelDistance = 123,
247
248 // (data defined only)
249 Show = 15,
250 AlwaysShow = 20
251 };
252 // *INDENT-ON*
253
265 bool prepare( QgsRenderContext &context, QSet<QString> &attributeNames SIP_INOUT, const QgsFields &fields, const QgsMapSettings &mapSettings, const QgsCoordinateReferenceSystem &crs );
266
271 QSet<QString> referencedFields( const QgsRenderContext &context ) const;
272
281 void startRender( QgsRenderContext &context );
282
290 void stopRender( QgsRenderContext &context );
291
297 bool containsAdvancedEffects() const;
298
302 static const QgsPropertiesDefinition &propertyDefinitions();
303
311 bool drawLabels = true;
312
313 //-- text style
314
320 QString fieldName;
321
326 bool isExpression = false;
327
332
336 Q_DECL_DEPRECATED QColor previewBkgrdColor = Qt::white;
337
341 bool useSubstitutions = false;
342
343 //-- text formatting
344
349 QString wrapChar;
350
359
371
374
381 bool formatNumbers = false;
382
388 int decimals = 3;
389
395 bool plusSign = false;
396
397 //-- placement
398
401
408 Qgis::LabelPolygonPlacementFlags polygonPlacementFlags() const { return mPolygonPlacementFlags; }
409
416 void setPolygonPlacementFlags( Qgis::LabelPolygonPlacementFlags flags ) { mPolygonPlacementFlags = flags; }
417
422 bool centroidWhole = false;
423
429 bool centroidInside = false;
430
434 bool fitInPolygonOnly = false;
435
441 double dist = 0;
442
449
456
459
465 double repeatDistance = 0;
466
473
480
487 double xOffset = 0;
488
495 double yOffset = 0;
496
504
512
514 double angleOffset = 0;
515
517 bool preserveRotation = true;
518
525
531 void setRotationUnit( Qgis::AngleUnit angleUnit );
532
537 double maxCurvedCharAngleIn = 25.0;
538
543 double maxCurvedCharAngleOut = -25.0;
544
549 int priority = 5;
550
551 //-- rendering
552
558 bool scaleVisibility = false;
559
570 double maximumScale = 0;
571
582 double minimumScale = 0;
583
589 bool fontLimitPixelSize = false;
590
597
603 int fontMaxPixelSize = 10000;
604
607
609 double zIndex = 0;
610
613
616
619
625
630 void setLegendString( const QString &legendString ) { mLegendString = legendString; }
631
636 QString legendString() const { return mLegendString; }
637
650 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;
651
661 void registerFeature( const QgsFeature &f, QgsRenderContext &context );
662
663#ifndef SIP_RUN
664
681 std::vector< std::unique_ptr< QgsLabelFeature > > registerFeatureWithDetails( const QgsFeature &feature, QgsRenderContext &context,
682 QgsGeometry obstacleGeometry = QgsGeometry(), const QgsSymbol *symbol = nullptr );
683
684#endif
685
689 void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
690
694 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
695
700 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
701
708 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
709
716 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
717
722 const QgsTextFormat &format() const { return mFormat; }
723
729 void setFormat( const QgsTextFormat &format ) { mFormat = format; }
730
739 QgsCallout *callout() const { return mCallout.get(); }
740
749 void setCallout( QgsCallout *callout SIP_TRANSFER );
750
759 const QgsLabelLineSettings &lineSettings() const SIP_SKIP { return mLineSettings; }
760
768 QgsLabelLineSettings &lineSettings() { return mLineSettings; }
769
777 void setLineSettings( const QgsLabelLineSettings &settings ) { mLineSettings = settings; }
778
788 const QgsLabelPointSettings &pointSettings() const SIP_SKIP { return mPointSettings; }
789
798 QgsLabelPointSettings &pointSettings() { return mPointSettings; }
799
808 void setPointSettings( const QgsLabelPointSettings &settings ) { mPointSettings = settings; }
809
816 const QgsLabelObstacleSettings &obstacleSettings() const SIP_SKIP { return mObstacleSettings; }
817
823 QgsLabelObstacleSettings &obstacleSettings() { return mObstacleSettings; }
824
830 void setObstacleSettings( const QgsLabelObstacleSettings &settings ) { mObstacleSettings = settings; }
831
838 const QgsLabelThinningSettings &thinningSettings() const SIP_SKIP { return mThinningSettings; }
839
845 QgsLabelThinningSettings &thinningSettings() { return mThinningSettings; }
846
852 void setThinningSettings( const QgsLabelThinningSettings &settings ) { mThinningSettings = settings; }
853
860 const QgsLabelPlacementSettings &placementSettings() const SIP_SKIP { return mPlacementSettings; }
861
867 QgsLabelPlacementSettings &placementSettings() { return mPlacementSettings; }
868
874 void setPlacementSettings( const QgsLabelPlacementSettings &settings ) { mPlacementSettings = settings; }
875
885 static QPixmap labelSettingsPreviewPixmap( const QgsPalLayerSettings &settings, QSize size, const QString &previewText = QString(), int padding = 0, const QgsScreenProperties &screen = QgsScreenProperties() );
886
893 Qgis::UnplacedLabelVisibility unplacedVisibility() const;
894
901 void setUnplacedVisibility( Qgis::UnplacedLabelVisibility visibility );
902
910 QMimeData *toMimeData() const SIP_FACTORY;
911
919 static QgsPalLayerSettings fromMimeData( const QMimeData *data, bool *ok SIP_OUT = nullptr );
920
921 // temporary stuff: set when layer gets prepared or labeled
922 const QgsFeature *mCurFeat = nullptr;
924 int fieldIndex = 0;
925 const QgsMapToPixel *xform = nullptr;
927
931 int mFeaturesToLabel = 0; // total features that will probably be labeled, may be less (figured before PAL)
932#ifndef SIP_RUN
933 mutable int mFeatsSendingToPal = 0; // total features tested for sending into PAL (relative to maxNumLabels)
934 mutable int mFeatsRegPal = 0; // number of features registered in PAL, when using limitNumLabels
935#else
936 int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
937 int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
938#endif
939
940 private:
941
942 friend class QgsVectorLayer; // to allow calling readFromLayerCustomProperties()
943
947 void readFromLayerCustomProperties( QgsVectorLayer *layer );
948
952 void readOldDataDefinedPropertyMap( QgsVectorLayer *layer, QDomElement *parentElem );
953
957 void readOldDataDefinedProperty( QgsVectorLayer *layer, QgsPalLayerSettings::Property p );
958
966 void calculateLabelMetrics( const QFontMetricsF &fm, QgsRenderContext &context,
967 const QgsTextFormat &format,
968 QgsTextDocument &document,
969 QgsTextDocumentMetrics &documentMetrics,
970 QSizeF &size, QSizeF &rotatedSize,
971 QRectF &outerBounds ) const;
972
973
974 enum DataDefinedValueType
975 {
976 DDBool,
977 DDInt,
978 DDIntPos,
979 DDDouble,
980 DDDoublePos,
981 DDRotation180,
982 DDOpacity,
983 DDString,
984 DDUnits,
985 DDColor,
986 DDJoinStyle,
987 DDBlendMode,
988 DDPointF,
989 DDSizeF,
990 };
991
992 // convenience data defined evaluation function
993 bool dataDefinedValEval( DataDefinedValueType valType,
995 QVariant &exprVal, QgsExpressionContext &context, const QVariant &originalValue = QVariant() );
996
997 void parseTextStyle( QFont &labelFont,
998 Qgis::RenderUnit fontunits,
999 QgsRenderContext &context );
1000
1001 void parseTextBuffer( QgsRenderContext &context );
1002
1003 void parseTextMask( QgsRenderContext &context );
1004
1005 void parseTextFormatting( QgsRenderContext &context );
1006
1007 void parseShapeBackground( QgsRenderContext &context );
1008
1009 void parseDropShadow( QgsRenderContext &context );
1010
1015 bool checkMinimumSizeMM( const QgsRenderContext &ct, const QgsGeometry &geom, double minSize ) const;
1016
1022 bool isLabelVisible( QgsRenderContext &context ) const;
1023
1030 QgsTextFormat evaluateTextFormat( QgsRenderContext &context, bool &labelIsHidden );
1031
1037 bool evaluateLabelContent( const QgsFeature &feature, QgsRenderContext &context, bool allowMultipleLines, QString &labelText, QgsTextDocument &document, const QgsTextFormat &format ) const;
1038
1042 QgsGeometry evaluateLabelGeometry( const QgsFeature &feature, QgsRenderContext &context, const QgsLabelLineSettings &lineSettings ) const;
1043
1044 std::unique_ptr< QgsTextLabelFeature> generateLabelFeature( QgsRenderContext &context, const QgsFeature &feature, int subPartId, QgsGeometry geom, const QgsGeometry &obstacleGeometry, QgsTextDocument doc, const QString &labelText, const QgsTextFormat &evaluatedFormat, const QgsSymbol *symbol, const QgsLabelLineSettings &lineSettings, const QgsLabelPointSettings &pointSettings, const QgsLabelPlacementSettings &placementSettings, bool isObstacle, bool doClip ) const;
1045
1049 std::unique_ptr< QgsLabelFeature > registerObstacleFeature( const QgsFeature &f, QgsRenderContext &context, const QgsGeometry &obstacleGeometry = QgsGeometry() );
1050
1051 QMap<Property, QVariant> dataDefinedValues;
1052
1054 QgsPropertyCollection mDataDefinedProperties;
1055
1056 mutable std::unique_ptr<QgsExpression> expression;
1057
1058 std::unique_ptr< QFontDatabase > mFontDB;
1059
1060 QgsTextFormat mFormat;
1061
1062 std::unique_ptr< QgsCallout > mCallout;
1063
1064 QgsLabelPlacementSettings mPlacementSettings;
1065 QgsLabelLineSettings mLineSettings;
1066 QgsLabelPointSettings mPointSettings;
1067 QgsLabelObstacleSettings mObstacleSettings;
1068 QgsLabelThinningSettings mThinningSettings;
1069
1071
1072 QgsExpression mGeometryGeneratorExpression;
1073
1074 bool mRenderStarted = false;
1075
1076 QString mLegendString = QObject::tr( "Aa" );
1077
1079
1082
1083 static void initPropertyDefinitions();
1084};
1085
1086
1092class CORE_EXPORT QgsPalLabeling
1093{
1094 public:
1095
1099 static bool staticWillUseLayer( const QgsMapLayer *layer );
1100
1110 static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) SIP_FACTORY;
1111
1121 static bool geometryRequiresPreparation( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false );
1122
1134 static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
1135
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 dataDefinedTextMask( QgsPalLayerSettings &tmpLyr,
1160 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1161
1163 static void dataDefinedShapeBackground( QgsPalLayerSettings &tmpLyr,
1164 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1165
1167 static void dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr,
1168 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1169
1170 friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
1171 friend class QgsDxfExport; // to allow calling the static methods above
1172
1180 static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry &geom, double minSize );
1181
1183};
1184
1185
1186#endif // QGSPALLABELING_H
AngleUnit
Units of angles.
Definition qgis.h:5198
@ Degrees
Degrees.
Definition qgis.h:5199
LabelOffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
Definition qgis.h:1287
@ FromPoint
Offset distance applies from point geometry.
Definition qgis.h:1288
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
Definition qgis.h:1213
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Definition qgis.h:1214
@ AllowPlacementInsideOfPolygon
Labels can be placed inside a polygon feature.
Definition qgis.h:1348
QFlags< LabelPolygonPlacementFlag > LabelPolygonPlacementFlags
Polygon placement flags, which control how candidates are generated for a polygon feature.
Definition qgis.h:1358
UnplacedLabelVisibility
Unplaced label visibility.
Definition qgis.h:1162
@ FollowEngineSetting
Respect the label engine setting.
Definition qgis.h:1163
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:365
@ Point
Points.
Definition qgis.h:366
@ Unknown
Unknown types.
Definition qgis.h:369
LabelMultiLineAlignment
Text alignment for multi-line labels.
Definition qgis.h:1384
@ FollowPlacement
Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right ...
Definition qgis.h:1388
RenderUnit
Rendering size units.
Definition qgis.h:5243
@ Millimeters
Millimeters.
Definition qgis.h:5244
UpsideDownLabelHandling
Handling techniques for upside down labels.
Definition qgis.h:1369
@ FlipUpsideDownLabels
Upside-down labels (90 <= angle < 270) are shown upright.
Definition qgis.h:1370
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.
QString legendString() const
legendString
friend class QgsVectorLayer
double minimumScale
The minimum map scale (i.e.
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...
QgsExpression * getLabelExpression() const
Returns the QgsExpression for this label settings.
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.
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:63
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.