21 #ifndef QGSPALLABELING_H 22 #define QGSPALLABELING_H 24 #include "qgis_core.h" 29 #include <QFontDatabase> 83 QgsLabelPosition(
int id,
double r,
const QVector< QgsPointXY > &corners,
const QgsRectangle &rect,
double w,
double h,
const QString &layer,
const QString &labeltext,
const QFont &labelfont,
bool upside_down,
bool diagram =
false,
bool pinned =
false,
const QString &providerId = QString() )
86 , cornerPoints( corners )
91 , labelText( labeltext )
92 , labelFont( labelfont )
93 , upsideDown( upside_down )
94 , isDiagram( diagram )
96 , providerID( providerId )
111 bool upsideDown =
false;
112 bool isDiagram =
false;
113 bool isPinned =
false;
266 FontLetterSpacing = 28,
267 FontWordSpacing = 29,
271 MultiLineWrapChar = 31,
272 MultiLineHeight = 32,
273 MultiLineAlignment = 33,
277 DirSymbPlacement = 37,
290 BufferJoinStyle = 44,
291 BufferBlendMode = 45,
301 ShapeRotationType = 52,
304 ShapeOffsetUnits = 55,
306 ShapeRadiiUnits = 57,
307 ShapeTransparency = 63,
311 ShapeStrokeColor = 59,
312 ShapeStrokeWidth = 60,
313 ShapeStrokeWidthUnits = 61,
319 ShadowOffsetAngle = 67,
320 ShadowOffsetDist = 68,
321 ShadowOffsetUnits = 69,
323 ShadowRadiusUnits = 71,
324 ShadowTransparency = 72,
328 ShadowBlendMode = 75,
338 CurvedCharAngleInOut = 83,
347 RepeatDistanceUnit = 86,
349 PredefinedPositionOrder = 91,
352 ScaleVisibility = 23,
504 QVector< PredefinedPointPosition > predefinedPositionOrder
SIP_SKIP;
733 void calculateLabelSize(
const QFontMetricsF *fm, QString text,
double &labelX,
double &labelY,
QgsFeature *f =
nullptr,
QgsRenderContext *context =
nullptr );
812 int mFeaturesToLabel = 0;
813 int mFeatsSendingToPal = 0;
814 int mFeatsRegPal = 0;
829 void readOldDataDefinedPropertyMap(
QgsVectorLayer *layer, QDomElement *parentElem );
836 enum DataDefinedValueType
855 bool dataDefinedValEval( DataDefinedValueType valType,
859 void parseTextStyle( QFont &labelFont,
881 QMap<Property, QVariant> dataDefinedValues;
888 QFontDatabase mFontDB;
892 static const QVector< PredefinedPointPosition > DEFAULT_PLACEMENT_ORDER;
894 static void initPropertyDefinitions();
933 QList<QgsLabelPosition> labelsAtPosition(
const QgsPointXY &p )
const;
935 QList<QgsLabelPosition> labelsWithinRect(
const QgsRectangle &r )
const;
996 static QStringList splitToLines(
const QString &text,
const QString &wrapCharacter );
1006 static QStringList splitToGraphemes(
const QString &text );
1011 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1015 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1019 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1023 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1027 const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues );
1045 #endif // QGSPALLABELING_H Label below point, slightly right of center.
Class for parsing and evaluation of expressions (formerly called "search strings").
double xOffset
Horizontal offset of label.
The class is used as a container of context for various read/write operations on other objects...
A rectangle specified with double values.
Label on bottom-left of point.
double maxCurvedCharAngleOut
Maximum angle between outside curved label characters (valid range -20.0 to -95.0) ...
double maximumScale
The maximum map scale (i.e.
QString leftDirectionSymbol
String to use for left direction arrows.
QgsUnitTypes::RenderUnit repeatDistanceUnit
Units for repeating labels for a single feature.
double angleOffset
Label rotation, in degrees clockwise.
bool formatNumbers
Set to true to format numeric label text as numbers (e.g.
A class to query the labeling structure at a given point (small wrapper around pal RTree class) ...
double obstacleFactor
Obstacle factor, where 1.0 = default, < 1.0 more likely to be covered by labels, 1.0 less likely to be covered
Label on top-left of point.
QgsLabelCandidate(const QRectF &r, double c)
PredefinedPointPosition
Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode...
A class to represent a 2D point.
bool obstacle
True if features for layer are obstacles to labels of other layers.
int decimals
Number of decimal places to show for numeric labels.
double repeatDistance
Distance for repeating labels for a single feature.
Candidates are placed in predefined positions around a point. Preference is given to positions with g...
QuadrantPosition quadOffset
Sets the quadrant in which to offset labels from feature.
QgsUnitTypes::RenderUnit offsetUnits
Units for offsets of label.
double yOffset
Vertical offset of label.
Class that adds extra information to QgsLabelFeature for text labels.
Container of fields for a vector layer.
Label on top of point, slightly right of center.
bool addDirectionSymbol
If true, '<' or '>' (or custom strings set via leftDirectionSymbol and rightDirectionSymbol) will be ...
The QgsVectorLayerLabelProvider class implements a label provider for vector layers.
A geometry is the spatial representation of a feature.
bool drawLabels
Whether to draw labels for this layer.
bool mergeLines
True if connected line features with identical label text should be merged prior to generating label ...
QgsMapUnitScale repeatDistanceMapUnitScale
Map unit scale for repeating labels for a single feature.
MultiLineAlign multilineAlign
Horizontal alignment of multi-line labels.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
double maxCurvedCharAngleIn
Maximum angle between inside curved label characters (valid range 20.0 to 60.0).
QgsCoordinateTransform ct
bool reverseDirectionSymbol
True if direction symbols should be reversed.
void setFormat(const QgsTextFormat &format)
Sets the label text formatting settings, e.g., font settings, buffer settings, etc.
double zIndex
Z-Index of label, where labels with a higher z-index are rendered on top of labels with a lower z-ind...
QgsStringReplacementCollection substitutions
Substitution collection for automatic text substitution with labels.
Arranges candidates following the curvature of a line feature. Applies to line layers only...
The QgsMapSettings class contains configuration for rendering of the map.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Place direction symbols on left/right of label.
Perform transforms between map coordinates and device coordinates.
Property
Data definable properties.
ObstacleType obstacleType
Controls how features act as obstacles for labels.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the label's property collection, used for data defined overrides.
bool displayAll
If true, all features will be labelled even when overlaps occur.
Offset distance applies from point geometry.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the label's property collection, used for data defined overrides.
int fontMaxPixelSize
Maximum pixel size for showing rendered map unit labels (1 - 10000).
The QgsVectorLayerDiagramProvider class implements support for diagrams within the labeling engine...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QVector< QgsPointXY > cornerPoints
Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygo...
Upside-down labels (90 <= angle < 270) are shown upright.
OffsetType
Behavior modifier for label offset and distance, only applies in some label placement modes...
Offset distance applies from rendered symbol bounds.
const QgsTextFormat & format() const
Returns the label text formatting settings, e.g., font settings, buffer settings, etc...
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
int maxNumLabels
The maximum number of labels which should be drawn for this layer.
Place direction symbols on above label.
Stores the settings for rendering of all diagrams for a layer.
bool plusSign
Whether '+' signs should be prepended to positive numeric labels.
unsigned int placementFlags
QString wrapChar
Wrapping character string.
Placement
Placement modes which determine how label candidates are generated for a feature. ...
QString rightDirectionSymbol
String to use for right direction arrows.
The QgsLabelingEngine class provides map labeling functionality.
bool preserveRotation
True if label rotation should be preserved during label pin/unpin operations.
Arranges candidates 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.
bool centroidWhole
True if feature centroid should be calculated from the whole feature, or false if only the visible pa...
bool scaleVisibility
Set to true to limit label visibility to a range of scales.
The QgsLabelFeature class describes a feature that should be used within the labeling engine...
QgsMapUnitScale distMapUnitScale
Map unit scale for label feature distance.
Struct for storing maximum and minimum scales for measurements in map units.
bool fitInPolygonOnly
True if only labels which completely fit within a polygon are allowed.
A collection of string replacements (specified using QgsStringReplacement objects).
OffsetType offsetType
Offset type for layer (only applies in certain placement modes)
double dist
Distance from feature to the label.
bool useSubstitutions
True if substitutions should be applied.
Label below point, slightly left of center.
LabelPosition is a candidate feature label position.
Label on top of point, slightly left of center.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
bool limitNumLabels
True if the number of labels drawn should be limited.
bool isExpression
True if this label is made from a expression string, e.g., FieldName || 'mm'.
Class that stores computed placement from labeling engine.
LinePlacementFlags
Line placement flags, which control how candidates are generated for a linear feature.
Show upside down when rotation is layer- or data-defined.
Container for all settings relating to text rendering.
bool centroidInside
True if centroid positioned labels must be placed inside their corresponding feature polygon...
QgsLabelPosition(int id, double r, const QVector< QgsPointXY > &corners, const QgsRectangle &rect, double w, double h, const QString &layer, const QString &labeltext, const QFont &labelfont, bool upside_down, bool diagram=false, bool pinned=false, const QString &providerId=QString())
Represents a vector layer which manages a vector based data sets.
double minFeatureSize
Minimum feature size (in millimeters) for a feature to be labelled.
int fontMinPixelSize
Minimum pixel size for showing rendered map unit labels (1 - 1000).
int priority
Label priority.
bool labelPerPart
True if every part of a multi-part feature should be labeled.
QgsUnitTypes::RenderUnit distUnits
Units the distance from feature to the label.
QgsMapUnitScale labelOffsetMapUnitScale
Map unit scale for label offset.
RenderUnit
Rendering size units.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the label's property collection, used for data defined overrides.
double minimumScale
The minimum map scale (i.e.
QString fieldName
Name of field (or an expression) to use for label text.
bool fontLimitPixelSize
True if label sizes should be limited by pixel size.
ObstacleType
Valid obstacle types, which affect how features within the layer will act as obstacles for labels...
DirectionSymbols placeDirectionSymbol
Placement option for direction symbols.
Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the pol...