QGIS API Documentation 4.1.0-Master (60fea48833c)
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} //namespace pal
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(
651 const QFontMetricsF *fm,
652 const QString &text,
653 double &labelX,
654 double &labelY,
655 const QgsFeature *f = nullptr,
656 QgsRenderContext *context = nullptr,
657 double *rotatedLabelX SIP_OUT = nullptr,
658 double *rotatedLabelY SIP_OUT = nullptr
660
670 void registerFeature( const QgsFeature &f, QgsRenderContext &context );
671
672#ifndef SIP_RUN
673
690 std::vector< std::unique_ptr< QgsLabelFeature > > registerFeatureWithDetails(
691 const QgsFeature &feature, QgsRenderContext &context, QgsGeometry obstacleGeometry = QgsGeometry(), const QgsSymbol *symbol = nullptr
692 );
693
694#endif
695
699 void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
700
704 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
705
710 QgsPropertyCollection &dataDefinedProperties() { return mDataDefinedProperties; }
711
718 const QgsPropertyCollection &dataDefinedProperties() const SIP_SKIP { return mDataDefinedProperties; }
719
726 void setDataDefinedProperties( const QgsPropertyCollection &collection ) { mDataDefinedProperties = collection; }
727
732 const QgsTextFormat &format() const { return mFormat; }
733
739 void setFormat( const QgsTextFormat &format ) { mFormat = format; }
740
749 QgsCallout *callout() const { return mCallout.get(); }
750
759 void setCallout( QgsCallout *callout SIP_TRANSFER );
760
769 const QgsLabelLineSettings &lineSettings() const SIP_SKIP { return mLineSettings; }
770
778 QgsLabelLineSettings &lineSettings() { return mLineSettings; }
779
787 void setLineSettings( const QgsLabelLineSettings &settings ) { mLineSettings = settings; }
788
798 const QgsLabelPointSettings &pointSettings() const SIP_SKIP { return mPointSettings; }
799
808 QgsLabelPointSettings &pointSettings() { return mPointSettings; }
809
818 void setPointSettings( const QgsLabelPointSettings &settings ) { mPointSettings = settings; }
819
826 const QgsLabelObstacleSettings &obstacleSettings() const SIP_SKIP { return mObstacleSettings; }
827
833 QgsLabelObstacleSettings &obstacleSettings() { return mObstacleSettings; }
834
840 void setObstacleSettings( const QgsLabelObstacleSettings &settings ) { mObstacleSettings = settings; }
841
848 const QgsLabelThinningSettings &thinningSettings() const SIP_SKIP { return mThinningSettings; }
849
855 QgsLabelThinningSettings &thinningSettings() { return mThinningSettings; }
856
862 void setThinningSettings( const QgsLabelThinningSettings &settings ) { mThinningSettings = settings; }
863
870 const QgsLabelPlacementSettings &placementSettings() const SIP_SKIP { return mPlacementSettings; }
871
877 QgsLabelPlacementSettings &placementSettings() { return mPlacementSettings; }
878
884 void setPlacementSettings( const QgsLabelPlacementSettings &settings ) { mPlacementSettings = settings; }
885
895 static QPixmap labelSettingsPreviewPixmap(
896 const QgsPalLayerSettings &settings, QSize size, const QString &previewText = QString(), int padding = 0, const QgsScreenProperties &screen = QgsScreenProperties()
897 );
898
905 Qgis::UnplacedLabelVisibility unplacedVisibility() const;
906
913 void setUnplacedVisibility( Qgis::UnplacedLabelVisibility visibility );
914
922 QMimeData *toMimeData() const SIP_FACTORY;
923
931 static QgsPalLayerSettings fromMimeData( const QMimeData *data, bool *ok SIP_OUT = nullptr );
932
933 // temporary stuff: set when layer gets prepared or labeled
934 const QgsFeature *mCurFeat = nullptr;
936 int fieldIndex = 0;
937 const QgsMapToPixel *xform = nullptr;
939
943 int mFeaturesToLabel = 0; // total features that will probably be labeled, may be less (figured before PAL)
944#ifndef SIP_RUN
945 mutable int mFeatsSendingToPal = 0; // total features tested for sending into PAL (relative to maxNumLabels)
946 mutable int mFeatsRegPal = 0; // number of features registered in PAL, when using limitNumLabels
947#else
948 int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
949 int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
950#endif
951
952 private:
953 friend class QgsVectorLayer; // to allow calling readFromLayerCustomProperties()
954
958 void readFromLayerCustomProperties( QgsVectorLayer *layer );
959
963 void readOldDataDefinedPropertyMap( QgsVectorLayer *layer, QDomElement *parentElem );
964
968 void readOldDataDefinedProperty( QgsVectorLayer *layer, QgsPalLayerSettings::Property p );
969
977 void calculateLabelMetrics(
978 const QFontMetricsF &fm, QgsRenderContext &context, const QgsTextFormat &format, QgsTextDocument &document, QgsTextDocumentMetrics &documentMetrics, QSizeF &size, QSizeF &rotatedSize, QRectF &outerBounds
979 ) const;
980
981
982 enum DataDefinedValueType
983 {
984 DDBool,
985 DDInt,
986 DDIntPos,
987 DDDouble,
988 DDDoublePos,
989 DDRotation180,
990 DDOpacity,
991 DDString,
992 DDUnits,
993 DDColor,
994 DDJoinStyle,
995 DDBlendMode,
996 DDPointF,
997 DDSizeF,
998 };
999
1000 // convenience data defined evaluation function
1001 bool dataDefinedValEval( DataDefinedValueType valType, QgsPalLayerSettings::Property p, QVariant &exprVal, QgsExpressionContext &context, const QVariant &originalValue = QVariant() );
1002
1003 void parseTextStyle( QFont &labelFont, Qgis::RenderUnit fontunits, QgsRenderContext &context );
1004
1005 void parseTextBuffer( QgsRenderContext &context );
1006
1007 void parseTextMask( QgsRenderContext &context );
1008
1009 void parseTextFormatting( QgsRenderContext &context );
1010
1011 void parseShapeBackground( QgsRenderContext &context );
1012
1013 void parseDropShadow( QgsRenderContext &context );
1014
1019 bool checkMinimumSizeMM( const QgsRenderContext &ct, const QgsGeometry &geom, double minSize ) const;
1020
1026 bool isLabelVisible( QgsRenderContext &context ) const;
1027
1034 QgsTextFormat evaluateTextFormat( QgsRenderContext &context, bool &labelIsHidden );
1035
1041 bool evaluateLabelContent( const QgsFeature &feature, QgsRenderContext &context, bool allowMultipleLines, QString &labelText, QgsTextDocument &document, const QgsTextFormat &format ) const;
1042
1046 QgsGeometry evaluateLabelGeometry( const QgsFeature &feature, QgsRenderContext &context, const QgsLabelLineSettings &lineSettings ) const;
1047
1048 std::unique_ptr< QgsTextLabelFeature> generateLabelFeature(
1049 QgsRenderContext &context,
1050 const QgsFeature &feature,
1051 int subPartId,
1052 QgsGeometry geom,
1053 const QgsGeometry &obstacleGeometry,
1054 QgsTextDocument doc,
1055 const QString &labelText,
1056 const QgsTextFormat &evaluatedFormat,
1057 const QgsSymbol *symbol,
1058 const QgsLabelLineSettings &lineSettings,
1059 const QgsLabelPointSettings &pointSettings,
1060 const QgsLabelPlacementSettings &placementSettings,
1061 bool isObstacle,
1062 bool doClip
1063 ) const;
1064
1068 std::unique_ptr< QgsLabelFeature > registerObstacleFeature( const QgsFeature &f, QgsRenderContext &context, const QgsGeometry &obstacleGeometry = QgsGeometry() );
1069
1070 QMap<Property, QVariant> dataDefinedValues;
1071
1073 QgsPropertyCollection mDataDefinedProperties;
1074
1075 mutable std::unique_ptr<QgsExpression> expression;
1076
1077 std::unique_ptr< QFontDatabase > mFontDB;
1078
1079 QgsTextFormat mFormat;
1080
1081 std::unique_ptr< QgsCallout > mCallout;
1082
1083 QgsLabelPlacementSettings mPlacementSettings;
1084 QgsLabelLineSettings mLineSettings;
1085 QgsLabelPointSettings mPointSettings;
1086 QgsLabelObstacleSettings mObstacleSettings;
1087 QgsLabelThinningSettings mThinningSettings;
1088
1090
1091 QgsExpression mGeometryGeneratorExpression;
1092
1093 bool mRenderStarted = false;
1094
1095 QString mLegendString = QObject::tr( "Aa" );
1096
1098
1101
1102 static void initPropertyDefinitions();
1103};
1104
1105
1111class CORE_EXPORT QgsPalLabeling
1112{
1113 public:
1117 static bool staticWillUseLayer( const QgsMapLayer *layer );
1118
1119 // clang-format off
1129 static QgsGeometry prepareGeometry( const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false ) SIP_FACTORY;
1130 // clang-format on
1131
1141 static bool geometryRequiresPreparation(
1142 const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry = QgsGeometry(), bool mergeLines = false
1143 );
1144
1156 static QStringList splitToLines( const QString &text, const QString &wrapCharacter, int autoWrapLength = 0, bool useMaxLineLengthWhenAutoWrapping = true );
1157
1165 static QStringList splitToGraphemes( const QString &text );
1166
1167 private:
1169 static void dataDefinedTextStyle( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1170
1172 static void dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1173
1175 static void dataDefinedTextBuffer( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1176
1178 static void dataDefinedTextMask( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1179
1181 static void dataDefinedShapeBackground( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1182
1184 static void dataDefinedDropShadow( QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1185
1186 friend class QgsVectorLayerLabelProvider; // to allow calling the static methods above
1187 friend class QgsDxfExport; // to allow calling the static methods above
1188
1196 static bool checkMinimumSizeMM( const QgsRenderContext &context, const QgsGeometry &geom, double minSize );
1197
1199};
1200
1201
1202#endif // QGSPALLABELING_H
AngleUnit
Units of angles.
Definition qgis.h:5295
@ Degrees
Degrees.
Definition qgis.h:5296
LabelOffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes.
Definition qgis.h:1306
@ FromPoint
Offset distance applies from point geometry.
Definition qgis.h:1307
LabelPlacement
Placement modes which determine how label candidates are generated for a feature.
Definition qgis.h:1232
@ AroundPoint
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Definition qgis.h:1233
@ AllowPlacementInsideOfPolygon
Labels can be placed inside a polygon feature.
Definition qgis.h:1367
QFlags< LabelPolygonPlacementFlag > LabelPolygonPlacementFlags
Polygon placement flags, which control how candidates are generated for a polygon feature.
Definition qgis.h:1377
UnplacedLabelVisibility
Unplaced label visibility.
Definition qgis.h:1181
@ FollowEngineSetting
Respect the label engine setting.
Definition qgis.h:1182
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:379
@ Point
Points.
Definition qgis.h:380
@ Unknown
Unknown types.
Definition qgis.h:383
LabelMultiLineAlignment
Text alignment for multi-line labels.
Definition qgis.h:1403
@ FollowPlacement
Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right ...
Definition qgis.h:1407
RenderUnit
Rendering size units.
Definition qgis.h:5340
@ Millimeters
Millimeters.
Definition qgis.h:5341
UpsideDownLabelHandling
Handling techniques for upside down labels.
Definition qgis.h:1388
@ FlipUpsideDownLabels
Upside-down labels (90 <= angle < 270) are shown upright.
Definition qgis.h:1389
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:60
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:83
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:62
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:227
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:87
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:267
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_OUT
Definition qgis_sip.h:57
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_INOUT
Definition qgis_sip.h:78
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.