mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-24 00:05:18 -05:00
Move more labeling enums to qgis
This commit is contained in:
parent
0c4b30a4c5
commit
486d3611ae
@ -500,6 +500,156 @@ Qgis.LabelOverlapHandling.AllowOverlapAtNoCost.__doc__ = "Labels may freely over
|
||||
Qgis.LabelOverlapHandling.__doc__ = 'Label overlap handling.\n\n.. versionadded:: 3.26\n\n' + '* ``PreventOverlap``: ' + Qgis.LabelOverlapHandling.PreventOverlap.__doc__ + '\n' + '* ``AllowOverlapIfRequired``: ' + Qgis.LabelOverlapHandling.AllowOverlapIfRequired.__doc__ + '\n' + '* ``AllowOverlapAtNoCost``: ' + Qgis.LabelOverlapHandling.AllowOverlapAtNoCost.__doc__
|
||||
# --
|
||||
Qgis.LabelOverlapHandling.baseClass = Qgis
|
||||
QgsPalLayerSettings.Placement = Qgis.LabelPlacement
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.AroundPoint = Qgis.LabelPlacement.AroundPoint
|
||||
QgsPalLayerSettings.AroundPoint.is_monkey_patched = True
|
||||
QgsPalLayerSettings.AroundPoint.__doc__ = "Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygon layers only."
|
||||
QgsPalLayerSettings.OverPoint = Qgis.LabelPlacement.OverPoint
|
||||
QgsPalLayerSettings.OverPoint.is_monkey_patched = True
|
||||
QgsPalLayerSettings.OverPoint.__doc__ = "Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point. Applies to point or polygon layers only."
|
||||
QgsPalLayerSettings.Line = Qgis.LabelPlacement.Line
|
||||
QgsPalLayerSettings.Line.is_monkey_patched = True
|
||||
QgsPalLayerSettings.Line.__doc__ = "Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon's perimeter. Applies to line or polygon layers only."
|
||||
QgsPalLayerSettings.Curved = Qgis.LabelPlacement.Curved
|
||||
QgsPalLayerSettings.Curved.is_monkey_patched = True
|
||||
QgsPalLayerSettings.Curved.__doc__ = "Arranges candidates following the curvature of a line feature. Applies to line layers only."
|
||||
QgsPalLayerSettings.Horizontal = Qgis.LabelPlacement.Horizontal
|
||||
QgsPalLayerSettings.Horizontal.is_monkey_patched = True
|
||||
QgsPalLayerSettings.Horizontal.__doc__ = "Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only."
|
||||
QgsPalLayerSettings.Free = Qgis.LabelPlacement.Free
|
||||
QgsPalLayerSettings.Free.is_monkey_patched = True
|
||||
QgsPalLayerSettings.Free.__doc__ = "Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the polygon's orientation. Applies to polygon layers only."
|
||||
QgsPalLayerSettings.OrderedPositionsAroundPoint = Qgis.LabelPlacement.OrderedPositionsAroundPoint
|
||||
QgsPalLayerSettings.OrderedPositionsAroundPoint.is_monkey_patched = True
|
||||
QgsPalLayerSettings.OrderedPositionsAroundPoint.__doc__ = "Candidates are placed in predefined positions around a point. Preference is given to positions with greatest cartographic appeal, e.g., top right, bottom right, etc. Applies to point layers only."
|
||||
QgsPalLayerSettings.PerimeterCurved = Qgis.LabelPlacement.PerimeterCurved
|
||||
QgsPalLayerSettings.PerimeterCurved.is_monkey_patched = True
|
||||
QgsPalLayerSettings.PerimeterCurved.__doc__ = "Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only."
|
||||
QgsPalLayerSettings.OutsidePolygons = Qgis.LabelPlacement.OutsidePolygons
|
||||
QgsPalLayerSettings.OutsidePolygons.is_monkey_patched = True
|
||||
QgsPalLayerSettings.OutsidePolygons.__doc__ = "Candidates are placed outside of polygon boundaries. Applies to polygon layers only. Since QGIS 3.14"
|
||||
Qgis.LabelPlacement.__doc__ = 'Placement modes which determine how label candidates are generated for a feature.\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.Placement\n\n.. versionadded:: 3.26\n\n' + '* ``AroundPoint``: ' + Qgis.LabelPlacement.AroundPoint.__doc__ + '\n' + '* ``OverPoint``: ' + Qgis.LabelPlacement.OverPoint.__doc__ + '\n' + '* ``Line``: ' + Qgis.LabelPlacement.Line.__doc__ + '\n' + '* ``Curved``: ' + Qgis.LabelPlacement.Curved.__doc__ + '\n' + '* ``Horizontal``: ' + Qgis.LabelPlacement.Horizontal.__doc__ + '\n' + '* ``Free``: ' + Qgis.LabelPlacement.Free.__doc__ + '\n' + '* ``OrderedPositionsAroundPoint``: ' + Qgis.LabelPlacement.OrderedPositionsAroundPoint.__doc__ + '\n' + '* ``PerimeterCurved``: ' + Qgis.LabelPlacement.PerimeterCurved.__doc__ + '\n' + '* ``OutsidePolygons``: ' + Qgis.LabelPlacement.OutsidePolygons.__doc__
|
||||
# --
|
||||
Qgis.LabelPlacement.baseClass = Qgis
|
||||
QgsPalLayerSettings.PredefinedPointPosition = Qgis.LabelPredefinedPointPosition
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.TopLeft = Qgis.LabelPredefinedPointPosition.TopLeft
|
||||
QgsPalLayerSettings.TopLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.TopLeft.__doc__ = "Label on top-left of point"
|
||||
QgsPalLayerSettings.TopSlightlyLeft = Qgis.LabelPredefinedPointPosition.TopSlightlyLeft
|
||||
QgsPalLayerSettings.TopSlightlyLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.TopSlightlyLeft.__doc__ = "Label on top of point, slightly left of center"
|
||||
QgsPalLayerSettings.TopMiddle = Qgis.LabelPredefinedPointPosition.TopMiddle
|
||||
QgsPalLayerSettings.TopMiddle.is_monkey_patched = True
|
||||
QgsPalLayerSettings.TopMiddle.__doc__ = "Label directly above point"
|
||||
QgsPalLayerSettings.TopSlightlyRight = Qgis.LabelPredefinedPointPosition.TopSlightlyRight
|
||||
QgsPalLayerSettings.TopSlightlyRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.TopSlightlyRight.__doc__ = "Label on top of point, slightly right of center"
|
||||
QgsPalLayerSettings.TopRight = Qgis.LabelPredefinedPointPosition.TopRight
|
||||
QgsPalLayerSettings.TopRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.TopRight.__doc__ = "Label on top-right of point"
|
||||
QgsPalLayerSettings.MiddleLeft = Qgis.LabelPredefinedPointPosition.MiddleLeft
|
||||
QgsPalLayerSettings.MiddleLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MiddleLeft.__doc__ = "Label on left of point"
|
||||
QgsPalLayerSettings.MiddleRight = Qgis.LabelPredefinedPointPosition.MiddleRight
|
||||
QgsPalLayerSettings.MiddleRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MiddleRight.__doc__ = "Label on right of point"
|
||||
QgsPalLayerSettings.BottomLeft = Qgis.LabelPredefinedPointPosition.BottomLeft
|
||||
QgsPalLayerSettings.BottomLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.BottomLeft.__doc__ = "Label on bottom-left of point"
|
||||
QgsPalLayerSettings.BottomSlightlyLeft = Qgis.LabelPredefinedPointPosition.BottomSlightlyLeft
|
||||
QgsPalLayerSettings.BottomSlightlyLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.BottomSlightlyLeft.__doc__ = "Label below point, slightly left of center"
|
||||
QgsPalLayerSettings.BottomMiddle = Qgis.LabelPredefinedPointPosition.BottomMiddle
|
||||
QgsPalLayerSettings.BottomMiddle.is_monkey_patched = True
|
||||
QgsPalLayerSettings.BottomMiddle.__doc__ = "Label directly below point"
|
||||
QgsPalLayerSettings.BottomSlightlyRight = Qgis.LabelPredefinedPointPosition.BottomSlightlyRight
|
||||
QgsPalLayerSettings.BottomSlightlyRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.BottomSlightlyRight.__doc__ = "Label below point, slightly right of center"
|
||||
QgsPalLayerSettings.BottomRight = Qgis.LabelPredefinedPointPosition.BottomRight
|
||||
QgsPalLayerSettings.BottomRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.BottomRight.__doc__ = "Label on bottom right of point"
|
||||
Qgis.LabelPredefinedPointPosition.__doc__ = 'Positions for labels when using the Qgis.LabelPlacement.OrderedPositionsAroundPoint placement mode.\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.PredefinedPointPosition\n\n.. versionadded:: 3.26\n\n' + '* ``TopLeft``: ' + Qgis.LabelPredefinedPointPosition.TopLeft.__doc__ + '\n' + '* ``TopSlightlyLeft``: ' + Qgis.LabelPredefinedPointPosition.TopSlightlyLeft.__doc__ + '\n' + '* ``TopMiddle``: ' + Qgis.LabelPredefinedPointPosition.TopMiddle.__doc__ + '\n' + '* ``TopSlightlyRight``: ' + Qgis.LabelPredefinedPointPosition.TopSlightlyRight.__doc__ + '\n' + '* ``TopRight``: ' + Qgis.LabelPredefinedPointPosition.TopRight.__doc__ + '\n' + '* ``MiddleLeft``: ' + Qgis.LabelPredefinedPointPosition.MiddleLeft.__doc__ + '\n' + '* ``MiddleRight``: ' + Qgis.LabelPredefinedPointPosition.MiddleRight.__doc__ + '\n' + '* ``BottomLeft``: ' + Qgis.LabelPredefinedPointPosition.BottomLeft.__doc__ + '\n' + '* ``BottomSlightlyLeft``: ' + Qgis.LabelPredefinedPointPosition.BottomSlightlyLeft.__doc__ + '\n' + '* ``BottomMiddle``: ' + Qgis.LabelPredefinedPointPosition.BottomMiddle.__doc__ + '\n' + '* ``BottomSlightlyRight``: ' + Qgis.LabelPredefinedPointPosition.BottomSlightlyRight.__doc__ + '\n' + '* ``BottomRight``: ' + Qgis.LabelPredefinedPointPosition.BottomRight.__doc__
|
||||
# --
|
||||
Qgis.LabelPredefinedPointPosition.baseClass = Qgis
|
||||
QgsPalLayerSettings.OffsetType = Qgis.LabelOffsetType
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.FromPoint = Qgis.LabelOffsetType.FromPoint
|
||||
QgsPalLayerSettings.FromPoint.is_monkey_patched = True
|
||||
QgsPalLayerSettings.FromPoint.__doc__ = "Offset distance applies from point geometry"
|
||||
QgsPalLayerSettings.FromSymbolBounds = Qgis.LabelOffsetType.FromSymbolBounds
|
||||
QgsPalLayerSettings.FromSymbolBounds.is_monkey_patched = True
|
||||
QgsPalLayerSettings.FromSymbolBounds.__doc__ = "Offset distance applies from rendered symbol bounds"
|
||||
Qgis.LabelOffsetType.__doc__ = 'Behavior modifier for label offset and distance, only applies in some\nlabel placement modes.\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.OffsetType\n\n.. versionadded:: 3.26\n\n' + '* ``FromPoint``: ' + Qgis.LabelOffsetType.FromPoint.__doc__ + '\n' + '* ``FromSymbolBounds``: ' + Qgis.LabelOffsetType.FromSymbolBounds.__doc__
|
||||
# --
|
||||
Qgis.LabelOffsetType.baseClass = Qgis
|
||||
QgsPalLayerSettings.QuadrantPosition = Qgis.LabelQuadrantPosition
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.QuadrantAboveLeft = Qgis.LabelQuadrantPosition.AboveLeft
|
||||
QgsPalLayerSettings.QuadrantAboveLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantAboveLeft.__doc__ = "Above left"
|
||||
QgsPalLayerSettings.QuadrantAbove = Qgis.LabelQuadrantPosition.Above
|
||||
QgsPalLayerSettings.QuadrantAbove.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantAbove.__doc__ = "Above center"
|
||||
QgsPalLayerSettings.QuadrantAboveRight = Qgis.LabelQuadrantPosition.AboveRight
|
||||
QgsPalLayerSettings.QuadrantAboveRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantAboveRight.__doc__ = "Above right"
|
||||
QgsPalLayerSettings.QuadrantLeft = Qgis.LabelQuadrantPosition.Left
|
||||
QgsPalLayerSettings.QuadrantLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantLeft.__doc__ = "Left middle"
|
||||
QgsPalLayerSettings.QuadrantOver = Qgis.LabelQuadrantPosition.Over
|
||||
QgsPalLayerSettings.QuadrantOver.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantOver.__doc__ = "Center middle"
|
||||
QgsPalLayerSettings.QuadrantRight = Qgis.LabelQuadrantPosition.Right
|
||||
QgsPalLayerSettings.QuadrantRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantRight.__doc__ = "Right middle"
|
||||
QgsPalLayerSettings.QuadrantBelowLeft = Qgis.LabelQuadrantPosition.BelowLeft
|
||||
QgsPalLayerSettings.QuadrantBelowLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantBelowLeft.__doc__ = "Below left"
|
||||
QgsPalLayerSettings.QuadrantBelow = Qgis.LabelQuadrantPosition.Below
|
||||
QgsPalLayerSettings.QuadrantBelow.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantBelow.__doc__ = "Below center"
|
||||
QgsPalLayerSettings.QuadrantBelowRight = Qgis.LabelQuadrantPosition.BelowRight
|
||||
QgsPalLayerSettings.QuadrantBelowRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.QuadrantBelowRight.__doc__ = "BelowRight"
|
||||
Qgis.LabelQuadrantPosition.__doc__ = 'Label quadrant positions\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.QuadrantPosition\n\n.. versionadded:: 3.26\n\n' + '* ``QuadrantAboveLeft``: ' + Qgis.LabelQuadrantPosition.AboveLeft.__doc__ + '\n' + '* ``QuadrantAbove``: ' + Qgis.LabelQuadrantPosition.Above.__doc__ + '\n' + '* ``QuadrantAboveRight``: ' + Qgis.LabelQuadrantPosition.AboveRight.__doc__ + '\n' + '* ``QuadrantLeft``: ' + Qgis.LabelQuadrantPosition.Left.__doc__ + '\n' + '* ``QuadrantOver``: ' + Qgis.LabelQuadrantPosition.Over.__doc__ + '\n' + '* ``QuadrantRight``: ' + Qgis.LabelQuadrantPosition.Right.__doc__ + '\n' + '* ``QuadrantBelowLeft``: ' + Qgis.LabelQuadrantPosition.BelowLeft.__doc__ + '\n' + '* ``QuadrantBelow``: ' + Qgis.LabelQuadrantPosition.Below.__doc__ + '\n' + '* ``QuadrantBelowRight``: ' + Qgis.LabelQuadrantPosition.BelowRight.__doc__
|
||||
# --
|
||||
Qgis.LabelQuadrantPosition.baseClass = Qgis
|
||||
QgsPalLayerSettings.UpsideDownLabels = Qgis.UpsideDownLabelHandling
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.Upright = Qgis.UpsideDownLabelHandling.FlipUpsideDownLabels
|
||||
QgsPalLayerSettings.Upright.is_monkey_patched = True
|
||||
QgsPalLayerSettings.Upright.__doc__ = "Upside-down labels (90 <= angle < 270) are shown upright"
|
||||
QgsPalLayerSettings.ShowDefined = Qgis.UpsideDownLabelHandling.AllowUpsideDownWhenRotationIsDefined
|
||||
QgsPalLayerSettings.ShowDefined.is_monkey_patched = True
|
||||
QgsPalLayerSettings.ShowDefined.__doc__ = "Show upside down when rotation is layer- or data-defined"
|
||||
QgsPalLayerSettings.ShowAll = Qgis.UpsideDownLabelHandling.AlwaysAllowUpsideDown
|
||||
QgsPalLayerSettings.ShowAll.is_monkey_patched = True
|
||||
QgsPalLayerSettings.ShowAll.__doc__ = "Show upside down for all labels, including dynamic ones"
|
||||
Qgis.UpsideDownLabelHandling.__doc__ = 'Handling techniques for upside down labels.\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.UpsideDownLabels\n\n.. versionadded:: 3.26\n\n' + '* ``Upright``: ' + Qgis.UpsideDownLabelHandling.FlipUpsideDownLabels.__doc__ + '\n' + '* ``ShowDefined``: ' + Qgis.UpsideDownLabelHandling.AllowUpsideDownWhenRotationIsDefined.__doc__ + '\n' + '* ``ShowAll``: ' + Qgis.UpsideDownLabelHandling.AlwaysAllowUpsideDown.__doc__
|
||||
# --
|
||||
Qgis.UpsideDownLabelHandling.baseClass = Qgis
|
||||
QgsPalLayerSettings.MultiLineAlign = Qgis.LabelMultiLineAlignment
|
||||
# monkey patching scoped based enum
|
||||
QgsPalLayerSettings.MultiLeft = Qgis.LabelMultiLineAlignment.Left
|
||||
QgsPalLayerSettings.MultiLeft.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MultiLeft.__doc__ = "Left align"
|
||||
QgsPalLayerSettings.MultiCenter = Qgis.LabelMultiLineAlignment.Center
|
||||
QgsPalLayerSettings.MultiCenter.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MultiCenter.__doc__ = "Center align"
|
||||
QgsPalLayerSettings.MultiRight = Qgis.LabelMultiLineAlignment.Right
|
||||
QgsPalLayerSettings.MultiRight.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MultiRight.__doc__ = "Right align"
|
||||
QgsPalLayerSettings.MultiFollowPlacement = Qgis.LabelMultiLineAlignment.FollowPlacement
|
||||
QgsPalLayerSettings.MultiFollowPlacement.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MultiFollowPlacement.__doc__ = "Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right alignment"
|
||||
QgsPalLayerSettings.MultiJustify = Qgis.LabelMultiLineAlignment.Justify
|
||||
QgsPalLayerSettings.MultiJustify.is_monkey_patched = True
|
||||
QgsPalLayerSettings.MultiJustify.__doc__ = "Justified"
|
||||
Qgis.LabelMultiLineAlignment.__doc__ = 'Text alignment for multi-line labels.\n\n.. note::\n\n Prior to QGIS 3.26 this was available as :py:class:`QgsPalLayerSettings`.MultiLineAlign\n\n.. versionadded:: 3.26\n\n' + '* ``MultiLeft``: ' + Qgis.LabelMultiLineAlignment.Left.__doc__ + '\n' + '* ``MultiCenter``: ' + Qgis.LabelMultiLineAlignment.Center.__doc__ + '\n' + '* ``MultiRight``: ' + Qgis.LabelMultiLineAlignment.Right.__doc__ + '\n' + '* ``MultiFollowPlacement``: ' + Qgis.LabelMultiLineAlignment.FollowPlacement.__doc__ + '\n' + '* ``MultiJustify``: ' + Qgis.LabelMultiLineAlignment.Justify.__doc__
|
||||
# --
|
||||
Qgis.LabelMultiLineAlignment.baseClass = Qgis
|
||||
# monkey patching scoped based enum
|
||||
Qgis.SublayerQueryFlag.FastScan.__doc__ = "Indicates that the provider must scan for sublayers using the fastest possible approach -- e.g. by first checking that a uri has an extension which is known to be readable by the provider"
|
||||
Qgis.SublayerQueryFlag.ResolveGeometryType.__doc__ = "Attempt to resolve the geometry type for vector sublayers"
|
||||
|
||||
@ -27,43 +27,6 @@ Contains settings for how a map layer will be labeled.
|
||||
|
||||
|
||||
|
||||
enum Placement
|
||||
{
|
||||
AroundPoint,
|
||||
OverPoint,
|
||||
Line,
|
||||
Curved,
|
||||
Horizontal,
|
||||
Free,
|
||||
OrderedPositionsAroundPoint,
|
||||
PerimeterCurved,
|
||||
OutsidePolygons,
|
||||
};
|
||||
|
||||
enum PredefinedPointPosition
|
||||
{
|
||||
TopLeft,
|
||||
TopSlightlyLeft,
|
||||
TopMiddle,
|
||||
TopSlightlyRight,
|
||||
TopRight,
|
||||
MiddleLeft,
|
||||
MiddleRight,
|
||||
BottomLeft,
|
||||
BottomSlightlyLeft,
|
||||
BottomMiddle,
|
||||
BottomSlightlyRight,
|
||||
BottomRight,
|
||||
};
|
||||
|
||||
|
||||
enum OffsetType
|
||||
{
|
||||
FromPoint,
|
||||
FromSymbolBounds,
|
||||
};
|
||||
|
||||
|
||||
enum LinePlacementFlags
|
||||
{
|
||||
OnLine,
|
||||
@ -72,27 +35,6 @@ Contains settings for how a map layer will be labeled.
|
||||
MapOrientation,
|
||||
};
|
||||
|
||||
enum QuadrantPosition
|
||||
{
|
||||
QuadrantAboveLeft,
|
||||
QuadrantAbove,
|
||||
QuadrantAboveRight,
|
||||
QuadrantLeft,
|
||||
QuadrantOver,
|
||||
QuadrantRight,
|
||||
QuadrantBelowLeft,
|
||||
QuadrantBelow,
|
||||
QuadrantBelowRight,
|
||||
};
|
||||
|
||||
enum UpsideDownLabels
|
||||
{
|
||||
Upright,
|
||||
ShowDefined,
|
||||
ShowAll
|
||||
};
|
||||
|
||||
|
||||
enum DirectionSymbols
|
||||
{
|
||||
SymbolLeftRight,
|
||||
@ -100,15 +42,6 @@ Contains settings for how a map layer will be labeled.
|
||||
SymbolBelow
|
||||
};
|
||||
|
||||
enum MultiLineAlign
|
||||
{
|
||||
MultiLeft,
|
||||
MultiCenter,
|
||||
MultiRight,
|
||||
MultiFollowPlacement,
|
||||
MultiJustify,
|
||||
};
|
||||
|
||||
|
||||
enum ObstacleType
|
||||
{
|
||||
@ -337,7 +270,7 @@ Returns the :py:class:`QgsExpression` for this label settings. May be ``None`` i
|
||||
|
||||
bool useMaxLineLengthForAutoWrap;
|
||||
|
||||
MultiLineAlign multilineAlign;
|
||||
Qgis::LabelMultiLineAlignment multilineAlign;
|
||||
|
||||
bool formatNumbers;
|
||||
|
||||
@ -346,7 +279,7 @@ Returns the :py:class:`QgsExpression` for this label settings. May be ``None`` i
|
||||
bool plusSign;
|
||||
|
||||
|
||||
Placement placement;
|
||||
Qgis::LabelPlacement placement;
|
||||
|
||||
QgsLabeling::PolygonPlacementFlags polygonPlacementFlags() const;
|
||||
%Docstring
|
||||
@ -379,7 +312,7 @@ Sets the polygon placement ``flags``, which dictate how polygon labels can be pl
|
||||
|
||||
QgsMapUnitScale distMapUnitScale;
|
||||
|
||||
OffsetType offsetType;
|
||||
Qgis::LabelOffsetType offsetType;
|
||||
|
||||
double repeatDistance;
|
||||
|
||||
@ -387,7 +320,7 @@ Sets the polygon placement ``flags``, which dictate how polygon labels can be pl
|
||||
|
||||
QgsMapUnitScale repeatDistanceMapUnitScale;
|
||||
|
||||
QuadrantPosition quadOffset;
|
||||
Qgis::LabelQuadrantPosition quadOffset;
|
||||
|
||||
double xOffset;
|
||||
|
||||
@ -438,7 +371,7 @@ Set unit for rotation of labels.
|
||||
|
||||
int fontMaxPixelSize;
|
||||
|
||||
UpsideDownLabels upsidedownLabels;
|
||||
Qgis::UpsideDownLabelHandling upsidedownLabels;
|
||||
|
||||
bool labelPerPart;
|
||||
|
||||
|
||||
@ -350,6 +350,71 @@ The development version
|
||||
AllowOverlapAtNoCost,
|
||||
};
|
||||
|
||||
enum class LabelPlacement
|
||||
{
|
||||
AroundPoint,
|
||||
OverPoint,
|
||||
Line,
|
||||
Curved,
|
||||
Horizontal,
|
||||
Free,
|
||||
OrderedPositionsAroundPoint,
|
||||
PerimeterCurved,
|
||||
OutsidePolygons,
|
||||
};
|
||||
|
||||
|
||||
enum class LabelPredefinedPointPosition
|
||||
{
|
||||
TopLeft,
|
||||
TopSlightlyLeft,
|
||||
TopMiddle,
|
||||
TopSlightlyRight,
|
||||
TopRight,
|
||||
MiddleLeft,
|
||||
MiddleRight,
|
||||
BottomLeft,
|
||||
BottomSlightlyLeft,
|
||||
BottomMiddle,
|
||||
BottomSlightlyRight,
|
||||
BottomRight,
|
||||
};
|
||||
|
||||
enum class LabelOffsetType
|
||||
{
|
||||
FromPoint,
|
||||
FromSymbolBounds,
|
||||
};
|
||||
|
||||
enum class LabelQuadrantPosition
|
||||
{
|
||||
AboveLeft,
|
||||
Above,
|
||||
AboveRight,
|
||||
Left,
|
||||
Over,
|
||||
Right,
|
||||
BelowLeft,
|
||||
Below,
|
||||
BelowRight,
|
||||
};
|
||||
|
||||
enum class UpsideDownLabelHandling
|
||||
{
|
||||
FlipUpsideDownLabels,
|
||||
AllowUpsideDownWhenRotationIsDefined,
|
||||
AlwaysAllowUpsideDown
|
||||
};
|
||||
|
||||
enum class LabelMultiLineAlignment
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right,
|
||||
FollowPlacement,
|
||||
Justify,
|
||||
};
|
||||
|
||||
enum class SublayerQueryFlag
|
||||
{
|
||||
FastScan,
|
||||
|
||||
@ -147,8 +147,8 @@ class ExtractLabelSink : public QgsLabelSink
|
||||
}
|
||||
|
||||
const QgsFeatureId fid = label->getFeaturePart()->featureId();
|
||||
if ( settings.placement == QgsPalLayerSettings::Curved ||
|
||||
settings.placement == QgsPalLayerSettings::PerimeterCurved )
|
||||
if ( settings.placement == Qgis::LabelPlacement::Curved ||
|
||||
settings.placement == Qgis::LabelPlacement::PerimeterCurved )
|
||||
{
|
||||
if ( !mCurvedWarningPushed.contains( layerId ) )
|
||||
{
|
||||
@ -181,27 +181,27 @@ class ExtractLabelSink : public QgsLabelSink
|
||||
QString labelAlignment;
|
||||
if ( dataDefinedValues.contains( QgsPalLayerSettings::MultiLineAlignment ) )
|
||||
{
|
||||
labelSettings.multilineAlign = static_cast< QgsPalLayerSettings::MultiLineAlign >( dataDefinedValues.value( QgsPalLayerSettings::MultiLineAlignment ).toInt() );
|
||||
labelSettings.multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( dataDefinedValues.value( QgsPalLayerSettings::MultiLineAlignment ).toInt() );
|
||||
}
|
||||
switch ( labelSettings.multilineAlign )
|
||||
{
|
||||
case QgsPalLayerSettings::QgsPalLayerSettings::MultiRight:
|
||||
case Qgis::LabelMultiLineAlignment::Right:
|
||||
labelAlignment = QStringLiteral( "right" );
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::QgsPalLayerSettings::MultiCenter:
|
||||
case Qgis::LabelMultiLineAlignment::Center:
|
||||
labelAlignment = QStringLiteral( "center" );
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::QgsPalLayerSettings::MultiLeft:
|
||||
case Qgis::LabelMultiLineAlignment::Left:
|
||||
labelAlignment = QStringLiteral( "left" );
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::QgsPalLayerSettings::MultiJustify:
|
||||
case Qgis::LabelMultiLineAlignment::Justify:
|
||||
labelAlignment = QStringLiteral( "justify" );
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::MultiFollowPlacement:
|
||||
case Qgis::LabelMultiLineAlignment::FollowPlacement:
|
||||
switch ( label->getQuadrant() )
|
||||
{
|
||||
case pal::LabelPosition::QuadrantAboveLeft:
|
||||
@ -503,8 +503,8 @@ QVariantMap QgsExtractLabelsAlgorithm::processAlgorithm( const QVariantMap ¶
|
||||
|
||||
settings.fieldName = QStringLiteral( "LabelText" );
|
||||
settings.obstacleSettings().setIsObstacle( false );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.quadOffset = QgsPalLayerSettings::QuadrantAboveRight;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.quadOffset = Qgis::LabelQuadrantPosition::AboveRight;
|
||||
settings.placementSettings().setAllowDegradedPlacement( true );
|
||||
settings.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
|
||||
@ -199,19 +199,19 @@ void QgsLabelPropertyDialog::init( const QString &layerId, const QString &provid
|
||||
QString defaultMultilineAlign;
|
||||
switch ( layerSettings.multilineAlign )
|
||||
{
|
||||
case QgsPalLayerSettings::MultiLeft:
|
||||
case Qgis::LabelMultiLineAlignment::Left:
|
||||
defaultMultilineAlign = QStringLiteral( "left" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MultiCenter:
|
||||
case Qgis::LabelMultiLineAlignment::Center:
|
||||
defaultMultilineAlign = QStringLiteral( "center" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MultiRight:
|
||||
case Qgis::LabelMultiLineAlignment::Right:
|
||||
defaultMultilineAlign = QStringLiteral( "right" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MultiJustify:
|
||||
case Qgis::LabelMultiLineAlignment::Justify:
|
||||
defaultMultilineAlign = QStringLiteral( "justify" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MultiFollowPlacement:
|
||||
case Qgis::LabelMultiLineAlignment::FollowPlacement:
|
||||
defaultMultilineAlign = QStringLiteral( "follow label placement" );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -365,57 +365,57 @@ QgsMapToolLabel::LabelAlignment QgsMapToolLabel::currentAlignment()
|
||||
}
|
||||
|
||||
// data defined quadrant offset
|
||||
if ( mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::AroundPoint ||
|
||||
mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::OverPoint )
|
||||
if ( mCurrentLabel.settings.placement == Qgis::LabelPlacement::AroundPoint ||
|
||||
mCurrentLabel.settings.placement == Qgis::LabelPlacement::OverPoint )
|
||||
{
|
||||
QgsPalLayerSettings::QuadrantPosition quadrantOffset = QgsPalLayerSettings::QuadrantAboveRight;
|
||||
Qgis::LabelQuadrantPosition quadrantOffset = Qgis::LabelQuadrantPosition::AboveRight;
|
||||
|
||||
// quadrant offest defined via buttons
|
||||
if ( mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::OverPoint )
|
||||
if ( mCurrentLabel.settings.placement == Qgis::LabelPlacement::OverPoint )
|
||||
quadrantOffset = mCurrentLabel.settings.quadOffset;
|
||||
|
||||
// quadrant offest DD defined
|
||||
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::OffsetQuad ) )
|
||||
{
|
||||
QVariant exprVal = evaluateDataDefinedProperty( QgsPalLayerSettings::OffsetQuad, mCurrentLabel.settings, f, quadrantOffset );
|
||||
QVariant exprVal = evaluateDataDefinedProperty( QgsPalLayerSettings::OffsetQuad, mCurrentLabel.settings, f, static_cast< int >( quadrantOffset ) );
|
||||
if ( !exprVal.isNull() )
|
||||
{
|
||||
bool ok;
|
||||
int quadInt = exprVal.toInt( &ok );
|
||||
if ( ok && 0 <= quadInt && quadInt <= 8 )
|
||||
{
|
||||
quadrantOffset = static_cast< QgsPalLayerSettings::QuadrantPosition >( quadInt );
|
||||
quadrantOffset = static_cast< Qgis::LabelQuadrantPosition >( quadInt );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( quadrantOffset )
|
||||
{
|
||||
case QgsPalLayerSettings::QuadrantAboveLeft:
|
||||
case Qgis::LabelQuadrantPosition::AboveLeft:
|
||||
labelAlignment = LabelAlignment::BottomRight;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantAbove:
|
||||
case Qgis::LabelQuadrantPosition::Above:
|
||||
labelAlignment = LabelAlignment::BottomCenter;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantAboveRight:
|
||||
case Qgis::LabelQuadrantPosition::AboveRight:
|
||||
labelAlignment = LabelAlignment::BottomLeft;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantLeft:
|
||||
case Qgis::LabelQuadrantPosition::Left:
|
||||
labelAlignment = LabelAlignment::HalfRight;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantOver:
|
||||
case Qgis::LabelQuadrantPosition::Over:
|
||||
labelAlignment = LabelAlignment::HalfCenter;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantRight:
|
||||
case Qgis::LabelQuadrantPosition::Right:
|
||||
labelAlignment = LabelAlignment::HalfLeft;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelowLeft:
|
||||
case Qgis::LabelQuadrantPosition::BelowLeft:
|
||||
labelAlignment = LabelAlignment::TopRight;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelow:
|
||||
case Qgis::LabelQuadrantPosition::Below:
|
||||
labelAlignment = LabelAlignment::TopCenter;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelowRight:
|
||||
case Qgis::LabelQuadrantPosition::BelowRight:
|
||||
labelAlignment = LabelAlignment::TopLeft;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ void QgsMapToolMoveLabel::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
||||
{
|
||||
const QgsPointXY pointMapCoords = e->mapPoint();
|
||||
|
||||
bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
|
||||
bool isCurvedOrLine { mCurrentLabel.settings.placement == Qgis::LabelPlacement::Curved || mCurrentLabel.settings.placement == Qgis::LabelPlacement::Line };
|
||||
if ( isCurvedOrLine )
|
||||
{
|
||||
// Determine the closest point on the feature
|
||||
@ -242,10 +242,10 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
|
||||
if ( mAnchorDetached )
|
||||
{
|
||||
mCurrentLabel.settings.placement = QgsPalLayerSettings::Placement::Horizontal;
|
||||
mCurrentLabel.settings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
}
|
||||
|
||||
const bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
|
||||
const bool isCurvedOrLine { mCurrentLabel.settings.placement == Qgis::LabelPlacement::Curved || mCurrentLabel.settings.placement == Qgis::LabelPlacement::Line };
|
||||
|
||||
if ( isCurvedOrLine && !mCurrentLabel.pos.isDiagram && ! labelAnchorPercentMovable( vlayer, mCurrentLabel.settings, lineAnchorPercentCol, lineAnchorClippingCol, lineAnchorTypeCol, lineAnchorTextPointCol ) )
|
||||
{
|
||||
@ -418,7 +418,7 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
|
||||
bool lineAnchorTypeSuccess = false;
|
||||
bool lineAnchorTextPointSuccess = false;
|
||||
|
||||
bool isCurvedOrLine { ! mAnchorDetached &&( mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line ) };
|
||||
bool isCurvedOrLine { ! mAnchorDetached &&( mCurrentLabel.settings.placement == Qgis::LabelPlacement::Curved || mCurrentLabel.settings.placement == Qgis::LabelPlacement::Line ) };
|
||||
|
||||
if ( !isCalloutMove && isCurvedOrLine && !currentLabelDataDefinedLineAnchorPercent( lineAnchorPercentOrig, lineAnchorPercentSuccess, lineAnchorPercentCol,
|
||||
lineAnchorClippingOrig, lineAnchorClippingSuccess, lineAnchorClippingCol,
|
||||
@ -642,7 +642,7 @@ void QgsMapToolMoveLabel::keyReleaseEvent( QKeyEvent *e )
|
||||
// delete the stored label/callout position
|
||||
mAnchorDetached = false;
|
||||
const bool isCalloutMove = !mCurrentCallout.layerID.isEmpty();
|
||||
const bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
|
||||
const bool isCurvedOrLine { mCurrentLabel.settings.placement == Qgis::LabelPlacement::Curved || mCurrentLabel.settings.placement == Qgis::LabelPlacement::Line };
|
||||
QgsVectorLayer *vlayer = !isCalloutMove ? mCurrentLabel.layer : qobject_cast< QgsVectorLayer * >( QgsMapTool::layer( mCurrentCallout.layerID ) );
|
||||
const QgsFeatureId featureId = !isCalloutMove ? mCurrentLabel.pos.featureId : mCurrentCallout.featureId;
|
||||
if ( vlayer )
|
||||
|
||||
@ -1298,57 +1298,57 @@ void QgsDxfExport::writeText( const QString &layer, const QString &text, pal::La
|
||||
|
||||
const QgsPropertyCollection &props = layerSettings.dataDefinedProperties();
|
||||
|
||||
if ( layerSettings.placement == QgsPalLayerSettings::Placement::OverPoint )
|
||||
if ( layerSettings.placement == Qgis::LabelPlacement::OverPoint )
|
||||
{
|
||||
lblX = labelFeature->anchorPosition().x();
|
||||
lblY = labelFeature->anchorPosition().y();
|
||||
|
||||
QgsPalLayerSettings::QuadrantPosition offsetQuad = layerSettings.quadOffset;
|
||||
Qgis::LabelQuadrantPosition offsetQuad = layerSettings.quadOffset;
|
||||
|
||||
if ( props.isActive( QgsPalLayerSettings::OffsetQuad ) )
|
||||
{
|
||||
const QVariant exprVal = props.value( QgsPalLayerSettings::OffsetQuad, expressionContext );
|
||||
if ( !exprVal.isNull() )
|
||||
{
|
||||
offsetQuad = static_cast<QgsPalLayerSettings::QuadrantPosition>( exprVal.toInt() );
|
||||
offsetQuad = static_cast<Qgis::LabelQuadrantPosition>( exprVal.toInt() );
|
||||
}
|
||||
}
|
||||
|
||||
switch ( offsetQuad )
|
||||
{
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantAboveLeft:
|
||||
case Qgis::LabelQuadrantPosition::AboveLeft:
|
||||
hali = HAlign::HRight;
|
||||
vali = VAlign::VBottom;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantAbove:
|
||||
case Qgis::LabelQuadrantPosition::Above:
|
||||
hali = HAlign::HCenter;
|
||||
vali = VAlign::VBottom;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantAboveRight:
|
||||
case Qgis::LabelQuadrantPosition::AboveRight:
|
||||
hali = HAlign::HLeft;
|
||||
vali = VAlign::VBottom;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantLeft:
|
||||
case Qgis::LabelQuadrantPosition::Left:
|
||||
hali = HAlign::HRight;
|
||||
vali = VAlign::VMiddle;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantOver:
|
||||
case Qgis::LabelQuadrantPosition::Over:
|
||||
hali = HAlign::HCenter;
|
||||
vali = VAlign::VMiddle;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantRight:
|
||||
case Qgis::LabelQuadrantPosition::Right:
|
||||
hali = HAlign::HLeft;
|
||||
vali = VAlign::VMiddle;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantBelowLeft:
|
||||
case Qgis::LabelQuadrantPosition::BelowLeft:
|
||||
hali = HAlign::HRight;
|
||||
vali = VAlign::VTop;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantBelow:
|
||||
case Qgis::LabelQuadrantPosition::Below:
|
||||
hali = HAlign::HCenter;
|
||||
vali = VAlign::VTop;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantPosition::QuadrantBelowRight:
|
||||
case Qgis::LabelQuadrantPosition::BelowRight:
|
||||
hali = HAlign::HLeft;
|
||||
vali = VAlign::VTop;
|
||||
break;
|
||||
@ -2237,7 +2237,7 @@ void QgsDxfExport::drawLabel( const QString &layerId, QgsRenderContext &context,
|
||||
format.setFont( dFont );
|
||||
tmpLyr.setFormat( format );
|
||||
|
||||
if ( tmpLyr.multilineAlign == QgsPalLayerSettings::MultiFollowPlacement )
|
||||
if ( tmpLyr.multilineAlign == Qgis::LabelMultiLineAlignment::FollowPlacement )
|
||||
{
|
||||
//calculate font alignment based on label quadrant
|
||||
switch ( label->getQuadrant() )
|
||||
@ -2245,17 +2245,17 @@ void QgsDxfExport::drawLabel( const QString &layerId, QgsRenderContext &context,
|
||||
case pal::LabelPosition::QuadrantAboveLeft:
|
||||
case pal::LabelPosition::QuadrantLeft:
|
||||
case pal::LabelPosition::QuadrantBelowLeft:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiRight;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Right;
|
||||
break;
|
||||
case pal::LabelPosition::QuadrantAbove:
|
||||
case pal::LabelPosition::QuadrantOver:
|
||||
case pal::LabelPosition::QuadrantBelow:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiCenter;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Center;
|
||||
break;
|
||||
case pal::LabelPosition::QuadrantAboveRight:
|
||||
case pal::LabelPosition::QuadrantRight:
|
||||
case pal::LabelPosition::QuadrantBelowRight:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiLeft;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2278,7 +2278,7 @@ void QgsDxfExport::drawLabel( const QString &layerId, QgsRenderContext &context,
|
||||
QString wrapchr = tmpLyr.wrapChar.isEmpty() ? QStringLiteral( "\n" ) : tmpLyr.wrapChar;
|
||||
|
||||
//add the direction symbol if needed
|
||||
if ( !txt.isEmpty() && tmpLyr.placement == QgsPalLayerSettings::Line && tmpLyr.lineSettings().addDirectionSymbol() )
|
||||
if ( !txt.isEmpty() && tmpLyr.placement == Qgis::LabelPlacement::Line && tmpLyr.lineSettings().addDirectionSymbol() )
|
||||
{
|
||||
bool prependSymb = false;
|
||||
QString symb = tmpLyr.lineSettings().rightDirectionSymbol();
|
||||
|
||||
@ -18,12 +18,14 @@
|
||||
#define SIP_NO_FILE
|
||||
|
||||
#include "qgis_core.h"
|
||||
#include "qgspallabeling.h"
|
||||
#include "geos_c.h"
|
||||
#include "qgsgeos.h"
|
||||
#include "qgsmargins.h"
|
||||
#include "qgslabelobstaclesettings.h"
|
||||
#include "qgslabellinesettings.h"
|
||||
#include "qgslabeling.h"
|
||||
#include "qgsfeature.h"
|
||||
#include "qgscoordinatereferencesystem.h"
|
||||
|
||||
namespace pal
|
||||
{
|
||||
@ -251,7 +253,7 @@ class CORE_EXPORT QgsLabelFeature
|
||||
* label candidates.
|
||||
* \see setOffsetType()
|
||||
*/
|
||||
QgsPalLayerSettings::OffsetType offsetType() const { return mOffsetType; }
|
||||
Qgis::LabelOffsetType offsetType() const { return mOffsetType; }
|
||||
|
||||
/**
|
||||
* Sets the offset type, which determines how offsets and distance to label
|
||||
@ -259,7 +261,7 @@ class CORE_EXPORT QgsLabelFeature
|
||||
* label candidates.
|
||||
* \see offsetType()
|
||||
*/
|
||||
void setOffsetType( QgsPalLayerSettings::OffsetType type ) { mOffsetType = type; }
|
||||
void setOffsetType( Qgis::LabelOffsetType type ) { mOffsetType = type; }
|
||||
|
||||
/**
|
||||
* Applies to "around point" placement strategy or linestring features.
|
||||
@ -278,14 +280,14 @@ class CORE_EXPORT QgsLabelFeature
|
||||
* is only used for OrderedPositionsAroundPoint placements.
|
||||
* \see setPredefinedPositionOrder()
|
||||
*/
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > predefinedPositionOrder() const { return mPredefinedPositionOrder; }
|
||||
QVector< Qgis::LabelPredefinedPointPosition > predefinedPositionOrder() const { return mPredefinedPositionOrder; }
|
||||
|
||||
/**
|
||||
* Sets the priority ordered list of predefined positions for label candidates. This property
|
||||
* is only used for OrderedPositionsAroundPoint placements.
|
||||
* \see predefinedPositionOrder()
|
||||
*/
|
||||
void setPredefinedPositionOrder( const QVector< QgsPalLayerSettings::PredefinedPointPosition > &order ) { mPredefinedPositionOrder = order; }
|
||||
void setPredefinedPositionOrder( const QVector< Qgis::LabelPredefinedPointPosition > &order ) { mPredefinedPositionOrder = order; }
|
||||
|
||||
/**
|
||||
* Applies only to linestring features - after what distance (in map units)
|
||||
@ -640,9 +642,9 @@ class CORE_EXPORT QgsLabelFeature
|
||||
//! distance of label from the feature (only for "around point" placement or linestrings)
|
||||
double mDistLabel = 0;
|
||||
//! Offset type for certain placement modes
|
||||
QgsPalLayerSettings::OffsetType mOffsetType = QgsPalLayerSettings::FromPoint;
|
||||
Qgis::LabelOffsetType mOffsetType = Qgis::LabelOffsetType::FromPoint;
|
||||
//! Ordered list of predefined positions for label (only for OrderedPositionsAroundPoint placement)
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > mPredefinedPositionOrder;
|
||||
QVector< Qgis::LabelPredefinedPointPosition > mPredefinedPositionOrder;
|
||||
//! distance after which label should be repeated (only for linestrings)
|
||||
double mRepeatDistance = 0;
|
||||
//! whether to always show label - even in case of collisions
|
||||
|
||||
@ -224,21 +224,7 @@ void QgsLabelingEngine::processProvider( QgsAbstractLabelProvider *provider, Qgs
|
||||
l->setCentroidInside( flags.testFlag( QgsAbstractLabelProvider::CentroidMustBeInside ) );
|
||||
|
||||
// set how to show upside-down labels
|
||||
pal::Layer::UpsideDownLabels upsdnlabels = pal::Layer::ShowAll;
|
||||
switch ( provider->upsidedownLabels() )
|
||||
{
|
||||
case QgsPalLayerSettings::Upright:
|
||||
upsdnlabels = pal::Layer::Upright;
|
||||
break;
|
||||
case QgsPalLayerSettings::ShowDefined:
|
||||
upsdnlabels = pal::Layer::ShowDefined;
|
||||
break;
|
||||
case QgsPalLayerSettings::ShowAll:
|
||||
upsdnlabels = pal::Layer::ShowAll;
|
||||
break;
|
||||
}
|
||||
l->setUpsidedownLabels( upsdnlabels );
|
||||
|
||||
l->setUpsidedownLabels( provider->upsidedownLabels() );
|
||||
|
||||
const QList<QgsLabelFeature *> features = provider->labelFeatures( context );
|
||||
|
||||
@ -646,10 +632,6 @@ QgsAbstractLabelProvider::QgsAbstractLabelProvider( QgsMapLayer *layer, const QS
|
||||
: mLayerId( layer ? layer->id() : QString() )
|
||||
, mLayer( layer )
|
||||
, mProviderId( providerId )
|
||||
, mFlags( DrawLabels )
|
||||
, mPlacement( QgsPalLayerSettings::AroundPoint )
|
||||
, mPriority( 0.5 )
|
||||
, mUpsidedownLabels( QgsPalLayerSettings::Upright )
|
||||
{
|
||||
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer * >( layer ) )
|
||||
{
|
||||
@ -696,48 +678,48 @@ QgsExpressionContextScope *QgsAbstractLabelProvider::layerExpressionContextScope
|
||||
// QgsLabelingUtils
|
||||
//
|
||||
|
||||
QString QgsLabelingUtils::encodePredefinedPositionOrder( const QVector<QgsPalLayerSettings::PredefinedPointPosition> &positions )
|
||||
QString QgsLabelingUtils::encodePredefinedPositionOrder( const QVector<Qgis::LabelPredefinedPointPosition> &positions )
|
||||
{
|
||||
QStringList predefinedOrderString;
|
||||
const auto constPositions = positions;
|
||||
for ( QgsPalLayerSettings::PredefinedPointPosition position : constPositions )
|
||||
for ( Qgis::LabelPredefinedPointPosition position : constPositions )
|
||||
{
|
||||
switch ( position )
|
||||
{
|
||||
case QgsPalLayerSettings::TopLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::TopLeft:
|
||||
predefinedOrderString << QStringLiteral( "TL" );
|
||||
break;
|
||||
case QgsPalLayerSettings::TopSlightlyLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::TopSlightlyLeft:
|
||||
predefinedOrderString << QStringLiteral( "TSL" );
|
||||
break;
|
||||
case QgsPalLayerSettings::TopMiddle:
|
||||
case Qgis::LabelPredefinedPointPosition::TopMiddle:
|
||||
predefinedOrderString << QStringLiteral( "T" );
|
||||
break;
|
||||
case QgsPalLayerSettings::TopSlightlyRight:
|
||||
case Qgis::LabelPredefinedPointPosition::TopSlightlyRight:
|
||||
predefinedOrderString << QStringLiteral( "TSR" );
|
||||
break;
|
||||
case QgsPalLayerSettings::TopRight:
|
||||
case Qgis::LabelPredefinedPointPosition::TopRight:
|
||||
predefinedOrderString << QStringLiteral( "TR" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MiddleLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::MiddleLeft:
|
||||
predefinedOrderString << QStringLiteral( "L" );
|
||||
break;
|
||||
case QgsPalLayerSettings::MiddleRight:
|
||||
case Qgis::LabelPredefinedPointPosition::MiddleRight:
|
||||
predefinedOrderString << QStringLiteral( "R" );
|
||||
break;
|
||||
case QgsPalLayerSettings::BottomLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomLeft:
|
||||
predefinedOrderString << QStringLiteral( "BL" );
|
||||
break;
|
||||
case QgsPalLayerSettings::BottomSlightlyLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomSlightlyLeft:
|
||||
predefinedOrderString << QStringLiteral( "BSL" );
|
||||
break;
|
||||
case QgsPalLayerSettings::BottomMiddle:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomMiddle:
|
||||
predefinedOrderString << QStringLiteral( "B" );
|
||||
break;
|
||||
case QgsPalLayerSettings::BottomSlightlyRight:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomSlightlyRight:
|
||||
predefinedOrderString << QStringLiteral( "BSR" );
|
||||
break;
|
||||
case QgsPalLayerSettings::BottomRight:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomRight:
|
||||
predefinedOrderString << QStringLiteral( "BR" );
|
||||
break;
|
||||
}
|
||||
@ -745,38 +727,38 @@ QString QgsLabelingUtils::encodePredefinedPositionOrder( const QVector<QgsPalLay
|
||||
return predefinedOrderString.join( ',' );
|
||||
}
|
||||
|
||||
QVector<QgsPalLayerSettings::PredefinedPointPosition> QgsLabelingUtils::decodePredefinedPositionOrder( const QString &positionString )
|
||||
QVector<Qgis::LabelPredefinedPointPosition> QgsLabelingUtils::decodePredefinedPositionOrder( const QString &positionString )
|
||||
{
|
||||
QVector<QgsPalLayerSettings::PredefinedPointPosition> result;
|
||||
QVector<Qgis::LabelPredefinedPointPosition> result;
|
||||
const QStringList predefinedOrderList = positionString.split( ',' );
|
||||
result.reserve( predefinedOrderList.size() );
|
||||
for ( const QString &position : predefinedOrderList )
|
||||
{
|
||||
QString cleaned = position.trimmed().toUpper();
|
||||
if ( cleaned == QLatin1String( "TL" ) )
|
||||
result << QgsPalLayerSettings::TopLeft;
|
||||
result << Qgis::LabelPredefinedPointPosition::TopLeft;
|
||||
else if ( cleaned == QLatin1String( "TSL" ) )
|
||||
result << QgsPalLayerSettings::TopSlightlyLeft;
|
||||
result << Qgis::LabelPredefinedPointPosition::TopSlightlyLeft;
|
||||
else if ( cleaned == QLatin1String( "T" ) )
|
||||
result << QgsPalLayerSettings::TopMiddle;
|
||||
result << Qgis::LabelPredefinedPointPosition::TopMiddle;
|
||||
else if ( cleaned == QLatin1String( "TSR" ) )
|
||||
result << QgsPalLayerSettings::TopSlightlyRight;
|
||||
result << Qgis::LabelPredefinedPointPosition::TopSlightlyRight;
|
||||
else if ( cleaned == QLatin1String( "TR" ) )
|
||||
result << QgsPalLayerSettings::TopRight;
|
||||
result << Qgis::LabelPredefinedPointPosition::TopRight;
|
||||
else if ( cleaned == QLatin1String( "L" ) )
|
||||
result << QgsPalLayerSettings::MiddleLeft;
|
||||
result << Qgis::LabelPredefinedPointPosition::MiddleLeft;
|
||||
else if ( cleaned == QLatin1String( "R" ) )
|
||||
result << QgsPalLayerSettings::MiddleRight;
|
||||
result << Qgis::LabelPredefinedPointPosition::MiddleRight;
|
||||
else if ( cleaned == QLatin1String( "BL" ) )
|
||||
result << QgsPalLayerSettings::BottomLeft;
|
||||
result << Qgis::LabelPredefinedPointPosition::BottomLeft;
|
||||
else if ( cleaned == QLatin1String( "BSL" ) )
|
||||
result << QgsPalLayerSettings::BottomSlightlyLeft;
|
||||
result << Qgis::LabelPredefinedPointPosition::BottomSlightlyLeft;
|
||||
else if ( cleaned == QLatin1String( "B" ) )
|
||||
result << QgsPalLayerSettings::BottomMiddle;
|
||||
result << Qgis::LabelPredefinedPointPosition::BottomMiddle;
|
||||
else if ( cleaned == QLatin1String( "BSR" ) )
|
||||
result << QgsPalLayerSettings::BottomSlightlyRight;
|
||||
result << Qgis::LabelPredefinedPointPosition::BottomSlightlyRight;
|
||||
else if ( cleaned == QLatin1String( "BR" ) )
|
||||
result << QgsPalLayerSettings::BottomRight;
|
||||
result << Qgis::LabelPredefinedPointPosition::BottomRight;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -21,17 +21,20 @@
|
||||
#include "qgis_core.h"
|
||||
#include "qgsmapsettings.h"
|
||||
|
||||
#include "qgspallabeling.h"
|
||||
#include "qgslabelingenginesettings.h"
|
||||
#include "qgslabeling.h"
|
||||
#include "qgsfeedback.h"
|
||||
#include "qgslabelobstaclesettings.h"
|
||||
|
||||
class QgsLabelingEngine;
|
||||
class QgsLabelingResults;
|
||||
class QgsLabelFeature;
|
||||
|
||||
namespace pal
|
||||
{
|
||||
class Problem;
|
||||
class Pal;
|
||||
class LabelPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +148,7 @@ class CORE_EXPORT QgsAbstractLabelProvider
|
||||
Flags flags() const { return mFlags; }
|
||||
|
||||
//! What placement strategy to use for the labels
|
||||
QgsPalLayerSettings::Placement placement() const { return mPlacement; }
|
||||
Qgis::LabelPlacement placement() const { return mPlacement; }
|
||||
|
||||
//! Default priority of labels (may be overridden by individual labels)
|
||||
double priority() const { return mPriority; }
|
||||
@ -154,7 +157,7 @@ class CORE_EXPORT QgsAbstractLabelProvider
|
||||
QgsLabelObstacleSettings::ObstacleType obstacleType() const { return mObstacleType; }
|
||||
|
||||
//! How to handle labels that would be upside down
|
||||
QgsPalLayerSettings::UpsideDownLabels upsidedownLabels() const { return mUpsidedownLabels; }
|
||||
Qgis::UpsideDownLabelHandling upsidedownLabels() const { return mUpsidedownLabels; }
|
||||
|
||||
/**
|
||||
* Returns the expression context scope created from the layer associated with this provider.
|
||||
@ -183,15 +186,15 @@ class CORE_EXPORT QgsAbstractLabelProvider
|
||||
//! Associated provider ID (one layer may have multiple providers, e.g. in rule-based labeling)
|
||||
QString mProviderId;
|
||||
//! Flags altering drawing and registration of features
|
||||
Flags mFlags;
|
||||
Flags mFlags = DrawLabels;
|
||||
//! Placement strategy
|
||||
QgsPalLayerSettings::Placement mPlacement;
|
||||
Qgis::LabelPlacement mPlacement = Qgis::LabelPlacement::AroundPoint;
|
||||
//! Default priority of labels
|
||||
double mPriority;
|
||||
double mPriority = 0.5;
|
||||
//! Type of the obstacle of feature geometries
|
||||
QgsLabelObstacleSettings::ObstacleType mObstacleType = QgsLabelObstacleSettings::PolygonBoundary;
|
||||
//! How to handle labels that would be upside down
|
||||
QgsPalLayerSettings::UpsideDownLabels mUpsidedownLabels;
|
||||
Qgis::UpsideDownLabelHandling mUpsidedownLabels = Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels;
|
||||
|
||||
private:
|
||||
|
||||
@ -529,7 +532,7 @@ class CORE_EXPORT QgsLabelingUtils
|
||||
* \returns list encoded to string
|
||||
* \see decodePredefinedPositionOrder()
|
||||
*/
|
||||
static QString encodePredefinedPositionOrder( const QVector< QgsPalLayerSettings::PredefinedPointPosition > &positions );
|
||||
static QString encodePredefinedPositionOrder( const QVector< Qgis::LabelPredefinedPointPosition > &positions );
|
||||
|
||||
/**
|
||||
* Decodes a string to an ordered list of predefined point label positions.
|
||||
@ -537,7 +540,7 @@ class CORE_EXPORT QgsLabelingUtils
|
||||
* \returns decoded list
|
||||
* \see encodePredefinedPositionOrder()
|
||||
*/
|
||||
static QVector< QgsPalLayerSettings::PredefinedPointPosition > decodePredefinedPositionOrder( const QString &positionString );
|
||||
static QVector< Qgis::LabelPredefinedPointPosition > decodePredefinedPositionOrder( const QString &positionString );
|
||||
|
||||
/**
|
||||
* Encodes line placement \a flags to a string.
|
||||
|
||||
@ -90,17 +90,17 @@ using namespace pal;
|
||||
based on my preferences, and to follow Krygier and Wood's placements more closer. (I'm not going to disagree
|
||||
with Denis Wood on anything cartography related...!)
|
||||
*/
|
||||
typedef QVector< QgsPalLayerSettings::PredefinedPointPosition > PredefinedPointPositionVector;
|
||||
typedef QVector< Qgis::LabelPredefinedPointPosition > PredefinedPointPositionVector;
|
||||
Q_GLOBAL_STATIC_WITH_ARGS( PredefinedPointPositionVector, DEFAULT_PLACEMENT_ORDER, (
|
||||
{
|
||||
QgsPalLayerSettings::TopRight,
|
||||
QgsPalLayerSettings::TopLeft,
|
||||
QgsPalLayerSettings::BottomRight,
|
||||
QgsPalLayerSettings::BottomLeft,
|
||||
QgsPalLayerSettings::MiddleRight,
|
||||
QgsPalLayerSettings::MiddleLeft,
|
||||
QgsPalLayerSettings::TopSlightlyRight,
|
||||
QgsPalLayerSettings::BottomSlightlyRight
|
||||
Qgis::LabelPredefinedPointPosition::TopRight,
|
||||
Qgis::LabelPredefinedPointPosition::TopLeft,
|
||||
Qgis::LabelPredefinedPointPosition::BottomRight,
|
||||
Qgis::LabelPredefinedPointPosition::BottomLeft,
|
||||
Qgis::LabelPredefinedPointPosition::MiddleRight,
|
||||
Qgis::LabelPredefinedPointPosition::MiddleLeft,
|
||||
Qgis::LabelPredefinedPointPosition::TopSlightlyRight,
|
||||
Qgis::LabelPredefinedPointPosition::BottomSlightlyRight
|
||||
} ) )
|
||||
//debugging only - don't use these placements by default
|
||||
/* << QgsPalLayerSettings::TopSlightlyLeft
|
||||
@ -550,7 +550,7 @@ void QgsPalLayerSettings::startRender( QgsRenderContext &context )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( placement == QgsPalLayerSettings::Curved )
|
||||
if ( placement == Qgis::LabelPlacement::Curved )
|
||||
{
|
||||
// force horizontal orientation, other orientation modes aren't unsupported for curved placement
|
||||
mFormat.setOrientation( QgsTextFormat::HorizontalOrientation );
|
||||
@ -715,12 +715,12 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
|
||||
if ( layer->customProperty( QStringLiteral( "labeling" ) ).toString() != QLatin1String( "pal" ) )
|
||||
{
|
||||
if ( layer->geometryType() == QgsWkbTypes::PointGeometry )
|
||||
placement = OrderedPositionsAroundPoint;
|
||||
placement = Qgis::LabelPlacement::OrderedPositionsAroundPoint;
|
||||
|
||||
// for polygons the "over point" (over centroid) placement is better than the default
|
||||
// "around point" (around centroid) which is more suitable for points
|
||||
if ( layer->geometryType() == QgsWkbTypes::PolygonGeometry )
|
||||
placement = OverPoint;
|
||||
placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
return; // there's no information available
|
||||
}
|
||||
@ -748,7 +748,7 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
|
||||
autoWrapLength = layer->customProperty( QStringLiteral( "labeling/autoWrapLength" ) ).toInt();
|
||||
useMaxLineLengthForAutoWrap = layer->customProperty( QStringLiteral( "labeling/useMaxLineLengthForAutoWrap" ), QStringLiteral( "1" ) ).toBool();
|
||||
|
||||
multilineAlign = static_cast< MultiLineAlign >( layer->customProperty( QStringLiteral( "labeling/multilineAlign" ), QVariant( MultiFollowPlacement ) ).toUInt() );
|
||||
multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( layer->customProperty( QStringLiteral( "labeling/multilineAlign" ), QVariant( static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) ) ).toUInt() );
|
||||
mLineSettings.setAddDirectionSymbol( layer->customProperty( QStringLiteral( "labeling/addDirectionSymbol" ) ).toBool() );
|
||||
mLineSettings.setLeftDirectionSymbol( layer->customProperty( QStringLiteral( "labeling/leftDirectionSymbol" ), QVariant( "<" ) ).toString() );
|
||||
mLineSettings.setRightDirectionSymbol( layer->customProperty( QStringLiteral( "labeling/rightDirectionSymbol" ), QVariant( ">" ) ).toString() );
|
||||
@ -759,7 +759,7 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
|
||||
plusSign = layer->customProperty( QStringLiteral( "labeling/plussign" ) ).toBool();
|
||||
|
||||
// placement
|
||||
placement = static_cast< Placement >( layer->customProperty( QStringLiteral( "labeling/placement" ) ).toInt() );
|
||||
placement = static_cast< Qgis::LabelPlacement >( layer->customProperty( QStringLiteral( "labeling/placement" ) ).toInt() );
|
||||
mLineSettings.setPlacementFlags( static_cast< QgsLabeling::LinePlacementFlags >( layer->customProperty( QStringLiteral( "labeling/placementFlags" ) ).toUInt() ) );
|
||||
centroidWhole = layer->customProperty( QStringLiteral( "labeling/centroidWhole" ), QVariant( false ) ).toBool();
|
||||
centroidInside = layer->customProperty( QStringLiteral( "labeling/centroidInside" ), QVariant( false ) ).toBool();
|
||||
@ -781,8 +781,8 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
|
||||
{
|
||||
distMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( layer->customProperty( QStringLiteral( "labeling/distMapUnitScale" ) ).toString() );
|
||||
}
|
||||
offsetType = static_cast< OffsetType >( layer->customProperty( QStringLiteral( "labeling/offsetType" ), QVariant( FromPoint ) ).toUInt() );
|
||||
quadOffset = static_cast< QuadrantPosition >( layer->customProperty( QStringLiteral( "labeling/quadOffset" ), QVariant( QuadrantOver ) ).toUInt() );
|
||||
offsetType = static_cast< Qgis::LabelOffsetType >( layer->customProperty( QStringLiteral( "labeling/offsetType" ), QVariant( static_cast< int >( Qgis::LabelOffsetType::FromPoint ) ) ).toUInt() );
|
||||
quadOffset = static_cast< Qgis::LabelQuadrantPosition >( layer->customProperty( QStringLiteral( "labeling/quadOffset" ), QVariant( static_cast< int >( Qgis::LabelQuadrantPosition::Over ) ) ).toUInt() );
|
||||
xOffset = layer->customProperty( QStringLiteral( "labeling/xOffset" ), QVariant( 0.0 ) ).toDouble();
|
||||
yOffset = layer->customProperty( QStringLiteral( "labeling/yOffset" ), QVariant( 0.0 ) ).toDouble();
|
||||
if ( layer->customProperty( QStringLiteral( "labeling/labelOffsetInMapUnits" ), QVariant( true ) ).toBool() )
|
||||
@ -886,7 +886,7 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer )
|
||||
mPlacementSettings.setOverlapHandling( Qgis::LabelOverlapHandling::PreventOverlap );
|
||||
mPlacementSettings.setAllowDegradedPlacement( false );
|
||||
}
|
||||
upsidedownLabels = static_cast< UpsideDownLabels >( layer->customProperty( QStringLiteral( "labeling/upsidedownLabels" ), QVariant( Upright ) ).toUInt() );
|
||||
upsidedownLabels = static_cast< Qgis::UpsideDownLabelHandling >( layer->customProperty( QStringLiteral( "labeling/upsidedownLabels" ), QVariant( static_cast< int >( Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels ) ) ).toUInt() );
|
||||
|
||||
labelPerPart = layer->customProperty( QStringLiteral( "labeling/labelPerPart" ) ).toBool();
|
||||
mLineSettings.setMergeLines( layer->customProperty( QStringLiteral( "labeling/mergeLines" ) ).toBool() );
|
||||
@ -970,7 +970,7 @@ void QgsPalLayerSettings::readXml( const QDomElement &elem, const QgsReadWriteCo
|
||||
wrapChar = textFormatElem.attribute( QStringLiteral( "wrapChar" ) );
|
||||
autoWrapLength = textFormatElem.attribute( QStringLiteral( "autoWrapLength" ), QStringLiteral( "0" ) ).toInt();
|
||||
useMaxLineLengthForAutoWrap = textFormatElem.attribute( QStringLiteral( "useMaxLineLengthForAutoWrap" ), QStringLiteral( "1" ) ).toInt();
|
||||
multilineAlign = static_cast< MultiLineAlign >( textFormatElem.attribute( QStringLiteral( "multilineAlign" ), QString::number( MultiFollowPlacement ) ).toUInt() );
|
||||
multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( textFormatElem.attribute( QStringLiteral( "multilineAlign" ), QString::number( static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) ) ).toUInt() );
|
||||
mLineSettings.setAddDirectionSymbol( textFormatElem.attribute( QStringLiteral( "addDirectionSymbol" ) ).toInt() );
|
||||
mLineSettings.setLeftDirectionSymbol( textFormatElem.attribute( QStringLiteral( "leftDirectionSymbol" ), QStringLiteral( "<" ) ) );
|
||||
mLineSettings.setRightDirectionSymbol( textFormatElem.attribute( QStringLiteral( "rightDirectionSymbol" ), QStringLiteral( ">" ) ) );
|
||||
@ -982,7 +982,7 @@ void QgsPalLayerSettings::readXml( const QDomElement &elem, const QgsReadWriteCo
|
||||
|
||||
// placement
|
||||
QDomElement placementElem = elem.firstChildElement( QStringLiteral( "placement" ) );
|
||||
placement = static_cast< Placement >( placementElem.attribute( QStringLiteral( "placement" ) ).toInt() );
|
||||
placement = static_cast< Qgis::LabelPlacement >( placementElem.attribute( QStringLiteral( "placement" ) ).toInt() );
|
||||
mLineSettings.setPlacementFlags( static_cast< QgsLabeling::LinePlacementFlags >( placementElem.attribute( QStringLiteral( "placementFlags" ) ).toUInt() ) );
|
||||
mPolygonPlacementFlags = static_cast< QgsLabeling::PolygonPlacementFlags >( placementElem.attribute( QStringLiteral( "polygonPlacementFlags" ), QString::number( static_cast< int >( QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon ) ) ).toInt() );
|
||||
|
||||
@ -1016,8 +1016,8 @@ void QgsPalLayerSettings::readXml( const QDomElement &elem, const QgsReadWriteCo
|
||||
{
|
||||
distMapUnitScale = QgsSymbolLayerUtils::decodeMapUnitScale( placementElem.attribute( QStringLiteral( "distMapUnitScale" ) ) );
|
||||
}
|
||||
offsetType = static_cast< OffsetType >( placementElem.attribute( QStringLiteral( "offsetType" ), QString::number( FromPoint ) ).toUInt() );
|
||||
quadOffset = static_cast< QuadrantPosition >( placementElem.attribute( QStringLiteral( "quadOffset" ), QString::number( QuadrantOver ) ).toUInt() );
|
||||
offsetType = static_cast< Qgis::LabelOffsetType >( placementElem.attribute( QStringLiteral( "offsetType" ), QString::number( static_cast< int >( Qgis::LabelOffsetType::FromPoint ) ) ).toUInt() );
|
||||
quadOffset = static_cast< Qgis::LabelQuadrantPosition >( placementElem.attribute( QStringLiteral( "quadOffset" ), QString::number( static_cast< int >( Qgis::LabelQuadrantPosition::Over ) ) ).toUInt() );
|
||||
xOffset = placementElem.attribute( QStringLiteral( "xOffset" ), QStringLiteral( "0" ) ).toDouble();
|
||||
yOffset = placementElem.attribute( QStringLiteral( "yOffset" ), QStringLiteral( "0" ) ).toDouble();
|
||||
if ( !placementElem.hasAttribute( QStringLiteral( "offsetUnits" ) ) )
|
||||
@ -1141,7 +1141,7 @@ void QgsPalLayerSettings::readXml( const QDomElement &elem, const QgsReadWriteCo
|
||||
mPlacementSettings.setAllowDegradedPlacement( false );
|
||||
}
|
||||
}
|
||||
upsidedownLabels = static_cast< UpsideDownLabels >( renderingElem.attribute( QStringLiteral( "upsidedownLabels" ), QString::number( Upright ) ).toUInt() );
|
||||
upsidedownLabels = static_cast< Qgis::UpsideDownLabelHandling >( renderingElem.attribute( QStringLiteral( "upsidedownLabels" ), QString::number( static_cast< int >( Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels ) ) ).toUInt() );
|
||||
|
||||
labelPerPart = renderingElem.attribute( QStringLiteral( "labelPerPart" ) ).toInt();
|
||||
mLineSettings.setMergeLines( renderingElem.attribute( QStringLiteral( "mergeLines" ) ).toInt() );
|
||||
@ -1246,7 +1246,7 @@ QDomElement QgsPalLayerSettings::writeXml( QDomDocument &doc, const QgsReadWrite
|
||||
|
||||
// placement
|
||||
QDomElement placementElem = doc.createElement( QStringLiteral( "placement" ) );
|
||||
placementElem.setAttribute( QStringLiteral( "placement" ), placement );
|
||||
placementElem.setAttribute( QStringLiteral( "placement" ), static_cast< int >( placement ) );
|
||||
placementElem.setAttribute( QStringLiteral( "polygonPlacementFlags" ), static_cast< int >( mPolygonPlacementFlags ) );
|
||||
placementElem.setAttribute( QStringLiteral( "placementFlags" ), static_cast< unsigned int >( mLineSettings.placementFlags() ) );
|
||||
placementElem.setAttribute( QStringLiteral( "centroidWhole" ), centroidWhole );
|
||||
@ -1619,7 +1619,7 @@ void QgsPalLayerSettings::calculateLabelSize( const QFontMetricsF *fm, const QSt
|
||||
}
|
||||
|
||||
//consider the space needed for the direction symbol
|
||||
if ( addDirSymb && placement == QgsPalLayerSettings::Line
|
||||
if ( addDirSymb && placement == Qgis::LabelPlacement::Line
|
||||
&& ( !leftDirSymb.isEmpty() || !rightDirSymb.isEmpty() ) )
|
||||
{
|
||||
QString dirSym = leftDirSymb;
|
||||
@ -2042,7 +2042,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
double maxcharanglein = 20.0; // range 20.0-60.0
|
||||
double maxcharangleout = -20.0; // range 20.0-95.0
|
||||
|
||||
if ( placement == QgsPalLayerSettings::Curved || placement == QgsPalLayerSettings::PerimeterCurved )
|
||||
if ( placement == Qgis::LabelPlacement::Curved || placement == Qgis::LabelPlacement::PerimeterCurved )
|
||||
{
|
||||
maxcharanglein = maxCurvedCharAngleIn;
|
||||
maxcharangleout = maxCurvedCharAngleOut;
|
||||
@ -2112,8 +2112,8 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
}
|
||||
|
||||
// whether we're going to create a centroid for polygon
|
||||
bool centroidPoly = ( ( placement == QgsPalLayerSettings::AroundPoint
|
||||
|| placement == QgsPalLayerSettings::OverPoint )
|
||||
bool centroidPoly = ( ( placement == Qgis::LabelPlacement::AroundPoint
|
||||
|| placement == Qgis::LabelPlacement::OverPoint )
|
||||
&& geom.type() == QgsWkbTypes::PolygonGeometry );
|
||||
|
||||
// CLIP the geometry if it is bigger than the extent
|
||||
@ -2199,7 +2199,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
// if using perimeter based labeling for polygons, get the polygon's
|
||||
// linear boundary and use that for the label geometry
|
||||
if ( ( geom.type() == QgsWkbTypes::PolygonGeometry )
|
||||
&& ( placement == Line || placement == PerimeterCurved ) )
|
||||
&& ( placement == Qgis::LabelPlacement::Line || placement == Qgis::LabelPlacement::PerimeterCurved ) )
|
||||
{
|
||||
geom = QgsGeometry( geom.constGet()->boundary() );
|
||||
}
|
||||
@ -2214,7 +2214,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
}
|
||||
geos_geom_clone = QgsGeos::asGeos( geom );
|
||||
|
||||
if ( isObstacle || ( geom.type() == QgsWkbTypes::PointGeometry && offsetType == FromSymbolBounds ) )
|
||||
if ( isObstacle || ( geom.type() == QgsWkbTypes::PointGeometry && offsetType == Qgis::LabelOffsetType::FromSymbolBounds ) )
|
||||
{
|
||||
if ( !obstacleGeometry.isNull() && QgsPalLabeling::geometryRequiresPreparation( obstacleGeometry, context, ct, doClip ? extentGeom : QgsGeometry(), lineSettings.mergeLines() ) )
|
||||
{
|
||||
@ -2276,7 +2276,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
double offsetX = 0.0, offsetY = 0.0;
|
||||
QgsPointXY anchorPosition;
|
||||
|
||||
if ( placement == QgsPalLayerSettings::OverPoint )
|
||||
if ( placement == Qgis::LabelPlacement::OverPoint )
|
||||
{
|
||||
anchorPosition = geom.centroid().asPoint();
|
||||
}
|
||||
@ -2286,7 +2286,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
|
||||
//data defined quadrant offset?
|
||||
bool ddFixedQuad = false;
|
||||
QuadrantPosition quadOff = quadOffset;
|
||||
Qgis::LabelQuadrantPosition quadOff = quadOffset;
|
||||
if ( mDataDefinedProperties.isActive( QgsPalLayerSettings::OffsetQuad ) )
|
||||
{
|
||||
context.expressionContext().setOriginalValueVariable( static_cast< int >( quadOff ) );
|
||||
@ -2297,7 +2297,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
int quadInt = exprVal.toInt( &ok );
|
||||
if ( ok && 0 <= quadInt && quadInt <= 8 )
|
||||
{
|
||||
quadOff = static_cast< QuadrantPosition >( quadInt );
|
||||
quadOff = static_cast< Qgis::LabelQuadrantPosition >( quadInt );
|
||||
ddFixedQuad = true;
|
||||
}
|
||||
}
|
||||
@ -2306,39 +2306,39 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
// adjust quadrant offset of labels
|
||||
switch ( quadOff )
|
||||
{
|
||||
case QuadrantAboveLeft:
|
||||
case Qgis::LabelQuadrantPosition::AboveLeft:
|
||||
quadOffsetX = -1.0;
|
||||
quadOffsetY = 1.0;
|
||||
break;
|
||||
case QuadrantAbove:
|
||||
case Qgis::LabelQuadrantPosition::Above:
|
||||
quadOffsetX = 0.0;
|
||||
quadOffsetY = 1.0;
|
||||
break;
|
||||
case QuadrantAboveRight:
|
||||
case Qgis::LabelQuadrantPosition::AboveRight:
|
||||
quadOffsetX = 1.0;
|
||||
quadOffsetY = 1.0;
|
||||
break;
|
||||
case QuadrantLeft:
|
||||
case Qgis::LabelQuadrantPosition::Left:
|
||||
quadOffsetX = -1.0;
|
||||
quadOffsetY = 0.0;
|
||||
break;
|
||||
case QuadrantRight:
|
||||
case Qgis::LabelQuadrantPosition::Right:
|
||||
quadOffsetX = 1.0;
|
||||
quadOffsetY = 0.0;
|
||||
break;
|
||||
case QuadrantBelowLeft:
|
||||
case Qgis::LabelQuadrantPosition::BelowLeft:
|
||||
quadOffsetX = -1.0;
|
||||
quadOffsetY = -1.0;
|
||||
break;
|
||||
case QuadrantBelow:
|
||||
case Qgis::LabelQuadrantPosition::Below:
|
||||
quadOffsetX = 0.0;
|
||||
quadOffsetY = -1.0;
|
||||
break;
|
||||
case QuadrantBelowRight:
|
||||
case Qgis::LabelQuadrantPosition::BelowRight:
|
||||
quadOffsetX = 1.0;
|
||||
quadOffsetY = -1.0;
|
||||
break;
|
||||
case QuadrantOver:
|
||||
case Qgis::LabelQuadrantPosition::Over:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2693,18 +2693,18 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
labelFeature->setMaximumCharacterAngleOutside( std::clamp( maxcharangleout, -95.0, -20.0 ) * M_PI / 180 );
|
||||
switch ( placement )
|
||||
{
|
||||
case QgsPalLayerSettings::AroundPoint:
|
||||
case QgsPalLayerSettings::OverPoint:
|
||||
case QgsPalLayerSettings::Line:
|
||||
case QgsPalLayerSettings::Horizontal:
|
||||
case QgsPalLayerSettings::Free:
|
||||
case QgsPalLayerSettings::OrderedPositionsAroundPoint:
|
||||
case QgsPalLayerSettings::OutsidePolygons:
|
||||
case Qgis::LabelPlacement::AroundPoint:
|
||||
case Qgis::LabelPlacement::OverPoint:
|
||||
case Qgis::LabelPlacement::Line:
|
||||
case Qgis::LabelPlacement::Horizontal:
|
||||
case Qgis::LabelPlacement::Free:
|
||||
case Qgis::LabelPlacement::OrderedPositionsAroundPoint:
|
||||
case Qgis::LabelPlacement::OutsidePolygons:
|
||||
// these placements don't require text metrics
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::Curved:
|
||||
case QgsPalLayerSettings::PerimeterCurved:
|
||||
case Qgis::LabelPlacement::Curved:
|
||||
case Qgis::LabelPlacement::PerimeterCurved:
|
||||
labelFeature->setTextMetrics( QgsTextLabelFeature::calculateTextMetrics( xform, *labelFontMetrics, labelFont.letterSpacing(), labelFont.wordSpacing(), labelText, format().allowHtmlFormatting() ? &doc : nullptr ) );
|
||||
break;
|
||||
}
|
||||
@ -2745,17 +2745,17 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
|
||||
// when using certain placement modes, we force a tiny minimum distance. This ensures that
|
||||
// candidates are created just offset from a border and avoids candidates being incorrectly flagged as colliding with neighbours
|
||||
if ( placement == QgsPalLayerSettings::Line
|
||||
|| placement == QgsPalLayerSettings::Curved
|
||||
|| placement == QgsPalLayerSettings::PerimeterCurved )
|
||||
if ( placement == Qgis::LabelPlacement::Line
|
||||
|| placement == Qgis::LabelPlacement::Curved
|
||||
|| placement == Qgis::LabelPlacement::PerimeterCurved )
|
||||
{
|
||||
distance = ( distance < 0 ? -1 : 1 ) * std::max( std::fabs( distance ), 1.0 );
|
||||
}
|
||||
else if ( placement == QgsPalLayerSettings::OutsidePolygons
|
||||
|| ( ( placement == QgsPalLayerSettings::Horizontal
|
||||
|| placement == QgsPalLayerSettings::AroundPoint
|
||||
|| placement == QgsPalLayerSettings::OverPoint ||
|
||||
placement == QgsPalLayerSettings::Free ) && polygonPlacement & QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon ) )
|
||||
else if ( placement == Qgis::LabelPlacement::OutsidePolygons
|
||||
|| ( ( placement == Qgis::LabelPlacement::Horizontal
|
||||
|| placement == Qgis::LabelPlacement::AroundPoint
|
||||
|| placement == Qgis::LabelPlacement::OverPoint ||
|
||||
placement == Qgis::LabelPlacement::Free ) && polygonPlacement & QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon ) )
|
||||
{
|
||||
distance = std::max( distance, 2.0 );
|
||||
}
|
||||
@ -2836,7 +2836,7 @@ std::unique_ptr<QgsLabelFeature> QgsPalLayerSettings::registerFeatureWithDetails
|
||||
os.setObstacleGeometry( obstacleGeometry );
|
||||
labelFeature->setObstacleSettings( os );
|
||||
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > positionOrder = predefinedPositionOrder;
|
||||
QVector< Qgis::LabelPredefinedPointPosition > positionOrder = predefinedPositionOrder;
|
||||
if ( positionOrder.isEmpty() )
|
||||
positionOrder = *DEFAULT_PLACEMENT_ORDER();
|
||||
|
||||
@ -3424,23 +3424,23 @@ void QgsPalLayerSettings::parseTextFormatting( QgsRenderContext &context )
|
||||
if ( !str.isEmpty() )
|
||||
{
|
||||
// "Left"
|
||||
QgsPalLayerSettings::MultiLineAlign aligntype = QgsPalLayerSettings::MultiLeft;
|
||||
Qgis::LabelMultiLineAlignment aligntype = Qgis::LabelMultiLineAlignment::Left;
|
||||
|
||||
if ( str.compare( QLatin1String( "Center" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
aligntype = QgsPalLayerSettings::MultiCenter;
|
||||
aligntype = Qgis::LabelMultiLineAlignment::Center;
|
||||
}
|
||||
else if ( str.compare( QLatin1String( "Right" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
aligntype = QgsPalLayerSettings::MultiRight;
|
||||
aligntype = Qgis::LabelMultiLineAlignment::Right;
|
||||
}
|
||||
else if ( str.compare( QLatin1String( "Follow" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
aligntype = QgsPalLayerSettings::MultiFollowPlacement;
|
||||
aligntype = Qgis::LabelMultiLineAlignment::FollowPlacement;
|
||||
}
|
||||
else if ( str.compare( QLatin1String( "Justify" ), Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
aligntype = QgsPalLayerSettings::MultiJustify;
|
||||
aligntype = Qgis::LabelMultiLineAlignment::Justify;
|
||||
}
|
||||
dataDefinedValues.insert( QgsPalLayerSettings::MultiLineAlignment, QVariant( static_cast< int >( aligntype ) ) );
|
||||
}
|
||||
@ -4176,7 +4176,7 @@ void QgsPalLabeling::dataDefinedTextFormatting( QgsPalLayerSettings &tmpLyr,
|
||||
|
||||
if ( ddValues.contains( QgsPalLayerSettings::MultiLineAlignment ) )
|
||||
{
|
||||
tmpLyr.multilineAlign = static_cast< QgsPalLayerSettings::MultiLineAlign >( ddValues.value( QgsPalLayerSettings::MultiLineAlignment ).toInt() );
|
||||
tmpLyr.multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( ddValues.value( QgsPalLayerSettings::MultiLineAlignment ).toInt() );
|
||||
}
|
||||
|
||||
if ( ddValues.contains( QgsPalLayerSettings::TextOrientation ) )
|
||||
|
||||
@ -93,54 +93,6 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
//! copy operator - only copies the permanent members
|
||||
QgsPalLayerSettings &operator=( const QgsPalLayerSettings &s );
|
||||
|
||||
//TODO QGIS 4.0 - move to QgsLabelingEngine
|
||||
|
||||
/**
|
||||
* Placement modes which determine how label candidates are generated for a feature.
|
||||
*/
|
||||
enum Placement
|
||||
{
|
||||
AroundPoint, //!< Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygon layers only.
|
||||
OverPoint, //!< Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point. Applies to point or polygon layers only.
|
||||
Line, //!< Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon's perimeter. Applies to line or polygon layers only.
|
||||
Curved, //!< Arranges candidates following the curvature of a line feature. Applies to line layers only.
|
||||
Horizontal, //!< Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only.
|
||||
Free, //!< Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the polygon's orientation. Applies to polygon layers only.
|
||||
OrderedPositionsAroundPoint, //!< Candidates are placed in predefined positions around a point. Preference is given to positions with greatest cartographic appeal, e.g., top right, bottom right, etc. Applies to point layers only.
|
||||
PerimeterCurved, //!< Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only.
|
||||
OutsidePolygons, //!< Candidates are placed outside of polygon boundaries. Applies to polygon layers only. Since QGIS 3.14
|
||||
};
|
||||
|
||||
//TODO QGIS 4.0 - move to QgsLabelingEngine
|
||||
//! Positions for labels when using the QgsPalLabeling::OrderedPositionsAroundPoint placement mode
|
||||
enum PredefinedPointPosition
|
||||
{
|
||||
TopLeft, //!< Label on top-left of point
|
||||
TopSlightlyLeft, //!< Label on top of point, slightly left of center
|
||||
TopMiddle, //!< Label directly above point
|
||||
TopSlightlyRight, //!< Label on top of point, slightly right of center
|
||||
TopRight, //!< Label on top-right of point
|
||||
MiddleLeft, //!< Label on left of point
|
||||
MiddleRight, //!< Label on right of point
|
||||
BottomLeft, //!< Label on bottom-left of point
|
||||
BottomSlightlyLeft, //!< Label below point, slightly left of center
|
||||
BottomMiddle, //!< Label directly below point
|
||||
BottomSlightlyRight, //!< Label below point, slightly right of center
|
||||
BottomRight, //!< Label on bottom right of point
|
||||
};
|
||||
|
||||
//TODO QGIS 4.0 - move to QgsLabelingEngine
|
||||
|
||||
/**
|
||||
* Behavior modifier for label offset and distance, only applies in some
|
||||
* label placement modes.
|
||||
*/
|
||||
enum OffsetType
|
||||
{
|
||||
FromPoint, //!< Offset distance applies from point geometry
|
||||
FromSymbolBounds, //!< Offset distance applies from rendered symbol bounds
|
||||
};
|
||||
|
||||
//TODO QGIS 4.0 - remove, replaced by QgsLabeling::LinePlacementFlags
|
||||
|
||||
/**
|
||||
@ -162,28 +114,6 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
above a line, regardless of the line's direction. */
|
||||
};
|
||||
|
||||
enum QuadrantPosition
|
||||
{
|
||||
QuadrantAboveLeft,
|
||||
QuadrantAbove,
|
||||
QuadrantAboveRight,
|
||||
QuadrantLeft,
|
||||
QuadrantOver,
|
||||
QuadrantRight,
|
||||
QuadrantBelowLeft,
|
||||
QuadrantBelow,
|
||||
QuadrantBelowRight,
|
||||
};
|
||||
|
||||
enum UpsideDownLabels
|
||||
{
|
||||
Upright, //!< Upside-down labels (90 <= angle < 270) are shown upright
|
||||
ShowDefined, //!< Show upside down when rotation is layer- or data-defined
|
||||
ShowAll //!< Show upside down for all labels, including dynamic ones
|
||||
};
|
||||
|
||||
//TODO QGIS 4.0 - Remove -- moved to QgsLabelEngineObstacleSettings
|
||||
|
||||
//! \deprecated use QgsLabelLineSettings::DirectionSymbolPlacement instead
|
||||
enum DirectionSymbols
|
||||
{
|
||||
@ -192,16 +122,6 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
SymbolBelow //!< Place direction symbols on below label
|
||||
};
|
||||
|
||||
enum MultiLineAlign
|
||||
{
|
||||
MultiLeft = 0,
|
||||
MultiCenter,
|
||||
MultiRight,
|
||||
MultiFollowPlacement, /*!< Alignment follows placement of label, e.g., labels to the left of a feature
|
||||
will be drawn with right alignment*/
|
||||
MultiJustify, //!< Justified
|
||||
};
|
||||
|
||||
//TODO QGIS 4.0 - Remove -- moved to QgsLabelEngineObstacleSettings
|
||||
|
||||
/**
|
||||
@ -484,7 +404,7 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
bool useMaxLineLengthForAutoWrap = true;
|
||||
|
||||
//! Horizontal alignment of multi-line labels.
|
||||
MultiLineAlign multilineAlign = MultiFollowPlacement;
|
||||
Qgis::LabelMultiLineAlignment multilineAlign = Qgis::LabelMultiLineAlignment::FollowPlacement;
|
||||
|
||||
/**
|
||||
* Set to TRUE to format numeric label text as numbers (e.g. inserting thousand separators
|
||||
@ -510,7 +430,8 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
|
||||
//-- placement
|
||||
|
||||
Placement placement = AroundPoint;
|
||||
//! Label placement mode
|
||||
Qgis::LabelPlacement placement = Qgis::LabelPlacement::AroundPoint;
|
||||
|
||||
/**
|
||||
* Returns the polygon placement flags, which dictate how polygon labels can be placed.
|
||||
@ -547,7 +468,7 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
* is set to QgsPalLayerSettings::OrderedPositionsAroundPoint.
|
||||
* \note not available in Python bindings
|
||||
*/
|
||||
QVector< PredefinedPointPosition > predefinedPositionOrder SIP_SKIP;
|
||||
QVector< Qgis::LabelPredefinedPointPosition > predefinedPositionOrder SIP_SKIP;
|
||||
|
||||
/**
|
||||
* TRUE if only labels which completely fit within a polygon are allowed.
|
||||
@ -576,7 +497,7 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
QgsMapUnitScale distMapUnitScale;
|
||||
|
||||
//! Offset type for layer (only applies in certain placement modes)
|
||||
OffsetType offsetType = FromPoint;
|
||||
Qgis::LabelOffsetType offsetType = Qgis::LabelOffsetType::FromPoint;
|
||||
|
||||
/**
|
||||
* Distance for repeating labels for a single feature.
|
||||
@ -602,7 +523,7 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
/**
|
||||
* Sets the quadrant in which to offset labels from feature.
|
||||
*/
|
||||
QuadrantPosition quadOffset = QuadrantOver;
|
||||
Qgis::LabelQuadrantPosition quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
|
||||
/**
|
||||
* Horizontal offset of label. Units are specified via offsetUnits.
|
||||
@ -729,7 +650,7 @@ class CORE_EXPORT QgsPalLayerSettings
|
||||
int fontMaxPixelSize = 10000;
|
||||
|
||||
//! Controls whether upside down labels are displayed and how they are handled.
|
||||
UpsideDownLabels upsidedownLabels = Upright;
|
||||
Qgis::UpsideDownLabelHandling upsidedownLabels = Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels;
|
||||
|
||||
/**
|
||||
* TRUE if every part of a multi-part feature should be labeled. If FALSE,
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include "qgslabelfeature.h"
|
||||
#include "qgstextdocument.h"
|
||||
#include "qgstextmetrics.h"
|
||||
#include "qgspallabeling.h"
|
||||
#include <optional>
|
||||
|
||||
class QgsTextCharacterFormat;
|
||||
|
||||
@ -55,14 +55,14 @@ QgsPalLayerSettings QgsAbstractVectorLayerLabeling::defaultSettingsForLayer( con
|
||||
switch ( layer->geometryType() )
|
||||
{
|
||||
case QgsWkbTypes::PointGeometry:
|
||||
settings.placement = QgsPalLayerSettings::OrderedPositionsAroundPoint;
|
||||
settings.offsetType = QgsPalLayerSettings::FromSymbolBounds;
|
||||
settings.placement = Qgis::LabelPlacement::OrderedPositionsAroundPoint;
|
||||
settings.offsetType = Qgis::LabelOffsetType::FromSymbolBounds;
|
||||
break;
|
||||
case QgsWkbTypes::LineGeometry:
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
break;
|
||||
case QgsWkbTypes::PolygonGeometry:
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::UnknownGeometry:
|
||||
@ -136,46 +136,46 @@ QgsVectorLayerSimpleLabeling *QgsVectorLayerSimpleLabeling::create( const QDomEl
|
||||
return new QgsVectorLayerSimpleLabeling( QgsPalLayerSettings() );
|
||||
}
|
||||
|
||||
QPointF quadOffsetToSldAnchor( QgsPalLayerSettings::QuadrantPosition quadrantPosition )
|
||||
QPointF quadOffsetToSldAnchor( Qgis::LabelQuadrantPosition quadrantPosition )
|
||||
{
|
||||
double quadOffsetX = 0.5, quadOffsetY = 0.5;
|
||||
|
||||
// adjust quadrant offset of labels
|
||||
switch ( quadrantPosition )
|
||||
{
|
||||
case QgsPalLayerSettings::QuadrantAboveLeft:
|
||||
case Qgis::LabelQuadrantPosition::AboveLeft:
|
||||
quadOffsetX = 1;
|
||||
quadOffsetY = 0;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantAbove:
|
||||
case Qgis::LabelQuadrantPosition::Above:
|
||||
quadOffsetX = 0.5;
|
||||
quadOffsetY = 0;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantAboveRight:
|
||||
case Qgis::LabelQuadrantPosition::AboveRight:
|
||||
quadOffsetX = 0;
|
||||
quadOffsetY = 0;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantLeft:
|
||||
case Qgis::LabelQuadrantPosition::Left:
|
||||
quadOffsetX = 1;
|
||||
quadOffsetY = 0.5;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantRight:
|
||||
case Qgis::LabelQuadrantPosition::Right:
|
||||
quadOffsetX = 0;
|
||||
quadOffsetY = 0.5;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelowLeft:
|
||||
case Qgis::LabelQuadrantPosition::BelowLeft:
|
||||
quadOffsetX = 1;
|
||||
quadOffsetY = 1;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelow:
|
||||
case Qgis::LabelQuadrantPosition::Below:
|
||||
quadOffsetX = 0.5;
|
||||
quadOffsetY = 1;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantBelowRight:
|
||||
case Qgis::LabelQuadrantPosition::BelowRight:
|
||||
quadOffsetX = 0;
|
||||
quadOffsetY = 1.0;
|
||||
break;
|
||||
case QgsPalLayerSettings::QuadrantOver:
|
||||
case Qgis::LabelQuadrantPosition::Over:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
double repeatDistance = 0;
|
||||
switch ( settings.placement )
|
||||
{
|
||||
case QgsPalLayerSettings::OverPoint:
|
||||
case Qgis::LabelPlacement::OverPoint:
|
||||
{
|
||||
QDomElement pointPlacement = doc.createElement( "se:PointPlacement" );
|
||||
labelPlacement.appendChild( pointPlacement );
|
||||
@ -364,8 +364,8 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QgsPalLayerSettings::AroundPoint:
|
||||
case QgsPalLayerSettings::OrderedPositionsAroundPoint:
|
||||
case Qgis::LabelPlacement::AroundPoint:
|
||||
case Qgis::LabelPlacement::OrderedPositionsAroundPoint:
|
||||
{
|
||||
QDomElement pointPlacement = doc.createElement( "se:PointPlacement" );
|
||||
labelPlacement.appendChild( pointPlacement );
|
||||
@ -380,9 +380,9 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
QgsSymbolLayerUtils::createDisplacementElement( doc, pointPlacement, QPointF( offset, offset ) );
|
||||
}
|
||||
break;
|
||||
case QgsPalLayerSettings::Horizontal:
|
||||
case QgsPalLayerSettings::Free:
|
||||
case QgsPalLayerSettings::OutsidePolygons:
|
||||
case Qgis::LabelPlacement::Horizontal:
|
||||
case Qgis::LabelPlacement::Free:
|
||||
case Qgis::LabelPlacement::OutsidePolygons:
|
||||
{
|
||||
// still a point placement (for "free" it's a fallback, there is no SLD equivalent)
|
||||
QDomElement pointPlacement = doc.createElement( "se:PointPlacement" );
|
||||
@ -393,9 +393,9 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
QgsSymbolLayerUtils::createDisplacementElement( doc, pointPlacement, QPointF( 0, dist ) );
|
||||
break;
|
||||
}
|
||||
case QgsPalLayerSettings::Line:
|
||||
case QgsPalLayerSettings::Curved:
|
||||
case QgsPalLayerSettings::PerimeterCurved:
|
||||
case Qgis::LabelPlacement::Line:
|
||||
case Qgis::LabelPlacement::Curved:
|
||||
case Qgis::LabelPlacement::PerimeterCurved:
|
||||
{
|
||||
QDomElement linePlacement = doc.createElement( "se:LinePlacement" );
|
||||
labelPlacement.appendChild( linePlacement );
|
||||
@ -501,7 +501,7 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
const QDomElement vo = QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "maxDisplacement" ), qgsDoubleToString( maxDisplacement, 2 ) );
|
||||
textSymbolizerElement.appendChild( vo );
|
||||
}
|
||||
if ( settings.placement == QgsPalLayerSettings::Curved || settings.placement == QgsPalLayerSettings::PerimeterCurved )
|
||||
if ( settings.placement == Qgis::LabelPlacement::Curved || settings.placement == Qgis::LabelPlacement::PerimeterCurved )
|
||||
{
|
||||
const QDomElement vo = QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "followLine" ), QStringLiteral( "true" ) );
|
||||
textSymbolizerElement.appendChild( vo );
|
||||
@ -529,7 +529,7 @@ void QgsAbstractVectorLayerLabeling::writeTextSymbolizer( QDomNode &parent, QgsP
|
||||
textSymbolizerElement.appendChild( vo );
|
||||
break;
|
||||
}
|
||||
if ( settings.upsidedownLabels == QgsPalLayerSettings::ShowAll )
|
||||
if ( settings.upsidedownLabels == Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown )
|
||||
{
|
||||
const QDomElement vo = QgsSymbolLayerUtils::createVendorOptionElement( doc, QStringLiteral( "forceLeftToRight" ), QStringLiteral( "false" ) );
|
||||
textSymbolizerElement.appendChild( vo );
|
||||
|
||||
@ -383,7 +383,7 @@ void QgsVectorLayerLabelProvider::drawLabel( QgsRenderContext &context, pal::Lab
|
||||
format.setSizeUnit( QgsUnitTypes::RenderPixels );
|
||||
tmpLyr.setFormat( format );
|
||||
|
||||
if ( tmpLyr.multilineAlign == QgsPalLayerSettings::MultiFollowPlacement )
|
||||
if ( tmpLyr.multilineAlign == Qgis::LabelMultiLineAlignment::FollowPlacement )
|
||||
{
|
||||
//calculate font alignment based on label quadrant
|
||||
switch ( label->getQuadrant() )
|
||||
@ -391,17 +391,17 @@ void QgsVectorLayerLabelProvider::drawLabel( QgsRenderContext &context, pal::Lab
|
||||
case LabelPosition::QuadrantAboveLeft:
|
||||
case LabelPosition::QuadrantLeft:
|
||||
case LabelPosition::QuadrantBelowLeft:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiRight;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Right;
|
||||
break;
|
||||
case LabelPosition::QuadrantAbove:
|
||||
case LabelPosition::QuadrantOver:
|
||||
case LabelPosition::QuadrantBelow:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiCenter;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Center;
|
||||
break;
|
||||
case LabelPosition::QuadrantAboveRight:
|
||||
case LabelPosition::QuadrantRight:
|
||||
case LabelPosition::QuadrantBelowRight:
|
||||
tmpLyr.multilineAlign = QgsPalLayerSettings::MultiLeft;
|
||||
tmpLyr.multilineAlign = Qgis::LabelMultiLineAlignment::Left;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -594,7 +594,7 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q
|
||||
}
|
||||
|
||||
//add the direction symbol if needed
|
||||
if ( !txt.isEmpty() && tmpLyr.placement == QgsPalLayerSettings::Line &&
|
||||
if ( !txt.isEmpty() && tmpLyr.placement == Qgis::LabelPlacement::Line &&
|
||||
tmpLyr.lineSettings().addDirectionSymbol() )
|
||||
{
|
||||
bool prependSymb = false;
|
||||
@ -647,11 +647,11 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q
|
||||
}
|
||||
|
||||
QgsTextRenderer::HAlignment hAlign = QgsTextRenderer::AlignLeft;
|
||||
if ( tmpLyr.multilineAlign == QgsPalLayerSettings::MultiCenter )
|
||||
if ( tmpLyr.multilineAlign == Qgis::LabelMultiLineAlignment::Center )
|
||||
hAlign = QgsTextRenderer::AlignCenter;
|
||||
else if ( tmpLyr.multilineAlign == QgsPalLayerSettings::MultiRight )
|
||||
else if ( tmpLyr.multilineAlign == Qgis::LabelMultiLineAlignment::Right )
|
||||
hAlign = QgsTextRenderer::AlignRight;
|
||||
else if ( tmpLyr.multilineAlign == QgsPalLayerSettings::MultiJustify )
|
||||
else if ( tmpLyr.multilineAlign == Qgis::LabelMultiLineAlignment::Justify )
|
||||
hAlign = QgsTextRenderer::AlignJustify;
|
||||
|
||||
QgsTextRenderer::Component component;
|
||||
@ -659,7 +659,7 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition *label, Q
|
||||
component.rotation = label->getAlpha();
|
||||
|
||||
QgsTextDocument document;
|
||||
if ( !tmpLyr.format().allowHtmlFormatting() || tmpLyr.placement == QgsPalLayerSettings::Curved )
|
||||
if ( !tmpLyr.format().allowHtmlFormatting() || tmpLyr.placement == Qgis::LabelPlacement::Curved )
|
||||
{
|
||||
const QgsTextCharacterFormat c = lf->characterFormat( label->getPartId() );
|
||||
const QStringList multiLineList = QgsPalLabeling::splitToLines( txt, tmpLyr.wrapChar, tmpLyr.autoWrapLength, tmpLyr.useMaxLineLengthForAutoWrap );
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "qgslabelingengine.h"
|
||||
#include "qgsrenderer.h"
|
||||
#include "qgstextrenderer.h"
|
||||
#include "qgspallabeling.h"
|
||||
|
||||
class QgsAbstractFeatureSource;
|
||||
class QgsFeatureRenderer;
|
||||
|
||||
@ -245,8 +245,8 @@ void CostCalculator::finalizeCandidatesCosts( Feats *feat, double bbx[4], double
|
||||
|
||||
if ( feat->feature->getGeosType() == GEOS_POLYGON )
|
||||
{
|
||||
const int arrangement = feat->feature->layer()->arrangement();
|
||||
if ( arrangement == QgsPalLayerSettings::Free || arrangement == QgsPalLayerSettings::Horizontal )
|
||||
const Qgis::LabelPlacement arrangement = feat->feature->layer()->arrangement();
|
||||
if ( arrangement == Qgis::LabelPlacement::Free || arrangement == Qgis::LabelPlacement::Horizontal )
|
||||
{
|
||||
// prefer positions closer to the pole of inaccessibilities
|
||||
calculateCandidatePolygonRingDistanceCosts( feat->candidates, bbx, bby );
|
||||
|
||||
@ -353,7 +353,7 @@ std::size_t FeaturePart::createCandidatesOverPoint( double x, double y, std::vec
|
||||
}
|
||||
}
|
||||
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::AroundPoint )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::AroundPoint )
|
||||
{
|
||||
//if in "around point" placement mode, then we use the label distance to determine
|
||||
//the label's offset
|
||||
@ -430,7 +430,7 @@ std::unique_ptr<LabelPosition> FeaturePart::createCandidatePointOnSurface( Point
|
||||
return std::make_unique< LabelPosition >( 0, px, py, getLabelWidth(), getLabelHeight(), 0.0, 0.0, this, false, LabelPosition::QuadrantOver );
|
||||
}
|
||||
|
||||
void createCandidateAtOrderedPositionOverPoint( double &labelX, double &labelY, LabelPosition::Quadrant &quadrant, double x, double y, double labelWidth, double labelHeight, QgsPalLayerSettings::PredefinedPointPosition position, double distanceToLabel, const QgsMargins &visualMargin, double symbolWidthOffset, double symbolHeightOffset, double angle )
|
||||
void createCandidateAtOrderedPositionOverPoint( double &labelX, double &labelY, LabelPosition::Quadrant &quadrant, double x, double y, double labelWidth, double labelHeight, Qgis::LabelPredefinedPointPosition position, double distanceToLabel, const QgsMargins &visualMargin, double symbolWidthOffset, double symbolHeightOffset, double angle )
|
||||
{
|
||||
double alpha = 0.0;
|
||||
double deltaX = 0;
|
||||
@ -438,84 +438,84 @@ void createCandidateAtOrderedPositionOverPoint( double &labelX, double &labelY,
|
||||
|
||||
switch ( position )
|
||||
{
|
||||
case QgsPalLayerSettings::TopLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::TopLeft:
|
||||
quadrant = LabelPosition::QuadrantAboveLeft;
|
||||
alpha = 3 * M_PI_4;
|
||||
deltaX = -labelWidth + visualMargin.right() - symbolWidthOffset;
|
||||
deltaY = -visualMargin.bottom() + symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::TopSlightlyLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::TopSlightlyLeft:
|
||||
quadrant = LabelPosition::QuadrantAboveRight; //right quadrant, so labels are left-aligned
|
||||
alpha = M_PI_2;
|
||||
deltaX = -labelWidth / 4.0 - visualMargin.left();
|
||||
deltaY = -visualMargin.bottom() + symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::TopMiddle:
|
||||
case Qgis::LabelPredefinedPointPosition::TopMiddle:
|
||||
quadrant = LabelPosition::QuadrantAbove;
|
||||
alpha = M_PI_2;
|
||||
deltaX = -labelWidth / 2.0;
|
||||
deltaY = -visualMargin.bottom() + symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::TopSlightlyRight:
|
||||
case Qgis::LabelPredefinedPointPosition::TopSlightlyRight:
|
||||
quadrant = LabelPosition::QuadrantAboveLeft; //left quadrant, so labels are right-aligned
|
||||
alpha = M_PI_2;
|
||||
deltaX = -labelWidth * 3.0 / 4.0 + visualMargin.right();
|
||||
deltaY = -visualMargin.bottom() + symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::TopRight:
|
||||
case Qgis::LabelPredefinedPointPosition::TopRight:
|
||||
quadrant = LabelPosition::QuadrantAboveRight;
|
||||
alpha = M_PI_4;
|
||||
deltaX = - visualMargin.left() + symbolWidthOffset;
|
||||
deltaY = -visualMargin.bottom() + symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::MiddleLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::MiddleLeft:
|
||||
quadrant = LabelPosition::QuadrantLeft;
|
||||
alpha = M_PI;
|
||||
deltaX = -labelWidth + visualMargin.right() - symbolWidthOffset;
|
||||
deltaY = -labelHeight / 2.0;// TODO - should this be adjusted by visual margin??
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::MiddleRight:
|
||||
case Qgis::LabelPredefinedPointPosition::MiddleRight:
|
||||
quadrant = LabelPosition::QuadrantRight;
|
||||
alpha = 0.0;
|
||||
deltaX = -visualMargin.left() + symbolWidthOffset;
|
||||
deltaY = -labelHeight / 2.0;// TODO - should this be adjusted by visual margin??
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::BottomLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomLeft:
|
||||
quadrant = LabelPosition::QuadrantBelowLeft;
|
||||
alpha = 5 * M_PI_4;
|
||||
deltaX = -labelWidth + visualMargin.right() - symbolWidthOffset;
|
||||
deltaY = -labelHeight + visualMargin.top() - symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::BottomSlightlyLeft:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomSlightlyLeft:
|
||||
quadrant = LabelPosition::QuadrantBelowRight; //right quadrant, so labels are left-aligned
|
||||
alpha = 3 * M_PI_2;
|
||||
deltaX = -labelWidth / 4.0 - visualMargin.left();
|
||||
deltaY = -labelHeight + visualMargin.top() - symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::BottomMiddle:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomMiddle:
|
||||
quadrant = LabelPosition::QuadrantBelow;
|
||||
alpha = 3 * M_PI_2;
|
||||
deltaX = -labelWidth / 2.0;
|
||||
deltaY = -labelHeight + visualMargin.top() - symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::BottomSlightlyRight:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomSlightlyRight:
|
||||
quadrant = LabelPosition::QuadrantBelowLeft; //left quadrant, so labels are right-aligned
|
||||
alpha = 3 * M_PI_2;
|
||||
deltaX = -labelWidth * 3.0 / 4.0 + visualMargin.right();
|
||||
deltaY = -labelHeight + visualMargin.top() - symbolHeightOffset;
|
||||
break;
|
||||
|
||||
case QgsPalLayerSettings::BottomRight:
|
||||
case Qgis::LabelPredefinedPointPosition::BottomRight:
|
||||
quadrant = LabelPosition::QuadrantBelowRight;
|
||||
alpha = 7 * M_PI_4;
|
||||
deltaX = -visualMargin.left() + symbolWidthOffset;
|
||||
@ -539,21 +539,21 @@ void createCandidateAtOrderedPositionOverPoint( double &labelX, double &labelY,
|
||||
|
||||
std::size_t FeaturePart::createCandidatesAtOrderedPositionsOverPoint( double x, double y, std::vector< std::unique_ptr< LabelPosition > > &lPos, double angle )
|
||||
{
|
||||
const QVector< QgsPalLayerSettings::PredefinedPointPosition > positions = mLF->predefinedPositionOrder();
|
||||
const QVector< Qgis::LabelPredefinedPointPosition > positions = mLF->predefinedPositionOrder();
|
||||
double labelWidth = getLabelWidth( angle );
|
||||
double labelHeight = getLabelHeight( angle );
|
||||
double distanceToLabel = getLabelDistance();
|
||||
const QgsMargins &visualMargin = mLF->visualMargin();
|
||||
|
||||
double symbolWidthOffset = ( mLF->offsetType() == QgsPalLayerSettings::FromSymbolBounds ? mLF->symbolSize().width() / 2.0 : 0.0 );
|
||||
double symbolHeightOffset = ( mLF->offsetType() == QgsPalLayerSettings::FromSymbolBounds ? mLF->symbolSize().height() / 2.0 : 0.0 );
|
||||
double symbolWidthOffset = ( mLF->offsetType() == Qgis::LabelOffsetType::FromSymbolBounds ? mLF->symbolSize().width() / 2.0 : 0.0 );
|
||||
double symbolHeightOffset = ( mLF->offsetType() == Qgis::LabelOffsetType::FromSymbolBounds ? mLF->symbolSize().height() / 2.0 : 0.0 );
|
||||
|
||||
double cost = 0.0001;
|
||||
std::size_t i = lPos.size();
|
||||
|
||||
const std::size_t maxNumberCandidates = mLF->layer()->maximumPointLabelCandidates();
|
||||
std::size_t created = 0;
|
||||
for ( QgsPalLayerSettings::PredefinedPointPosition position : positions )
|
||||
for ( Qgis::LabelPredefinedPointPosition position : positions )
|
||||
{
|
||||
LabelPosition::Quadrant quadrant = LabelPosition::QuadrantAboveLeft;
|
||||
|
||||
@ -1055,7 +1055,7 @@ std::size_t FeaturePart::createCandidatesAlongLineNearStraightSegments( std::vec
|
||||
labelHeight = getLabelHeight( angle );
|
||||
beta = angle + M_PI_2;
|
||||
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Line )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Line )
|
||||
{
|
||||
// find out whether the line direction for this candidate is from right to left
|
||||
bool isRightToLeft = ( angle > M_PI_2 || angle <= -M_PI_2 );
|
||||
@ -1089,7 +1089,7 @@ std::size_t FeaturePart::createCandidatesAlongLineNearStraightSegments( std::vec
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Horizontal )
|
||||
else if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Horizontal )
|
||||
{
|
||||
lPos.emplace_back( std::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2, candidateStartY - labelHeight / 2, labelWidth, labelHeight, 0, cost, this, false, LabelPosition::QuadrantOver ) ); // Line
|
||||
}
|
||||
@ -1257,7 +1257,7 @@ std::size_t FeaturePart::createCandidatesAlongLineNearMidpoint( std::vector< std
|
||||
labelHeight = getLabelHeight( angle );
|
||||
beta = angle + M_PI_2;
|
||||
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Line )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Line )
|
||||
{
|
||||
// find out whether the line direction for this candidate is from right to left
|
||||
bool isRightToLeft = ( angle > M_PI_2 || angle <= -M_PI_2 );
|
||||
@ -1291,7 +1291,7 @@ std::size_t FeaturePart::createCandidatesAlongLineNearMidpoint( std::vector< std
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Horizontal )
|
||||
else if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Horizontal )
|
||||
{
|
||||
lPos.emplace_back( std::make_unique< LabelPosition >( i, candidateStartX - labelWidth / 2, candidateStartY - labelHeight / 2, labelWidth, labelHeight, 0, cost, this, false, LabelPosition::QuadrantOver ) ); // Line
|
||||
}
|
||||
@ -1766,7 +1766,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Horizontal && mLF->permissibleZonePrepared() )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Horizontal && mLF->permissibleZonePrepared() )
|
||||
{
|
||||
//check width/height of bbox is sufficient for label
|
||||
if ( mLF->permissibleZone().boundingBox().width() < labelWidth ||
|
||||
@ -1778,7 +1778,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
|
||||
}
|
||||
|
||||
bool enoughPlace = false;
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Free )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Free )
|
||||
{
|
||||
enoughPlace = true;
|
||||
px = ( box.x[0] + box.x[2] ) / 2 - labelWidth;
|
||||
@ -1806,7 +1806,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
|
||||
|
||||
} // arrangement== FREE ?
|
||||
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Horizontal || enoughPlace )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Horizontal || enoughPlace )
|
||||
{
|
||||
alpha = 0.0; // HORIZ
|
||||
}
|
||||
@ -2001,7 +2001,7 @@ std::size_t FeaturePart::createCandidatesOutsidePolygon( std::vector<std::unique
|
||||
const double labelAngle = 0;
|
||||
|
||||
std::size_t i = lPos.size();
|
||||
auto addCandidate = [&]( double x, double y, QgsPalLayerSettings::PredefinedPointPosition position )
|
||||
auto addCandidate = [&]( double x, double y, Qgis::LabelPredefinedPointPosition position )
|
||||
{
|
||||
double labelX = 0;
|
||||
double labelY = 0;
|
||||
@ -2050,61 +2050,61 @@ std::size_t FeaturePart::createCandidatesOutsidePolygon( std::vector<std::unique
|
||||
// adapted fom Rylov & Reimer figure 9
|
||||
if ( angle >= 0 && angle <= 5 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopMiddle );
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopMiddle );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopLeft );
|
||||
}
|
||||
else if ( angle <= 85 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopLeft );
|
||||
}
|
||||
else if ( angle <= 90 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopLeft );
|
||||
addCandidate( x, y, QgsPalLayerSettings::MiddleLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::MiddleLeft );
|
||||
}
|
||||
|
||||
else if ( angle <= 95 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::MiddleLeft );
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::MiddleLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomLeft );
|
||||
}
|
||||
else if ( angle <= 175 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomLeft );
|
||||
}
|
||||
else if ( angle <= 180 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomLeft );
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomMiddle );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomLeft );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomMiddle );
|
||||
}
|
||||
|
||||
else if ( angle <= 185 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomMiddle );
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomMiddle );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomRight );
|
||||
}
|
||||
else if ( angle <= 265 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomRight );
|
||||
}
|
||||
else if ( angle <= 270 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::BottomRight );
|
||||
addCandidate( x, y, QgsPalLayerSettings::MiddleRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::BottomRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::MiddleRight );
|
||||
}
|
||||
else if ( angle <= 275 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::MiddleRight );
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::MiddleRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopRight );
|
||||
}
|
||||
else if ( angle <= 355 )
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopRight );
|
||||
}
|
||||
else
|
||||
{
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopRight );
|
||||
addCandidate( x, y, QgsPalLayerSettings::TopMiddle );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopRight );
|
||||
addCandidate( x, y, Qgis::LabelPredefinedPointPosition::TopMiddle );
|
||||
}
|
||||
|
||||
return !pal->isCanceled();
|
||||
@ -2127,16 +2127,16 @@ std::vector< std::unique_ptr< LabelPosition > > FeaturePart::createCandidates( P
|
||||
switch ( type )
|
||||
{
|
||||
case GEOS_POINT:
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::OrderedPositionsAroundPoint )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::OrderedPositionsAroundPoint )
|
||||
createCandidatesAtOrderedPositionsOverPoint( x[0], y[0], lPos, angle );
|
||||
else if ( mLF->layer()->arrangement() == QgsPalLayerSettings::OverPoint || mLF->hasFixedQuadrant() )
|
||||
else if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::OverPoint || mLF->hasFixedQuadrant() )
|
||||
createCandidatesOverPoint( x[0], y[0], lPos, angle );
|
||||
else
|
||||
createCandidatesAroundPoint( x[0], y[0], lPos, angle );
|
||||
break;
|
||||
|
||||
case GEOS_LINESTRING:
|
||||
if ( mLF->layer()->arrangement() == QgsPalLayerSettings::Horizontal )
|
||||
if ( mLF->layer()->arrangement() == Qgis::LabelPlacement::Horizontal )
|
||||
createHorizontalCandidatesAlongLine( lPos, this, pal );
|
||||
else if ( mLF->layer()->isCurved() )
|
||||
createCurvedCandidatesAlongLine( lPos, this, true, pal );
|
||||
@ -2153,7 +2153,7 @@ std::vector< std::unique_ptr< LabelPosition > > FeaturePart::createCandidates( P
|
||||
const bool allowInside = mLF->polygonPlacementFlags() & QgsLabeling::PolygonPlacementFlag::AllowPlacementInsideOfPolygon;
|
||||
//check width/height of bbox is sufficient for label
|
||||
|
||||
if ( ( allowOutside && !allowInside ) || ( mLF->layer()->arrangement() == QgsPalLayerSettings::OutsidePolygons ) )
|
||||
if ( ( allowOutside && !allowInside ) || ( mLF->layer()->arrangement() == Qgis::LabelPlacement::OutsidePolygons ) )
|
||||
{
|
||||
// only allowed to place outside of polygon
|
||||
createCandidatesOutsidePolygon( lPos, pal );
|
||||
@ -2171,7 +2171,7 @@ std::vector< std::unique_ptr< LabelPosition > > FeaturePart::createCandidates( P
|
||||
{
|
||||
switch ( mLF->layer()->arrangement() )
|
||||
{
|
||||
case QgsPalLayerSettings::AroundPoint:
|
||||
case Qgis::LabelPlacement::AroundPoint:
|
||||
{
|
||||
double cx, cy;
|
||||
getCentroid( cx, cy, mLF->layer()->centroidInside() );
|
||||
@ -2180,17 +2180,17 @@ std::vector< std::unique_ptr< LabelPosition > > FeaturePart::createCandidates( P
|
||||
created += createCandidatesAroundPoint( cx, cy, lPos, angle );
|
||||
break;
|
||||
}
|
||||
case QgsPalLayerSettings::OverPoint:
|
||||
case Qgis::LabelPlacement::OverPoint:
|
||||
{
|
||||
double cx, cy;
|
||||
getCentroid( cx, cy, mLF->layer()->centroidInside() );
|
||||
created += createCandidatesOverPoint( cx, cy, lPos, angle );
|
||||
break;
|
||||
}
|
||||
case QgsPalLayerSettings::Line:
|
||||
case Qgis::LabelPlacement::Line:
|
||||
created += createCandidatesAlongLine( lPos, this, false, pal );
|
||||
break;
|
||||
case QgsPalLayerSettings::PerimeterCurved:
|
||||
case Qgis::LabelPlacement::PerimeterCurved:
|
||||
created += createCurvedCandidatesAlongLine( lPos, this, false, pal );
|
||||
break;
|
||||
default:
|
||||
@ -2369,24 +2369,22 @@ double FeaturePart::calculatePriority() const
|
||||
|
||||
bool FeaturePart::onlyShowUprightLabels() const
|
||||
{
|
||||
bool uprightLabel = false;
|
||||
bool result = false;
|
||||
|
||||
switch ( mLF->layer()->upsidedownLabels() )
|
||||
{
|
||||
case Layer::Upright:
|
||||
uprightLabel = true;
|
||||
case Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels:
|
||||
result = true;
|
||||
break;
|
||||
case Layer::ShowDefined:
|
||||
case Qgis::UpsideDownLabelHandling::AllowUpsideDownWhenRotationIsDefined:
|
||||
// upright only dynamic labels
|
||||
if ( !hasFixedRotation() || ( !hasFixedPosition() && fixedAngle() == 0.0 ) )
|
||||
{
|
||||
uprightLabel = true;
|
||||
result = true;
|
||||
}
|
||||
break;
|
||||
case Layer::ShowAll:
|
||||
case Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown:
|
||||
break;
|
||||
default:
|
||||
uprightLabel = true;
|
||||
}
|
||||
return uprightLabel;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -42,16 +42,13 @@
|
||||
|
||||
using namespace pal;
|
||||
|
||||
Layer::Layer( QgsAbstractLabelProvider *provider, const QString &name, QgsPalLayerSettings::Placement arrangement, double defaultPriority, bool active, bool toLabel, Pal *pal )
|
||||
Layer::Layer( QgsAbstractLabelProvider *provider, const QString &name, Qgis::LabelPlacement arrangement, double defaultPriority, bool active, bool toLabel, Pal *pal )
|
||||
: mProvider( provider )
|
||||
, mName( name )
|
||||
, mPal( pal )
|
||||
, mActive( active )
|
||||
, mLabelLayer( toLabel )
|
||||
, mCentroidInside( false )
|
||||
, mArrangement( arrangement )
|
||||
, mMergeLines( false )
|
||||
, mUpsidedownLabels( Upright )
|
||||
{
|
||||
if ( defaultPriority < 0.0001 )
|
||||
mDefaultPriority = 0.0001;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "pal.h" // for LineArrangementFlags enum
|
||||
#include "qgsgeos.h"
|
||||
#include "qgsgenericspatialindex.h"
|
||||
#include "qgslabelobstaclesettings.h"
|
||||
#include <QMutex>
|
||||
#include <QLinkedList>
|
||||
#include <QHash>
|
||||
@ -68,12 +69,6 @@ namespace pal
|
||||
friend class LabelPosition;
|
||||
|
||||
public:
|
||||
enum UpsideDownLabels
|
||||
{
|
||||
Upright, // upside-down labels (90 <= angle < 270) are shown upright
|
||||
ShowDefined, // show upside down when rotation is layer- or data-defined
|
||||
ShowAll // show upside down for all labels, including dynamic ones
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Create a new layer
|
||||
@ -86,7 +81,7 @@ namespace pal
|
||||
* \param toLabel the layer will be labeled whether toLablel is TRUE
|
||||
* \param pal pointer to the pal object
|
||||
*/
|
||||
Layer( QgsAbstractLabelProvider *provider, const QString &name, QgsPalLayerSettings::Placement arrangement, double defaultPriority, bool active, bool toLabel, Pal *pal );
|
||||
Layer( QgsAbstractLabelProvider *provider, const QString &name, Qgis::LabelPlacement arrangement, double defaultPriority, bool active, bool toLabel, Pal *pal );
|
||||
|
||||
virtual ~Layer();
|
||||
|
||||
@ -170,19 +165,19 @@ namespace pal
|
||||
* Returns the layer's arrangement policy.
|
||||
* \see setArrangement
|
||||
*/
|
||||
QgsPalLayerSettings::Placement arrangement() const { return mArrangement; }
|
||||
Qgis::LabelPlacement arrangement() const { return mArrangement; }
|
||||
|
||||
/**
|
||||
* Returns TRUE if the layer has curved labels
|
||||
*/
|
||||
bool isCurved() const { return mArrangement == QgsPalLayerSettings::Curved || mArrangement == QgsPalLayerSettings::PerimeterCurved; }
|
||||
bool isCurved() const { return mArrangement == Qgis::LabelPlacement::Curved || mArrangement == Qgis::LabelPlacement::PerimeterCurved; }
|
||||
|
||||
/**
|
||||
* Sets the layer's arrangement policy.
|
||||
* \param arrangement arrangement policy
|
||||
* \see arrangement
|
||||
*/
|
||||
void setArrangement( QgsPalLayerSettings::Placement arrangement ) { mArrangement = arrangement; }
|
||||
void setArrangement( Qgis::LabelPlacement arrangement ) { mArrangement = arrangement; }
|
||||
|
||||
/**
|
||||
* \brief Sets whether the layer is currently active.
|
||||
@ -265,13 +260,13 @@ namespace pal
|
||||
* \param ud upside down label handling mode
|
||||
* \see upsidedownLabels
|
||||
*/
|
||||
void setUpsidedownLabels( UpsideDownLabels ud ) { mUpsidedownLabels = ud; }
|
||||
void setUpsidedownLabels( Qgis::UpsideDownLabelHandling ud ) { mUpsidedownLabels = ud; }
|
||||
|
||||
/**
|
||||
* Returns how upside down labels are handled within the layer.
|
||||
* \see setUpsidedownLabels
|
||||
*/
|
||||
UpsideDownLabels upsidedownLabels() const { return mUpsidedownLabels; }
|
||||
Qgis::UpsideDownLabelHandling upsidedownLabels() const { return mUpsidedownLabels; }
|
||||
|
||||
/**
|
||||
* Sets whether labels placed at the centroid of features within the layer
|
||||
@ -332,14 +327,14 @@ namespace pal
|
||||
QgsLabelObstacleSettings::ObstacleType mObstacleType = QgsLabelObstacleSettings::PolygonBoundary;
|
||||
bool mActive;
|
||||
bool mLabelLayer;
|
||||
bool mCentroidInside;
|
||||
bool mCentroidInside = false;
|
||||
|
||||
//! Optional flags used for some placement methods
|
||||
QgsPalLayerSettings::Placement mArrangement;
|
||||
Qgis::LabelPlacement mArrangement;
|
||||
|
||||
bool mMergeLines;
|
||||
bool mMergeLines = false;
|
||||
|
||||
UpsideDownLabels mUpsidedownLabels;
|
||||
Qgis::UpsideDownLabelHandling mUpsidedownLabels = Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels;
|
||||
|
||||
//! Lookup table of label features (owned by the label feature provider that created them)
|
||||
QHash< QgsFeatureId, QgsLabelFeature *> mHashtable;
|
||||
|
||||
@ -77,7 +77,7 @@ void Pal::removeLayer( Layer *layer )
|
||||
mMutex.unlock();
|
||||
}
|
||||
|
||||
Layer *Pal::addLayer( QgsAbstractLabelProvider *provider, const QString &layerName, QgsPalLayerSettings::Placement arrangement, double defaultPriority, bool active, bool toLabel )
|
||||
Layer *Pal::addLayer( QgsAbstractLabelProvider *provider, const QString &layerName, Qgis::LabelPlacement arrangement, double defaultPriority, bool active, bool toLabel )
|
||||
{
|
||||
mMutex.lock();
|
||||
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "qgis_core.h"
|
||||
#include "qgsgeometry.h"
|
||||
#include "qgsgeos.h"
|
||||
#include "qgspallabeling.h"
|
||||
#include "qgslabelingenginesettings.h"
|
||||
#include <QList>
|
||||
#include <iostream>
|
||||
@ -48,6 +47,7 @@
|
||||
// TODO ${MAJOR} ${MINOR} etc instead of 0.2
|
||||
|
||||
class QgsAbstractLabelProvider;
|
||||
class QgsRenderContext;
|
||||
|
||||
namespace pal
|
||||
{
|
||||
@ -108,7 +108,7 @@ namespace pal
|
||||
*
|
||||
* \throws PalException::LayerExists
|
||||
*/
|
||||
Layer *addLayer( QgsAbstractLabelProvider *provider, const QString &layerName, QgsPalLayerSettings::Placement arrangement, double defaultPriority, bool active, bool toLabel );
|
||||
Layer *addLayer( QgsAbstractLabelProvider *provider, const QString &layerName, Qgis::LabelPlacement arrangement, double defaultPriority, bool active, bool toLabel );
|
||||
|
||||
/**
|
||||
* \brief remove a layer
|
||||
|
||||
@ -639,73 +639,73 @@ QgsAbstractVectorLayerLabeling *QgsArcGisRestUtils::convertLabeling( const QVari
|
||||
const QString placement = labeling.value( QStringLiteral( "labelPlacement" ) ).toString();
|
||||
if ( placement == QLatin1String( "esriServerPointLabelPlacementAboveCenter" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantAbove;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::Above;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementBelowCenter" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantBelow;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::Below;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementCenterCenter" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantOver;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementAboveLeft" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantAboveLeft;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::AboveLeft;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementBelowLeft" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantBelowLeft;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::BelowLeft;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementCenterLeft" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantLeft;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::Left;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementAboveRight" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantAboveRight;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::AboveRight;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementBelowRight" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantBelowRight;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::BelowRight;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPointLabelPlacementCenterRight" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::OverPoint;
|
||||
settings->quadOffset = QgsPalLayerSettings::QuadrantRight;
|
||||
settings->placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings->quadOffset = Qgis::LabelQuadrantPosition::Right;
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerLinePlacementAboveAfter" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementAboveStart" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementAboveAlong" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::Line;
|
||||
settings->placement = Qgis::LabelPlacement::Line;
|
||||
settings->lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerLinePlacementBelowAfter" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementBelowStart" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementBelowAlong" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::Line;
|
||||
settings->placement = Qgis::LabelPlacement::Line;
|
||||
settings->lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::BelowLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerLinePlacementCenterAfter" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementCenterStart" ) ||
|
||||
placement == QLatin1String( "esriServerLinePlacementCenterAlong" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::Line;
|
||||
settings->placement = Qgis::LabelPlacement::Line;
|
||||
settings->lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::OnLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
}
|
||||
else if ( placement == QLatin1String( "esriServerPolygonPlacementAlwaysHorizontal" ) )
|
||||
{
|
||||
settings->placement = QgsPalLayerSettings::Horizontal;
|
||||
settings->placement = Qgis::LabelPlacement::Horizontal;
|
||||
}
|
||||
|
||||
const double minScale = labeling.value( QStringLiteral( "minScale" ) ).toDouble();
|
||||
|
||||
114
src/core/qgis.h
114
src/core/qgis.h
@ -550,6 +550,120 @@ class CORE_EXPORT Qgis
|
||||
};
|
||||
Q_ENUM( LabelOverlapHandling )
|
||||
|
||||
/**
|
||||
* Placement modes which determine how label candidates are generated for a feature.
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::Placement
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class LabelPlacement SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, Placement ) : int
|
||||
{
|
||||
AroundPoint, //!< Arranges candidates in a circle around a point (or centroid of a polygon). Applies to point or polygon layers only.
|
||||
OverPoint, //!< Arranges candidates over a point (or centroid of a polygon), or at a preset offset from the point. Applies to point or polygon layers only.
|
||||
Line, //!< Arranges candidates parallel to a generalised line representing the feature or parallel to a polygon's perimeter. Applies to line or polygon layers only.
|
||||
Curved, //!< Arranges candidates following the curvature of a line feature. Applies to line layers only.
|
||||
Horizontal, //!< Arranges horizontal candidates scattered throughout a polygon feature. Applies to polygon layers only.
|
||||
Free, //!< Arranges candidates scattered throughout a polygon feature. Candidates are rotated to respect the polygon's orientation. Applies to polygon layers only.
|
||||
OrderedPositionsAroundPoint, //!< Candidates are placed in predefined positions around a point. Preference is given to positions with greatest cartographic appeal, e.g., top right, bottom right, etc. Applies to point layers only.
|
||||
PerimeterCurved, //!< Arranges candidates following the curvature of a polygon's boundary. Applies to polygon layers only.
|
||||
OutsidePolygons, //!< Candidates are placed outside of polygon boundaries. Applies to polygon layers only. Since QGIS 3.14
|
||||
};
|
||||
Q_ENUM( LabelPlacement )
|
||||
|
||||
|
||||
/**
|
||||
* Positions for labels when using the Qgis::LabelPlacement::OrderedPositionsAroundPoint placement mode.
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::PredefinedPointPosition
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class LabelPredefinedPointPosition SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, PredefinedPointPosition ) : int
|
||||
{
|
||||
TopLeft, //!< Label on top-left of point
|
||||
TopSlightlyLeft, //!< Label on top of point, slightly left of center
|
||||
TopMiddle, //!< Label directly above point
|
||||
TopSlightlyRight, //!< Label on top of point, slightly right of center
|
||||
TopRight, //!< Label on top-right of point
|
||||
MiddleLeft, //!< Label on left of point
|
||||
MiddleRight, //!< Label on right of point
|
||||
BottomLeft, //!< Label on bottom-left of point
|
||||
BottomSlightlyLeft, //!< Label below point, slightly left of center
|
||||
BottomMiddle, //!< Label directly below point
|
||||
BottomSlightlyRight, //!< Label below point, slightly right of center
|
||||
BottomRight, //!< Label on bottom right of point
|
||||
};
|
||||
Q_ENUM( LabelPredefinedPointPosition )
|
||||
|
||||
/**
|
||||
* Behavior modifier for label offset and distance, only applies in some
|
||||
* label placement modes.
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::OffsetType
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class LabelOffsetType SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, OffsetType ) : int
|
||||
{
|
||||
FromPoint, //!< Offset distance applies from point geometry
|
||||
FromSymbolBounds, //!< Offset distance applies from rendered symbol bounds
|
||||
};
|
||||
Q_ENUM( LabelOffsetType )
|
||||
|
||||
/**
|
||||
* Label quadrant positions
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::QuadrantPosition
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class LabelQuadrantPosition SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, QuadrantPosition ) : int
|
||||
{
|
||||
AboveLeft SIP_MONKEYPATCH_COMPAT_NAME( QuadrantAboveLeft ), //!< Above left
|
||||
Above SIP_MONKEYPATCH_COMPAT_NAME( QuadrantAbove ), //!< Above center
|
||||
AboveRight SIP_MONKEYPATCH_COMPAT_NAME( QuadrantAboveRight ), //!< Above right
|
||||
Left SIP_MONKEYPATCH_COMPAT_NAME( QuadrantLeft ), //!< Left middle
|
||||
Over SIP_MONKEYPATCH_COMPAT_NAME( QuadrantOver ), //!< Center middle
|
||||
Right SIP_MONKEYPATCH_COMPAT_NAME( QuadrantRight ), //!< Right middle
|
||||
BelowLeft SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelowLeft ), //!< Below left
|
||||
Below SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelow ), //!< Below center
|
||||
BelowRight SIP_MONKEYPATCH_COMPAT_NAME( QuadrantBelowRight ), //!< BelowRight
|
||||
};
|
||||
Q_ENUM( LabelQuadrantPosition )
|
||||
|
||||
/**
|
||||
* Handling techniques for upside down labels.
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::UpsideDownLabels
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class UpsideDownLabelHandling SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, UpsideDownLabels ) : int
|
||||
{
|
||||
FlipUpsideDownLabels SIP_MONKEYPATCH_COMPAT_NAME( Upright ), //!< Upside-down labels (90 <= angle < 270) are shown upright
|
||||
AllowUpsideDownWhenRotationIsDefined SIP_MONKEYPATCH_COMPAT_NAME( ShowDefined ), //!< Show upside down when rotation is layer- or data-defined
|
||||
AlwaysAllowUpsideDown SIP_MONKEYPATCH_COMPAT_NAME( ShowAll ) //!< Show upside down for all labels, including dynamic ones
|
||||
};
|
||||
Q_ENUM( UpsideDownLabelHandling )
|
||||
|
||||
/**
|
||||
* Text alignment for multi-line labels.
|
||||
*
|
||||
* \note Prior to QGIS 3.26 this was available as QgsPalLayerSettings::MultiLineAlign
|
||||
*
|
||||
* \since QGIS 3.26
|
||||
*/
|
||||
enum class LabelMultiLineAlignment SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsPalLayerSettings, MultiLineAlign ) : int
|
||||
{
|
||||
Left SIP_MONKEYPATCH_COMPAT_NAME( MultiLeft ) = 0, //!< Left align
|
||||
Center SIP_MONKEYPATCH_COMPAT_NAME( MultiCenter ), //!< Center align
|
||||
Right SIP_MONKEYPATCH_COMPAT_NAME( MultiRight ), //!< Right align
|
||||
FollowPlacement SIP_MONKEYPATCH_COMPAT_NAME( MultiFollowPlacement ), //!< Alignment follows placement of label, e.g., labels to the left of a feature will be drawn with right alignment
|
||||
Justify SIP_MONKEYPATCH_COMPAT_NAME( MultiJustify ), //!< Justified
|
||||
};
|
||||
Q_ENUM( LabelMultiLineAlignment )
|
||||
|
||||
/**
|
||||
* Flags which control how data providers will scan for sublayers in a dataset.
|
||||
*
|
||||
|
||||
@ -4984,10 +4984,10 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
|
||||
QDomElement pointPlacementElem = labelPlacementElem.firstChildElement( QStringLiteral( "PointPlacement" ) );
|
||||
if ( !pointPlacementElem.isNull() )
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
if ( geometryType() == QgsWkbTypes::LineGeometry )
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::Horizontal;
|
||||
settings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
}
|
||||
|
||||
QDomElement displacementElem = pointPlacementElem.firstChildElement( QStringLiteral( "Displacement" ) );
|
||||
@ -5060,7 +5060,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
|
||||
QDomElement linePlacementElem = labelPlacementElem.firstChildElement( QStringLiteral( "LinePlacement" ) );
|
||||
if ( !linePlacementElem.isNull() )
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5113,17 +5113,17 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
|
||||
}
|
||||
else if ( it.key() == QLatin1String( "maxDisplacement" ) )
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
}
|
||||
else if ( it.key() == QLatin1String( "followLine" ) && it.value() == QLatin1String( "true" ) )
|
||||
{
|
||||
if ( geometryType() == QgsWkbTypes::PolygonGeometry )
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::PerimeterCurved;
|
||||
settings.placement = Qgis::LabelPlacement::PerimeterCurved;
|
||||
}
|
||||
else
|
||||
{
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
}
|
||||
}
|
||||
else if ( it.key() == QLatin1String( "maxAngleDelta" ) )
|
||||
@ -5143,7 +5143,7 @@ bool QgsVectorLayer::readSldTextSymbolizer( const QDomNode &node, QgsPalLayerSet
|
||||
}
|
||||
else if ( it.key() == QLatin1String( "forceLeftToRight" ) && it.value() == QLatin1String( "false" ) )
|
||||
{
|
||||
settings.upsidedownLabels = QgsPalLayerSettings::ShowAll;
|
||||
settings.upsidedownLabels = Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown;
|
||||
}
|
||||
else if ( it.key() == QLatin1String( "group" ) && it.value() == QLatin1String( "yes" ) )
|
||||
{
|
||||
|
||||
@ -48,7 +48,7 @@ void QgsVectorLayerDiagramProvider::init()
|
||||
{
|
||||
mName = mLayerId;
|
||||
mPriority = 1 - mSettings.priority() / 10.0; // convert 0..10 --> 1..0
|
||||
mPlacement = QgsPalLayerSettings::Placement( mSettings.placement() );
|
||||
mPlacement = static_cast< Qgis::LabelPlacement >( mSettings.placement() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1523,14 +1523,14 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
|
||||
labelSettings.isExpression = true;
|
||||
}
|
||||
|
||||
labelSettings.placement = QgsPalLayerSettings::OverPoint;
|
||||
labelSettings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::PointGeometry;
|
||||
if ( jsonLayout.contains( QStringLiteral( "symbol-placement" ) ) )
|
||||
{
|
||||
const QString symbolPlacement = jsonLayout.value( QStringLiteral( "symbol-placement" ) ).toString();
|
||||
if ( symbolPlacement == QLatin1String( "line" ) )
|
||||
{
|
||||
labelSettings.placement = QgsPalLayerSettings::Curved;
|
||||
labelSettings.placement = Qgis::LabelPlacement::Curved;
|
||||
labelSettings.lineSettings().setPlacementFlags( QgsLabeling::OnLine );
|
||||
geometryType = QgsWkbTypes::LineGeometry;
|
||||
|
||||
@ -1539,11 +1539,11 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
|
||||
const QString textRotationAlignment = jsonLayout.value( QStringLiteral( "text-rotation-alignment" ) ).toString();
|
||||
if ( textRotationAlignment == QLatin1String( "viewport" ) )
|
||||
{
|
||||
labelSettings.placement = QgsPalLayerSettings::Horizontal;
|
||||
labelSettings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
}
|
||||
}
|
||||
|
||||
if ( labelSettings.placement == QgsPalLayerSettings::Curved )
|
||||
if ( labelSettings.placement == Qgis::LabelPlacement::Curved )
|
||||
{
|
||||
QPointF textOffset;
|
||||
QgsProperty textOffsetProperty;
|
||||
@ -1633,20 +1633,20 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
|
||||
}
|
||||
|
||||
if ( textAlign == QLatin1String( "left" ) )
|
||||
labelSettings.multilineAlign = QgsPalLayerSettings::MultiLeft;
|
||||
labelSettings.multilineAlign = Qgis::LabelMultiLineAlignment::Left;
|
||||
else if ( textAlign == QLatin1String( "right" ) )
|
||||
labelSettings.multilineAlign = QgsPalLayerSettings::MultiRight;
|
||||
labelSettings.multilineAlign = Qgis::LabelMultiLineAlignment::Right;
|
||||
else if ( textAlign == QLatin1String( "center" ) )
|
||||
labelSettings.multilineAlign = QgsPalLayerSettings::MultiCenter;
|
||||
labelSettings.multilineAlign = Qgis::LabelMultiLineAlignment::Center;
|
||||
else if ( textAlign == QLatin1String( "follow" ) )
|
||||
labelSettings.multilineAlign = QgsPalLayerSettings::MultiFollowPlacement;
|
||||
labelSettings.multilineAlign = Qgis::LabelMultiLineAlignment::FollowPlacement;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelSettings.multilineAlign = QgsPalLayerSettings::MultiCenter;
|
||||
labelSettings.multilineAlign = Qgis::LabelMultiLineAlignment::Center;
|
||||
}
|
||||
|
||||
if ( labelSettings.placement == QgsPalLayerSettings::OverPoint )
|
||||
if ( labelSettings.placement == Qgis::LabelPlacement::OverPoint )
|
||||
{
|
||||
if ( jsonLayout.contains( QStringLiteral( "text-anchor" ) ) )
|
||||
{
|
||||
@ -1686,23 +1686,23 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
|
||||
}
|
||||
|
||||
if ( textAnchor == QLatin1String( "center" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantOver;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
else if ( textAnchor == QLatin1String( "left" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantRight;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::Right;
|
||||
else if ( textAnchor == QLatin1String( "right" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantLeft;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::Left;
|
||||
else if ( textAnchor == QLatin1String( "top" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantBelow;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::Below;
|
||||
else if ( textAnchor == QLatin1String( "bottom" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantAbove;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::Above;
|
||||
else if ( textAnchor == QLatin1String( "top-left" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantBelowRight;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::BelowRight;
|
||||
else if ( textAnchor == QLatin1String( "top-right" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantBelowLeft;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::BelowLeft;
|
||||
else if ( textAnchor == QLatin1String( "bottom-left" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantAboveRight;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::AboveRight;
|
||||
else if ( textAnchor == QLatin1String( "bottom-right" ) )
|
||||
labelSettings.quadOffset = QgsPalLayerSettings::QuadrantAboveLeft;
|
||||
labelSettings.quadOffset = Qgis::LabelQuadrantPosition::AboveLeft;
|
||||
}
|
||||
|
||||
QPointF textOffset;
|
||||
@ -1738,7 +1738,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
|
||||
}
|
||||
|
||||
if ( jsonLayout.contains( QStringLiteral( "icon-image" ) ) &&
|
||||
( labelSettings.placement == QgsPalLayerSettings::Horizontal || labelSettings.placement == QgsPalLayerSettings::Curved ) )
|
||||
( labelSettings.placement == Qgis::LabelPlacement::Horizontal || labelSettings.placement == Qgis::LabelPlacement::Curved ) )
|
||||
{
|
||||
QSize spriteSize;
|
||||
QString spriteProperty, spriteSizeProperty;
|
||||
|
||||
@ -241,10 +241,10 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer *layer, QgsMapCanvas *mapCanvas,
|
||||
initCalloutWidgets();
|
||||
} );
|
||||
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Left" ), QgsPalLayerSettings::MultiLeft );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Center" ), QgsPalLayerSettings::MultiCenter );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Right" ), QgsPalLayerSettings::MultiRight );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Justify" ), QgsPalLayerSettings::MultiJustify );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Left" ), static_cast< int >( Qgis::LabelMultiLineAlignment::Left ) );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Center" ), static_cast< int >( Qgis::LabelMultiLineAlignment::Center ) );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Right" ), static_cast< int >( Qgis::LabelMultiLineAlignment::Right ) );
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Justify" ), static_cast< int >( Qgis::LabelMultiLineAlignment::Justify ) );
|
||||
|
||||
mCoordRotationUnitComboBox->addItem( QgsUnitTypes::toString( QgsUnitTypes::AngleDegrees ), QgsUnitTypes::AngleDegrees );
|
||||
mCoordRotationUnitComboBox->addItem( QgsUnitTypes::toString( QgsUnitTypes::AngleRadians ), QgsUnitTypes::AngleRadians );
|
||||
@ -358,7 +358,7 @@ void QgsLabelingGui::setLayer( QgsMapLayer *mapLayer )
|
||||
mLineDistanceSpnBx->setValue( mSettings.dist );
|
||||
mLineDistanceUnitWidget->setUnit( mSettings.distUnits );
|
||||
mLineDistanceUnitWidget->setMapUnitScale( mSettings.distMapUnitScale );
|
||||
mOffsetTypeComboBox->setCurrentIndex( mOffsetTypeComboBox->findData( mSettings.offsetType ) );
|
||||
mOffsetTypeComboBox->setCurrentIndex( mOffsetTypeComboBox->findData( static_cast< int >( mSettings.offsetType ) ) );
|
||||
mQuadrantBtnGrp->button( static_cast<int>( mSettings.quadOffset ) )->setChecked( true );
|
||||
mPointOffsetXSpinBox->setValue( mSettings.xOffset );
|
||||
mPointOffsetYSpinBox->setValue( mSettings.yOffset );
|
||||
@ -372,7 +372,7 @@ void QgsLabelingGui::setLayer( QgsMapLayer *mapLayer )
|
||||
|
||||
mCheckAllowLabelsOutsidePolygons->setChecked( mSettings.polygonPlacementFlags() & QgsLabeling::PolygonPlacementFlag::AllowPlacementOutsideOfPolygon );
|
||||
|
||||
const int placementIndex = mPlacementModeComboBox->findData( mSettings.placement );
|
||||
const int placementIndex = mPlacementModeComboBox->findData( static_cast< int >( mSettings.placement ) );
|
||||
if ( placementIndex >= 0 )
|
||||
{
|
||||
mPlacementModeComboBox->setCurrentIndex( placementIndex );
|
||||
@ -426,9 +426,9 @@ void QgsLabelingGui::setLayer( QgsMapLayer *mapLayer )
|
||||
mAutoWrapLengthSpinBox->setValue( mSettings.autoWrapLength );
|
||||
mAutoWrapTypeComboBox->setCurrentIndex( mSettings.useMaxLineLengthForAutoWrap ? 0 : 1 );
|
||||
|
||||
if ( mFontMultiLineAlignComboBox->findData( mSettings.multilineAlign ) != -1 )
|
||||
if ( mFontMultiLineAlignComboBox->findData( static_cast< int >( mSettings.multilineAlign ) ) != -1 )
|
||||
{
|
||||
mFontMultiLineAlignComboBox->setCurrentIndex( mFontMultiLineAlignComboBox->findData( mSettings.multilineAlign ) );
|
||||
mFontMultiLineAlignComboBox->setCurrentIndex( mFontMultiLineAlignComboBox->findData( static_cast< int >( mSettings.multilineAlign ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -536,10 +536,10 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.dist = mLineDistanceSpnBx->value();
|
||||
lyr.distUnits = mLineDistanceUnitWidget->unit();
|
||||
lyr.distMapUnitScale = mLineDistanceUnitWidget->getMapUnitScale();
|
||||
lyr.offsetType = static_cast< QgsPalLayerSettings::OffsetType >( mOffsetTypeComboBox->currentData().toInt() );
|
||||
lyr.offsetType = static_cast< Qgis::LabelOffsetType >( mOffsetTypeComboBox->currentData().toInt() );
|
||||
if ( mQuadrantBtnGrp )
|
||||
{
|
||||
lyr.quadOffset = static_cast< QgsPalLayerSettings::QuadrantPosition >( mQuadrantBtnGrp->checkedId() );
|
||||
lyr.quadOffset = static_cast< Qgis::LabelQuadrantPosition >( mQuadrantBtnGrp->checkedId() );
|
||||
}
|
||||
lyr.xOffset = mPointOffsetXSpinBox->value();
|
||||
lyr.yOffset = mPointOffsetYSpinBox->value();
|
||||
@ -558,7 +558,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
linePlacementFlags |= QgsLabeling::LinePlacementFlag::MapOrientation;
|
||||
lyr.lineSettings().setPlacementFlags( linePlacementFlags );
|
||||
|
||||
lyr.placement = static_cast< QgsPalLayerSettings::Placement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
lyr.placement = static_cast< Qgis::LabelPlacement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
|
||||
lyr.repeatDistance = mRepeatDistanceSpinBox->value();
|
||||
lyr.repeatDistanceUnit = mRepeatDistanceUnitWidget->unit();
|
||||
@ -608,7 +608,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
}
|
||||
if ( mUpsidedownBtnGrp )
|
||||
{
|
||||
lyr.upsidedownLabels = static_cast< QgsPalLayerSettings::UpsideDownLabels >( mUpsidedownBtnGrp->checkedId() );
|
||||
lyr.upsidedownLabels = static_cast< Qgis::UpsideDownLabelHandling >( mUpsidedownBtnGrp->checkedId() );
|
||||
}
|
||||
|
||||
lyr.maxCurvedCharAngleIn = mMaxCharAngleInDSpinBox->value();
|
||||
@ -625,7 +625,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.wrapChar = wrapCharacterEdit->text();
|
||||
lyr.autoWrapLength = mAutoWrapLengthSpinBox->value();
|
||||
lyr.useMaxLineLengthForAutoWrap = mAutoWrapTypeComboBox->currentIndex() == 0;
|
||||
lyr.multilineAlign = static_cast< QgsPalLayerSettings::MultiLineAlign >( mFontMultiLineAlignComboBox->currentData().toInt() );
|
||||
lyr.multilineAlign = static_cast< Qgis::LabelMultiLineAlignment >( mFontMultiLineAlignComboBox->currentData().toInt() );
|
||||
lyr.preserveRotation = chkPreserveRotation->isChecked();
|
||||
lyr.setRotationUnit( static_cast< QgsUnitTypes::AngleUnit >( mCoordRotationUnitComboBox->currentData().toInt() ) );
|
||||
lyr.geometryGenerator = mGeometryGenerator->text();
|
||||
@ -842,31 +842,31 @@ void QgsLabelingGui::updateGeometryTypeBasedWidgets()
|
||||
mPolygonFeatureOptionsFrame->setVisible( geometryType == QgsWkbTypes::PolygonGeometry );
|
||||
|
||||
|
||||
const QgsPalLayerSettings::Placement prevPlacement = static_cast< QgsPalLayerSettings::Placement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
const Qgis::LabelPlacement prevPlacement = static_cast< Qgis::LabelPlacement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
mPlacementModeComboBox->clear();
|
||||
|
||||
switch ( geometryType )
|
||||
{
|
||||
case QgsWkbTypes::PointGeometry:
|
||||
mPlacementModeComboBox->addItem( tr( "Cartographic" ), QgsPalLayerSettings::OrderedPositionsAroundPoint );
|
||||
mPlacementModeComboBox->addItem( tr( "Around Point" ), QgsPalLayerSettings::AroundPoint );
|
||||
mPlacementModeComboBox->addItem( tr( "Offset from Point" ), QgsPalLayerSettings::OverPoint );
|
||||
mPlacementModeComboBox->addItem( tr( "Cartographic" ), static_cast< int >( Qgis::LabelPlacement::OrderedPositionsAroundPoint ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Around Point" ), static_cast< int >( Qgis::LabelPlacement::AroundPoint ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Offset from Point" ), static_cast< int >( Qgis::LabelPlacement::OverPoint ) );
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::LineGeometry:
|
||||
mPlacementModeComboBox->addItem( tr( "Parallel" ), QgsPalLayerSettings::Line );
|
||||
mPlacementModeComboBox->addItem( tr( "Curved" ), QgsPalLayerSettings::Curved );
|
||||
mPlacementModeComboBox->addItem( tr( "Horizontal" ), QgsPalLayerSettings::Horizontal );
|
||||
mPlacementModeComboBox->addItem( tr( "Parallel" ), static_cast< int >( Qgis::LabelPlacement::Line ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Curved" ), static_cast< int >( Qgis::LabelPlacement::Curved ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Horizontal" ), static_cast< int >( Qgis::LabelPlacement::Horizontal ) );
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::PolygonGeometry:
|
||||
mPlacementModeComboBox->addItem( tr( "Offset from Centroid" ), QgsPalLayerSettings::OverPoint );
|
||||
mPlacementModeComboBox->addItem( tr( "Around Centroid" ), QgsPalLayerSettings::AroundPoint );
|
||||
mPlacementModeComboBox->addItem( tr( "Horizontal" ), QgsPalLayerSettings::Horizontal );
|
||||
mPlacementModeComboBox->addItem( tr( "Free (Angled)" ), QgsPalLayerSettings::Free );
|
||||
mPlacementModeComboBox->addItem( tr( "Using Perimeter" ), QgsPalLayerSettings::Line );
|
||||
mPlacementModeComboBox->addItem( tr( "Using Perimeter (Curved)" ), QgsPalLayerSettings::PerimeterCurved );
|
||||
mPlacementModeComboBox->addItem( tr( "Outside Polygons" ), QgsPalLayerSettings::OutsidePolygons );
|
||||
mPlacementModeComboBox->addItem( tr( "Offset from Centroid" ), static_cast< int >( Qgis::LabelPlacement::OverPoint ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Around Centroid" ), static_cast< int >( Qgis::LabelPlacement::AroundPoint ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Horizontal" ), static_cast< int >( Qgis::LabelPlacement::Horizontal ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Free (Angled)" ), static_cast< int >( Qgis::LabelPlacement::Free ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Using Perimeter" ), static_cast< int >( Qgis::LabelPlacement::Line ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Using Perimeter (Curved)" ), static_cast< int >( Qgis::LabelPlacement::PerimeterCurved ) );
|
||||
mPlacementModeComboBox->addItem( tr( "Outside Polygons" ), static_cast< int >( Qgis::LabelPlacement::OutsidePolygons ) );
|
||||
break;
|
||||
|
||||
case QgsWkbTypes::NullGeometry:
|
||||
@ -875,20 +875,20 @@ void QgsLabelingGui::updateGeometryTypeBasedWidgets()
|
||||
qFatal( "unknown geometry type unexpected" );
|
||||
}
|
||||
|
||||
if ( mPlacementModeComboBox->findData( prevPlacement ) != -1 )
|
||||
if ( mPlacementModeComboBox->findData( static_cast< int >( prevPlacement ) ) != -1 )
|
||||
{
|
||||
mPlacementModeComboBox->setCurrentIndex( mPlacementModeComboBox->findData( prevPlacement ) );
|
||||
mPlacementModeComboBox->setCurrentIndex( mPlacementModeComboBox->findData( static_cast< int >( prevPlacement ) ) );
|
||||
}
|
||||
|
||||
if ( geometryType == QgsWkbTypes::PointGeometry || geometryType == QgsWkbTypes::PolygonGeometry )
|
||||
{
|
||||
// follow placement alignment is only valid for point or polygon layers
|
||||
if ( mFontMultiLineAlignComboBox->findData( QgsPalLayerSettings::MultiFollowPlacement ) == -1 )
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Follow Label Placement" ), QgsPalLayerSettings::MultiFollowPlacement );
|
||||
if ( mFontMultiLineAlignComboBox->findData( static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) ) == -1 )
|
||||
mFontMultiLineAlignComboBox->addItem( tr( "Follow Label Placement" ), static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
const int idx = mFontMultiLineAlignComboBox->findData( QgsPalLayerSettings::MultiFollowPlacement );
|
||||
const int idx = mFontMultiLineAlignComboBox->findData( static_cast< int >( Qgis::LabelMultiLineAlignment::FollowPlacement ) );
|
||||
if ( idx >= 0 )
|
||||
mFontMultiLineAlignComboBox->removeItem( idx );
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ void QgsTextFormatWidget::initWidget()
|
||||
mLineDistanceSpnBx->setClearValue( 0.0 );
|
||||
mSpinStretch->setClearValue( 100 );
|
||||
|
||||
mOffsetTypeComboBox->addItem( tr( "From Point" ), QgsPalLayerSettings::FromPoint );
|
||||
mOffsetTypeComboBox->addItem( tr( "From Symbol Bounds" ), QgsPalLayerSettings::FromSymbolBounds );
|
||||
mOffsetTypeComboBox->addItem( tr( "From Point" ), static_cast< int >( Qgis::LabelOffsetType::FromPoint ) );
|
||||
mOffsetTypeComboBox->addItem( tr( "From Symbol Bounds" ), static_cast< int >( Qgis::LabelOffsetType::FromSymbolBounds ) );
|
||||
|
||||
mShapeTypeCmbBx->addItem( tr( "Rectangle" ), QgsTextBackgroundSettings::ShapeRectangle );
|
||||
mShapeTypeCmbBx->addItem( tr( "Square" ), QgsTextBackgroundSettings::ShapeSquare );
|
||||
@ -257,15 +257,15 @@ void QgsTextFormatWidget::initWidget()
|
||||
|
||||
// set up quadrant offset button group
|
||||
mQuadrantBtnGrp = new QButtonGroup( this );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAboveLeft, static_cast<int>( QgsPalLayerSettings::QuadrantAboveLeft ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAbove, static_cast<int>( QgsPalLayerSettings::QuadrantAbove ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAboveRight, static_cast<int>( QgsPalLayerSettings::QuadrantAboveRight ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetLeft, static_cast<int>( QgsPalLayerSettings::QuadrantLeft ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetOver, static_cast<int>( QgsPalLayerSettings::QuadrantOver ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetRight, static_cast<int>( QgsPalLayerSettings::QuadrantRight ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelowLeft, static_cast<int>( QgsPalLayerSettings::QuadrantBelowLeft ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelow, static_cast<int>( QgsPalLayerSettings::QuadrantBelow ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelowRight, static_cast<int>( QgsPalLayerSettings::QuadrantBelowRight ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAboveLeft, static_cast<int>( Qgis::LabelQuadrantPosition::AboveLeft ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAbove, static_cast<int>( Qgis::LabelQuadrantPosition::Above ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetAboveRight, static_cast<int>( Qgis::LabelQuadrantPosition::AboveRight ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetLeft, static_cast<int>( Qgis::LabelQuadrantPosition::Left ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetOver, static_cast<int>( Qgis::LabelQuadrantPosition::Over ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetRight, static_cast<int>( Qgis::LabelQuadrantPosition::Right ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelowLeft, static_cast<int>( Qgis::LabelQuadrantPosition::BelowLeft ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelow, static_cast<int>( Qgis::LabelQuadrantPosition::Below ) );
|
||||
mQuadrantBtnGrp->addButton( mPointOffsetBelowRight, static_cast<int>( Qgis::LabelQuadrantPosition::BelowRight ) );
|
||||
mQuadrantBtnGrp->setExclusive( true );
|
||||
|
||||
// setup direction symbol(s) button group
|
||||
@ -277,9 +277,9 @@ void QgsTextFormatWidget::initWidget()
|
||||
|
||||
// upside-down labels button group
|
||||
mUpsidedownBtnGrp = new QButtonGroup( this );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioOff, static_cast<int>( QgsPalLayerSettings::Upright ) );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioDefined, static_cast<int>( QgsPalLayerSettings::ShowDefined ) );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioAll, static_cast<int>( QgsPalLayerSettings::ShowAll ) );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioOff, static_cast<int>( Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels ) );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioDefined, static_cast<int>( Qgis::UpsideDownLabelHandling::AllowUpsideDownWhenRotationIsDefined ) );
|
||||
mUpsidedownBtnGrp->addButton( mUpsidedownRadioAll, static_cast<int>( Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown ) );
|
||||
mUpsidedownBtnGrp->setExclusive( true );
|
||||
|
||||
//mShapeCollisionsChkBx->setVisible( false ); // until implemented
|
||||
@ -1326,12 +1326,12 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
bool showRotationFrame = false;
|
||||
bool showMaxCharAngleFrame = false;
|
||||
|
||||
const QgsPalLayerSettings::Placement currentPlacement = static_cast< QgsPalLayerSettings::Placement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
const bool showPolygonPlacementOptions = ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement != QgsPalLayerSettings::Line && currentPlacement != QgsPalLayerSettings::PerimeterCurved && currentPlacement != QgsPalLayerSettings::OutsidePolygons );
|
||||
const Qgis::LabelPlacement currentPlacement = static_cast< Qgis::LabelPlacement >( mPlacementModeComboBox->currentData().toInt() );
|
||||
const bool showPolygonPlacementOptions = ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement != Qgis::LabelPlacement::Line && currentPlacement != Qgis::LabelPlacement::PerimeterCurved && currentPlacement != Qgis::LabelPlacement::OutsidePolygons );
|
||||
|
||||
bool enableMultiLinesFrame = true;
|
||||
|
||||
if ( currentPlacement == QgsPalLayerSettings::AroundPoint
|
||||
if ( currentPlacement == Qgis::LabelPlacement::AroundPoint
|
||||
&& ( currentGeometryType == QgsWkbTypes::PointGeometry || currentGeometryType == QgsWkbTypes::PolygonGeometry ) )
|
||||
{
|
||||
showCentroidFrame = currentGeometryType == QgsWkbTypes::PolygonGeometry;
|
||||
@ -1339,7 +1339,7 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
//showRotationFrame = true; // TODO: uncomment when supported
|
||||
showQuadrantFrame = currentGeometryType == QgsWkbTypes::PointGeometry;
|
||||
}
|
||||
else if ( currentPlacement == QgsPalLayerSettings::OverPoint
|
||||
else if ( currentPlacement == Qgis::LabelPlacement::OverPoint
|
||||
&& ( currentGeometryType == QgsWkbTypes::PointGeometry || currentGeometryType == QgsWkbTypes::PolygonGeometry ) )
|
||||
{
|
||||
showCentroidFrame = currentGeometryType == QgsWkbTypes::PolygonGeometry;
|
||||
@ -1348,16 +1348,16 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
showOffsetFrame = true;
|
||||
showRotationFrame = true;
|
||||
}
|
||||
else if ( currentGeometryType == QgsWkbTypes::PointGeometry && currentPlacement == QgsPalLayerSettings::OrderedPositionsAroundPoint )
|
||||
else if ( currentGeometryType == QgsWkbTypes::PointGeometry && currentPlacement == Qgis::LabelPlacement::OrderedPositionsAroundPoint )
|
||||
{
|
||||
showDistanceFrame = true;
|
||||
showPlacementPriorityFrame = true;
|
||||
showOffsetTypeFrame = true;
|
||||
}
|
||||
else if ( ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == QgsPalLayerSettings::Line )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == QgsPalLayerSettings::Line )
|
||||
|| ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == QgsPalLayerSettings::Curved )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == QgsPalLayerSettings::PerimeterCurved ) )
|
||||
else if ( ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == Qgis::LabelPlacement::Line )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == Qgis::LabelPlacement::Line )
|
||||
|| ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == Qgis::LabelPlacement::Curved )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == Qgis::LabelPlacement::PerimeterCurved ) )
|
||||
{
|
||||
showLineFrame = true;
|
||||
showDistanceFrame = true;
|
||||
@ -1367,14 +1367,14 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
chkLineOrientationDependent->setEnabled( offline );
|
||||
mPlacementDistanceFrame->setEnabled( offline );
|
||||
|
||||
const bool isCurved = ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == QgsPalLayerSettings::Curved )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == QgsPalLayerSettings::PerimeterCurved );
|
||||
const bool isCurved = ( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement == Qgis::LabelPlacement::Curved )
|
||||
|| ( currentGeometryType == QgsWkbTypes::PolygonGeometry && currentPlacement == Qgis::LabelPlacement::PerimeterCurved );
|
||||
showMaxCharAngleFrame = isCurved;
|
||||
// TODO: enable mMultiLinesFrame when supported for curved labels
|
||||
enableMultiLinesFrame = !isCurved;
|
||||
}
|
||||
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry
|
||||
&& ( currentPlacement == QgsPalLayerSettings::OutsidePolygons || mCheckAllowLabelsOutsidePolygons->isChecked() || mAllowOutsidePolygonsDDBtn->isActive() ) )
|
||||
&& ( currentPlacement == Qgis::LabelPlacement::OutsidePolygons || mCheckAllowLabelsOutsidePolygons->isChecked() || mAllowOutsidePolygonsDDBtn->isActive() ) )
|
||||
{
|
||||
showDistanceFrame = true;
|
||||
}
|
||||
@ -1390,8 +1390,8 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
mPlacementOffsetTypeFrame->setVisible( showOffsetTypeFrame );
|
||||
mPlacementRotationFrame->setVisible( showRotationFrame );
|
||||
mPlacementRepeatGroupBox->setVisible( currentGeometryType == QgsWkbTypes::LineGeometry || ( currentGeometryType == QgsWkbTypes::PolygonGeometry &&
|
||||
( currentPlacement == QgsPalLayerSettings::Line || currentPlacement == QgsPalLayerSettings::PerimeterCurved ) ) );
|
||||
mPlacementOverrunGroupBox->setVisible( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement != QgsPalLayerSettings::Horizontal );
|
||||
( currentPlacement == Qgis::LabelPlacement::Line || currentPlacement == Qgis::LabelPlacement::PerimeterCurved ) ) );
|
||||
mPlacementOverrunGroupBox->setVisible( currentGeometryType == QgsWkbTypes::LineGeometry && currentPlacement != Qgis::LabelPlacement::Horizontal );
|
||||
mLineAnchorGroupBox->setVisible( currentGeometryType == QgsWkbTypes::LineGeometry );
|
||||
mPlacementMaxCharAngleFrame->setVisible( showMaxCharAngleFrame );
|
||||
|
||||
@ -1401,47 +1401,47 @@ void QgsTextFormatWidget::updatePlacementWidgets()
|
||||
QString helperText;
|
||||
switch ( currentPlacement )
|
||||
{
|
||||
case QgsPalLayerSettings::AroundPoint:
|
||||
case Qgis::LabelPlacement::AroundPoint:
|
||||
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
|
||||
helperText = tr( "Arranges label candidates in a clockwise circle around the feature, preferring placements to the top-right of the feature." );
|
||||
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges label candidates in a cluster around the feature's centroid, preferring placements directly over the centroid." );
|
||||
break;
|
||||
case QgsPalLayerSettings::OverPoint:
|
||||
case Qgis::LabelPlacement::OverPoint:
|
||||
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
|
||||
helperText = tr( "Arranges label candidates directly over the feature or at a preset offset from the feature." );
|
||||
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges label candidates directly over the feature's centroid, or at a preset offset from the centroid." );
|
||||
break;
|
||||
case QgsPalLayerSettings::Line:
|
||||
case Qgis::LabelPlacement::Line:
|
||||
if ( currentGeometryType == QgsWkbTypes::LineGeometry )
|
||||
helperText = tr( "Arranges label candidates parallel to a generalised line representing the feature. Placements which fall over straighter portions of the line are preferred." );
|
||||
else if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges label candidates parallel to a generalised line representing the polygon's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
|
||||
break;
|
||||
case QgsPalLayerSettings::Curved:
|
||||
case Qgis::LabelPlacement::Curved:
|
||||
if ( currentGeometryType == QgsWkbTypes::LineGeometry )
|
||||
helperText = tr( "Arranges candidates following the curvature of a line feature. Placements which fall over straighter portions of the line are preferred." );
|
||||
break;
|
||||
case QgsPalLayerSettings::Horizontal:
|
||||
case Qgis::LabelPlacement::Horizontal:
|
||||
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges label candidates scattered throughout the polygon. Labels will always be placed horizontally, with placements further from the edges of the polygon preferred." );
|
||||
else if ( currentGeometryType == QgsWkbTypes::LineGeometry )
|
||||
helperText = tr( "Label candidates are arranged horizontally along the length of the feature." );
|
||||
break;
|
||||
case QgsPalLayerSettings::Free:
|
||||
case Qgis::LabelPlacement::Free:
|
||||
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges label candidates scattered throughout the polygon. Labels are rotated to respect the polygon's orientation, with placements further from the edges of the polygon preferred." );
|
||||
break;
|
||||
case QgsPalLayerSettings::OrderedPositionsAroundPoint:
|
||||
case Qgis::LabelPlacement::OrderedPositionsAroundPoint:
|
||||
if ( currentGeometryType == QgsWkbTypes::PointGeometry )
|
||||
helperText = tr( "Label candidates are placed in predefined positions around the features. Preference is given to positions with greatest cartographic appeal, e.g., top right and bottom right of the feature." );
|
||||
break;
|
||||
case QgsPalLayerSettings::PerimeterCurved:
|
||||
case Qgis::LabelPlacement::PerimeterCurved:
|
||||
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Arranges candidates following the curvature of the feature's perimeter. Placements which fall over straighter portions of the perimeter are preferred." );
|
||||
break;
|
||||
case QgsPalLayerSettings::OutsidePolygons:
|
||||
case Qgis::LabelPlacement::OutsidePolygons:
|
||||
if ( currentGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
helperText = tr( "Label candidates are placed outside of the features, preferring placements which give greatest visual association between the label and the feature." );
|
||||
break;
|
||||
|
||||
@ -2940,14 +2940,14 @@ namespace QgsWms
|
||||
palSettings.dataDefinedProperties().setProperty( pR, param.mLabelRotation );
|
||||
}
|
||||
|
||||
QgsPalLayerSettings::Placement placement = QgsPalLayerSettings::AroundPoint;
|
||||
Qgis::LabelPlacement placement = Qgis::LabelPlacement::AroundPoint;
|
||||
switch ( param.mGeom.type() )
|
||||
{
|
||||
case QgsWkbTypes::PointGeometry:
|
||||
{
|
||||
if ( param.mHali.isEmpty() || param.mVali.isEmpty() || QgsWkbTypes::flatType( param.mGeom.wkbType() ) != QgsWkbTypes::Point )
|
||||
{
|
||||
placement = QgsPalLayerSettings::AroundPoint;
|
||||
placement = Qgis::LabelPlacement::AroundPoint;
|
||||
palSettings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlags() );
|
||||
}
|
||||
else //set label directly on point if there is hali/vali
|
||||
@ -2971,7 +2971,7 @@ namespace QgsWms
|
||||
{
|
||||
QgsGeometry point = param.mGeom.pointOnSurface();
|
||||
QgsPointXY pt = point.asPoint();
|
||||
placement = QgsPalLayerSettings::AroundPoint;
|
||||
placement = Qgis::LabelPlacement::AroundPoint;
|
||||
|
||||
QgsPalLayerSettings::Property pX = QgsPalLayerSettings::PositionX;
|
||||
QVariant x( pt.x() );
|
||||
@ -2992,7 +2992,7 @@ namespace QgsWms
|
||||
}
|
||||
default:
|
||||
{
|
||||
placement = QgsPalLayerSettings::Line;
|
||||
placement = Qgis::LabelPlacement::Line;
|
||||
palSettings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -112,8 +112,8 @@ class TestQgsMapToolLabel : public QObject
|
||||
// add some labels
|
||||
QgsPalLayerSettings pls1;
|
||||
pls1.fieldName = QStringLiteral( "text" );
|
||||
pls1.placement = QgsPalLayerSettings::OverPoint;
|
||||
pls1.quadOffset = QgsPalLayerSettings::QuadrantOver;
|
||||
pls1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
pls1.quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
pls1.placementSettings().setAllowDegradedPlacement( true );
|
||||
pls1.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -269,8 +269,8 @@ class TestQgsMapToolLabel : public QObject
|
||||
QgsPalLayerSettings pls1;
|
||||
pls1.fieldName = QStringLiteral( "'label'" );
|
||||
pls1.isExpression = true;
|
||||
pls1.placement = QgsPalLayerSettings::OverPoint;
|
||||
pls1.quadOffset = QgsPalLayerSettings::QuadrantOver;
|
||||
pls1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
pls1.quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
pls1.placementSettings().setAllowDegradedPlacement( true );
|
||||
pls1.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -413,8 +413,8 @@ class TestQgsMapToolLabel : public QObject
|
||||
QgsPalLayerSettings pls1;
|
||||
pls1.fieldName = QStringLiteral( "'label'" );
|
||||
pls1.isExpression = true;
|
||||
pls1.placement = QgsPalLayerSettings::OverPoint;
|
||||
pls1.quadOffset = QgsPalLayerSettings::QuadrantOver;
|
||||
pls1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
pls1.quadOffset = Qgis::LabelQuadrantPosition::Over;
|
||||
pls1.placementSettings().setAllowDegradedPlacement( true );
|
||||
pls1.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -449,14 +449,14 @@ class TestQgsMapToolLabel : public QObject
|
||||
QCOMPARE( labelAlignment, QgsMapToolLabel::LabelAlignment::HalfCenter );
|
||||
|
||||
// defaults to bottom left if qudrant is not relevant
|
||||
pls1.placement = QgsPalLayerSettings::OrderedPositionsAroundPoint;
|
||||
pls1.placement = Qgis::LabelPlacement::OrderedPositionsAroundPoint;
|
||||
tool->mCurrentLabel.settings = pls1;
|
||||
labelAlignment = tool->currentAlignment();
|
||||
QCOMPARE( labelAlignment, QgsMapToolLabel::LabelAlignment::BottomLeft );
|
||||
|
||||
// now try with quadrant property
|
||||
pls1.placement = QgsPalLayerSettings::OverPoint;
|
||||
pls1.quadOffset = QgsPalLayerSettings::QuadrantBelowLeft;
|
||||
pls1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
pls1.quadOffset = Qgis::LabelQuadrantPosition::BelowLeft;
|
||||
tool->mCurrentLabel.settings = pls1;
|
||||
labelAlignment = tool->currentAlignment();
|
||||
QCOMPARE( labelAlignment, QgsMapToolLabel::LabelAlignment::TopRight );
|
||||
|
||||
@ -604,8 +604,8 @@ void TestQgsArcGisRestUtils::testParseLabeling()
|
||||
|
||||
QgsPalLayerSettings *settings = children.at( 0 )->settings();
|
||||
QVERIFY( settings );
|
||||
QCOMPARE( settings->placement, QgsPalLayerSettings::OverPoint );
|
||||
QCOMPARE( settings->quadOffset, QgsPalLayerSettings::QuadrantAboveRight );
|
||||
QCOMPARE( settings->placement, Qgis::LabelPlacement::OverPoint );
|
||||
QCOMPARE( settings->quadOffset, Qgis::LabelQuadrantPosition::AboveRight );
|
||||
QCOMPARE( settings->fieldName, QStringLiteral( "\"Name\"" ) );
|
||||
|
||||
QgsTextFormat textFormat = settings->format();
|
||||
|
||||
@ -313,7 +313,7 @@ void TestQgsCallout::calloutsInLabeling()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -376,7 +376,7 @@ void TestQgsCallout::calloutsBlend()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -429,7 +429,7 @@ void TestQgsCallout::calloutsWithRotation()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -468,7 +468,7 @@ void TestQgsCallout::calloutsInLayout()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 5;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -528,7 +528,7 @@ void TestQgsCallout::calloutsDisabled()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -579,7 +579,7 @@ void TestQgsCallout::calloutsDataDefinedDisabled()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -631,7 +631,7 @@ void TestQgsCallout::calloutDataDefinedSymbol()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -683,7 +683,7 @@ void TestQgsCallout::calloutDataDefinedSymbolColor()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -735,7 +735,7 @@ void TestQgsCallout::calloutMinimumDistance()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelDistance, QgsProperty::fromExpression( QStringLiteral( "case when Class='Jet' then 20 else 5 end" ) ) );
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -787,7 +787,7 @@ void TestQgsCallout::calloutDataDefinedMinimumDistance()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -840,7 +840,7 @@ void TestQgsCallout::calloutOffsetFromAnchor()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -892,7 +892,7 @@ void TestQgsCallout::calloutDataDefinedOffsetFromAnchor()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -944,7 +944,7 @@ void TestQgsCallout::calloutOffsetFromLabel()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -997,7 +997,7 @@ void TestQgsCallout::calloutDataDefinedOffsetFromLabel()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1050,7 +1050,7 @@ void TestQgsCallout::calloutLabelAnchorTopRight()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1081,7 +1081,7 @@ void TestQgsCallout::calloutLabelAnchorTopRight()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1119,7 +1119,7 @@ void TestQgsCallout::calloutLabelAnchorTopLeft()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1150,7 +1150,7 @@ void TestQgsCallout::calloutLabelAnchorTopLeft()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1187,7 +1187,7 @@ void TestQgsCallout::calloutLabelAnchorTop()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1218,7 +1218,7 @@ void TestQgsCallout::calloutLabelAnchorTop()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1255,7 +1255,7 @@ void TestQgsCallout::calloutLabelAnchorBottomLeft()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1286,7 +1286,7 @@ void TestQgsCallout::calloutLabelAnchorBottomLeft()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1323,7 +1323,7 @@ void TestQgsCallout::calloutLabelAnchorBottom()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1354,7 +1354,7 @@ void TestQgsCallout::calloutLabelAnchorBottom()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1391,7 +1391,7 @@ void TestQgsCallout::calloutLabelAnchorBottomRight()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1422,7 +1422,7 @@ void TestQgsCallout::calloutLabelAnchorBottomRight()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1459,7 +1459,7 @@ void TestQgsCallout::calloutLabelAnchorLeft()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1490,7 +1490,7 @@ void TestQgsCallout::calloutLabelAnchorLeft()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1527,7 +1527,7 @@ void TestQgsCallout::calloutLabelAnchorRight()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1558,7 +1558,7 @@ void TestQgsCallout::calloutLabelAnchorRight()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1595,7 +1595,7 @@ void TestQgsCallout::calloutLabelAnchorCentroid()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1626,7 +1626,7 @@ void TestQgsCallout::calloutLabelAnchorCentroid()
|
||||
|
||||
img = job.renderedImage();
|
||||
p.begin( &img );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.xOffset = 6;
|
||||
settings.yOffset = -6;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::LabelRotation, QgsProperty::fromValue( 15 ) );
|
||||
@ -1663,7 +1663,7 @@ void TestQgsCallout::calloutLabelDataDefinedAnchor()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -1717,7 +1717,7 @@ void TestQgsCallout::calloutBehindLabel()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::PositionX, QgsProperty::fromExpression( QStringLiteral( "case when $id = 1 then %1 end" ).arg( mapSettings.extent().center().x() ) ) );
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::PositionY, QgsProperty::fromExpression( QStringLiteral( "case when $id = 1 then %1 end" ).arg( mapSettings.extent().center().y() ) ) );
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::ZIndex, QgsProperty::fromExpression( QStringLiteral( "100 - $id" ) ) );
|
||||
@ -1773,7 +1773,7 @@ void TestQgsCallout::calloutBehindIndividualLabels()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::PositionX, QgsProperty::fromExpression( QStringLiteral( "case when $id = 1 then %1 end" ).arg( mapSettings.extent().center().x() ) ) );
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::PositionY, QgsProperty::fromExpression( QStringLiteral( "case when $id = 1 then %1 end" ).arg( mapSettings.extent().center().y() ) ) );
|
||||
settings.dataDefinedProperties().setProperty( QgsPalLayerSettings::ZIndex, QgsProperty::fromExpression( QStringLiteral( "100 - $id" ) ) );
|
||||
@ -2291,7 +2291,7 @@ void TestQgsCallout::manhattan()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -2344,7 +2344,7 @@ void TestQgsCallout::manhattanRotated()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 20;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -3971,7 +3971,7 @@ void TestQgsCallout::balloonCallout()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 7;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -4025,7 +4025,7 @@ void TestQgsCallout::balloonCalloutMargin()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -4080,7 +4080,7 @@ void TestQgsCallout::balloonCalloutWedgeWidth()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -4135,7 +4135,7 @@ void TestQgsCallout::balloonCalloutCornerRadius()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 10;
|
||||
|
||||
QgsTextFormat format;
|
||||
|
||||
@ -746,7 +746,7 @@ void TestQgsDxfExport::testTextQuadrant()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "text" );
|
||||
settings.placement = QgsPalLayerSettings::Placement::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
QgsPropertyCollection props = settings.dataDefinedProperties();
|
||||
QgsProperty offsetQuadProp = QgsProperty();
|
||||
|
||||
@ -391,8 +391,8 @@ void TestQgsLabelingEngine::testRuleBased()
|
||||
format.setFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ) );
|
||||
format.setSize( 12 );
|
||||
s1.setFormat( format );
|
||||
s1.placement = QgsPalLayerSettings::OverPoint;
|
||||
s1.quadOffset = QgsPalLayerSettings::QuadrantAboveLeft;
|
||||
s1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
s1.quadOffset = Qgis::LabelQuadrantPosition::AboveLeft;
|
||||
s1.placementSettings().setAllowDegradedPlacement( true );
|
||||
s1.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -406,8 +406,8 @@ void TestQgsLabelingEngine::testRuleBased()
|
||||
format.setColor( Qt::red );
|
||||
format.setFont( QgsFontUtils::getStandardTestFont( QStringLiteral( "Bold" ) ) );
|
||||
s2.setFormat( format );
|
||||
s2.placement = QgsPalLayerSettings::OverPoint;
|
||||
s2.quadOffset = QgsPalLayerSettings::QuadrantBelowRight;
|
||||
s2.placement = Qgis::LabelPlacement::OverPoint;
|
||||
s2.quadOffset = Qgis::LabelQuadrantPosition::BelowRight;
|
||||
s2.placementSettings().setAllowDegradedPlacement( true );
|
||||
s2.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -477,8 +477,8 @@ void TestQgsLabelingEngine::zOrder()
|
||||
|
||||
QgsPalLayerSettings pls1;
|
||||
pls1.fieldName = QStringLiteral( "Class" );
|
||||
pls1.placement = QgsPalLayerSettings::OverPoint;
|
||||
pls1.quadOffset = QgsPalLayerSettings::QuadrantAboveRight;
|
||||
pls1.placement = Qgis::LabelPlacement::OverPoint;
|
||||
pls1.quadOffset = Qgis::LabelQuadrantPosition::AboveRight;
|
||||
pls1.placementSettings().setAllowDegradedPlacement( true );
|
||||
pls1.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -582,27 +582,27 @@ void TestQgsLabelingEngine::zOrder()
|
||||
void TestQgsLabelingEngine::testEncodeDecodePositionOrder()
|
||||
{
|
||||
//create an ordered position list
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > original;
|
||||
QVector< Qgis::LabelPredefinedPointPosition > original;
|
||||
//make sure all placements are added here
|
||||
original << QgsPalLayerSettings::BottomLeft << QgsPalLayerSettings::BottomSlightlyLeft
|
||||
<< QgsPalLayerSettings::BottomMiddle << QgsPalLayerSettings::BottomSlightlyRight
|
||||
<< QgsPalLayerSettings::BottomRight << QgsPalLayerSettings::MiddleRight
|
||||
<< QgsPalLayerSettings::MiddleLeft << QgsPalLayerSettings::TopLeft
|
||||
<< QgsPalLayerSettings::TopSlightlyLeft << QgsPalLayerSettings::TopMiddle
|
||||
<< QgsPalLayerSettings::TopSlightlyRight << QgsPalLayerSettings::TopRight;
|
||||
original << Qgis::LabelPredefinedPointPosition::BottomLeft << Qgis::LabelPredefinedPointPosition::BottomSlightlyLeft
|
||||
<< Qgis::LabelPredefinedPointPosition::BottomMiddle << Qgis::LabelPredefinedPointPosition::BottomSlightlyRight
|
||||
<< Qgis::LabelPredefinedPointPosition::BottomRight << Qgis::LabelPredefinedPointPosition::MiddleRight
|
||||
<< Qgis::LabelPredefinedPointPosition::MiddleLeft << Qgis::LabelPredefinedPointPosition::TopLeft
|
||||
<< Qgis::LabelPredefinedPointPosition::TopSlightlyLeft << Qgis::LabelPredefinedPointPosition::TopMiddle
|
||||
<< Qgis::LabelPredefinedPointPosition::TopSlightlyRight << Qgis::LabelPredefinedPointPosition::TopRight;
|
||||
//encode list
|
||||
const QString encoded = QgsLabelingUtils::encodePredefinedPositionOrder( original );
|
||||
QVERIFY( !encoded.isEmpty() );
|
||||
|
||||
//decode
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > decoded = QgsLabelingUtils::decodePredefinedPositionOrder( encoded );
|
||||
QVector< Qgis::LabelPredefinedPointPosition > decoded = QgsLabelingUtils::decodePredefinedPositionOrder( encoded );
|
||||
QCOMPARE( decoded, original );
|
||||
|
||||
//test decoding with a messy string
|
||||
decoded = QgsLabelingUtils::decodePredefinedPositionOrder( QStringLiteral( ",tr,x,BSR, L, t,," ) );
|
||||
QVector< QgsPalLayerSettings::PredefinedPointPosition > expected;
|
||||
expected << QgsPalLayerSettings::TopRight << QgsPalLayerSettings::BottomSlightlyRight
|
||||
<< QgsPalLayerSettings::MiddleLeft << QgsPalLayerSettings::TopMiddle;
|
||||
QVector< Qgis::LabelPredefinedPointPosition > expected;
|
||||
expected << Qgis::LabelPredefinedPointPosition::TopRight << Qgis::LabelPredefinedPointPosition::BottomSlightlyRight
|
||||
<< Qgis::LabelPredefinedPointPosition::MiddleLeft << Qgis::LabelPredefinedPointPosition::TopMiddle;
|
||||
QCOMPARE( decoded, expected );
|
||||
}
|
||||
|
||||
@ -948,7 +948,7 @@ void TestQgsLabelingEngine::testRotateHidePartial()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'label'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "polygon?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsNullSymbolRenderer() );
|
||||
@ -1024,7 +1024,7 @@ void TestQgsLabelingEngine::testParallelLabelSmallFeature()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'long label which doesn\\'t fit'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "linestring?crs=epsg:3148&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { {QStringLiteral( "color" ), QStringLiteral( "#000000" )}, {QStringLiteral( "outline_width" ), 0.6} } ) ) );
|
||||
@ -1091,7 +1091,7 @@ void TestQgsLabelingEngine::testAdjacentParts()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.labelPerPart = true;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "Polygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
@ -1143,7 +1143,7 @@ void TestQgsLabelingEngine::testTouchingParts()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXXXXXXXXXXXXXXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setMergeLines( true );
|
||||
|
||||
@ -1199,7 +1199,7 @@ void TestQgsLabelingEngine::testMergingLinesWithForks()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXXXXXXXXXXXXXXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.dist = 1;
|
||||
settings.lineSettings().setMergeLines( true );
|
||||
@ -1266,7 +1266,7 @@ void TestQgsLabelingEngine::testMergingLinesWithMinimumSize()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setMergeLines( true );
|
||||
settings.thinningSettings().setMinimumFeatureSize( 90.0 );
|
||||
@ -1332,7 +1332,7 @@ void TestQgsLabelingEngine::testCurvedLabelsWithTinySegments()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXXXXXXXXXXXXXXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsSingleSymbolRenderer( QgsLineSymbol::createSimple( { {QStringLiteral( "color" ), QStringLiteral( "#000000" )}, {QStringLiteral( "outline_width" ), 0.6} } ) ) );
|
||||
@ -1388,7 +1388,7 @@ void TestQgsLabelingEngine::testCurvedLabelCorrectLinePlacement()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXXXXXXXXXXXXXXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
settings.maxCurvedCharAngleIn = 99;
|
||||
settings.maxCurvedCharAngleOut = 99;
|
||||
@ -1455,7 +1455,7 @@ void TestQgsLabelingEngine::testCurvedLabelNegativeDistance()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXXXXXXXXXXXXXXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.dist = -5;
|
||||
|
||||
@ -1509,7 +1509,7 @@ void TestQgsLabelingEngine::testCurvedLabelOnSmallLineNearCenter()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
@ -1560,7 +1560,7 @@ void TestQgsLabelingEngine::testCurvedLabelLineOrientationAbove()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
|
||||
@ -1625,7 +1625,7 @@ void TestQgsLabelingEngine::testCurvedLabelLineOrientationBelow()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::BelowLine );
|
||||
|
||||
@ -1690,9 +1690,9 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownAbove()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.upsidedownLabels = QgsPalLayerSettings::UpsideDownLabels::ShowAll;
|
||||
settings.upsidedownLabels = Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.05 );
|
||||
settings.lineSettings().setAnchorTextPoint( QgsLabelLineSettings::AnchorTextPoint::CenterOfText );
|
||||
settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict );
|
||||
@ -1758,9 +1758,9 @@ void TestQgsLabelingEngine::testCurvedLabelAllowUpsideDownBelow()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.upsidedownLabels = QgsPalLayerSettings::UpsideDownLabels::ShowAll;
|
||||
settings.upsidedownLabels = Qgis::UpsideDownLabelHandling::AlwaysAllowUpsideDown;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.05 );
|
||||
settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict );
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::BelowLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
@ -1828,7 +1828,7 @@ void TestQgsLabelingEngine::testRepeatDistanceWithSmallLine()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.repeatDistance = 55;
|
||||
|
||||
@ -1882,7 +1882,7 @@ void TestQgsLabelingEngine::testParallelPlacementPreferAbove()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine | QgsLabeling::LinePlacementFlag::BelowLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
settings.labelPerPart = false;
|
||||
|
||||
@ -1935,7 +1935,7 @@ void TestQgsLabelingEngine::testLabelBoundary()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsNullSymbolRenderer() );
|
||||
@ -2004,7 +2004,7 @@ void TestQgsLabelingEngine::testLabelBlockingRegion()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsNullSymbolRenderer() );
|
||||
@ -2088,7 +2088,7 @@ void TestQgsLabelingEngine::testLabelRotationWithReprojection()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
vl2->setRenderer( new QgsNullSymbolRenderer() );
|
||||
@ -2192,7 +2192,7 @@ void TestQgsLabelingEngine::drawUnplaced()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.priority = 3;
|
||||
settings.obstacleSettings().setFactor( 0 );
|
||||
|
||||
@ -2210,7 +2210,7 @@ void TestQgsLabelingEngine::drawUnplaced()
|
||||
// second layer
|
||||
settings.fieldName = QStringLiteral( "'YY'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.priority = 5; // higher priority - YY should be placed, not XX
|
||||
settings.obstacleSettings().setFactor( 0 );
|
||||
format.setSize( 90 );
|
||||
@ -2229,7 +2229,7 @@ void TestQgsLabelingEngine::drawUnplaced()
|
||||
f.setGeometry( QgsGeometry::fromWkt( QStringLiteral( "LineString(-6.250851540391068 60.6, -6.250851640391068 60.6 )" ) ) );
|
||||
QVERIFY( vl3->dataProvider()->addFeature( f ) );
|
||||
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
vl3->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) ); // TODO: this should not be necessary!
|
||||
vl3->setLabelsEnabled( true );
|
||||
|
||||
@ -2273,7 +2273,7 @@ void TestQgsLabelingEngine::labelingResults()
|
||||
|
||||
settings.fieldName = QStringLiteral( "\"id\"" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.priority = 10;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "Point?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
@ -2480,7 +2480,7 @@ void TestQgsLabelingEngine::labelingResultsCurved()
|
||||
|
||||
settings.fieldName = QStringLiteral( "\"id\"" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.priority = 10;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "LineString?crs=epsg:4326&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
@ -2583,7 +2583,7 @@ void TestQgsLabelingEngine::labelingResultsWithCallouts()
|
||||
|
||||
settings.fieldName = QStringLiteral( "\"id\"" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
QgsPropertyCollection labelProps;
|
||||
labelProps.setProperty( QgsPalLayerSettings::PositionX, QgsProperty::fromField( QStringLiteral( "labelx" ) ) );
|
||||
labelProps.setProperty( QgsPalLayerSettings::PositionY, QgsProperty::fromField( QStringLiteral( "labely" ) ) );
|
||||
@ -3049,7 +3049,7 @@ void TestQgsLabelingEngine::curvedOverrun()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setOverrunDistance( 0 );
|
||||
|
||||
@ -3124,7 +3124,7 @@ void TestQgsLabelingEngine::parallelOverrun()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setOverrunDistance( 0 );
|
||||
|
||||
@ -3198,7 +3198,7 @@ void TestQgsLabelingEngine::testDataDefinedLabelAllParts()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.labelPerPart = false;
|
||||
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( QStringLiteral( "MultiPolygon?crs=epsg:3946&field=id:integer" ), QStringLiteral( "vl" ), QStringLiteral( "memory" ) ) );
|
||||
@ -3458,7 +3458,7 @@ void TestQgsLabelingEngine::testRotationBasedOrientationLine()
|
||||
settings.fieldName = QStringLiteral( "'1234'" );
|
||||
settings.isExpression = true;
|
||||
setDefaultLabelParams( settings );
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
QgsTextFormat format = settings.format();
|
||||
format.setOrientation( QgsTextFormat::RotationBasedOrientation );
|
||||
@ -3494,7 +3494,7 @@ void TestQgsLabelingEngine::testMapUnitLetterSpacing()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
QFont font = format.font();
|
||||
font.setLetterSpacing( QFont::AbsoluteSpacing, 30 );
|
||||
format.setFont( font );
|
||||
@ -3548,7 +3548,7 @@ void TestQgsLabelingEngine::testMapUnitWordSpacing()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'X X'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
QFont font = format.font();
|
||||
font.setWordSpacing( 30 );
|
||||
format.setFont( font );
|
||||
@ -3618,7 +3618,7 @@ void TestQgsLabelingEngine::testClipping()
|
||||
settings.setFormat( format );
|
||||
|
||||
settings.fieldName = QStringLiteral( "Name" );
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
|
||||
const QString filename = QStringLiteral( TEST_DATA_DIR ) + "/lines.shp";
|
||||
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ) );
|
||||
@ -3686,7 +3686,7 @@ void TestQgsLabelingEngine::testLineAnchorParallel()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -3749,7 +3749,7 @@ void TestQgsLabelingEngine::testLineAnchorParallelConstraints()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -3945,7 +3945,7 @@ void TestQgsLabelingEngine::testLineAnchorDataDefinedType()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -4014,7 +4014,7 @@ void TestQgsLabelingEngine::testLineAnchorCurved()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -4099,7 +4099,7 @@ void TestQgsLabelingEngine::testLineAnchorCurvedConstraints()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -4298,7 +4298,7 @@ void TestQgsLabelingEngine::testLineAnchorCurvedOverrun()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
|
||||
@ -4367,10 +4367,10 @@ void TestQgsLabelingEngine::testLineAnchorCurvedStrictAllUpsideDown()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Curved;
|
||||
settings.placement = Qgis::LabelPlacement::Curved;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine | QgsLabeling::LinePlacementFlag::MapOrientation );
|
||||
settings.labelPerPart = false;
|
||||
settings.upsidedownLabels = QgsPalLayerSettings::Upright;
|
||||
settings.upsidedownLabels = Qgis::UpsideDownLabelHandling::FlipUpsideDownLabels;
|
||||
|
||||
settings.lineSettings().setLineAnchorPercent( 0.5 );
|
||||
settings.lineSettings().setAnchorType( QgsLabelLineSettings::AnchorType::Strict );
|
||||
@ -4425,7 +4425,7 @@ void TestQgsLabelingEngine::testLineAnchorHorizontal()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'XXXXXXXX'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Horizontal;
|
||||
settings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -4489,7 +4489,7 @@ void TestQgsLabelingEngine::testLineAnchorHorizontalConstraints()
|
||||
|
||||
settings.fieldName = QStringLiteral( "l" );
|
||||
settings.isExpression = false;
|
||||
settings.placement = QgsPalLayerSettings::Horizontal;
|
||||
settings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.0 );
|
||||
@ -4581,7 +4581,7 @@ void TestQgsLabelingEngine::testLineAnchorClipping()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'x'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Horizontal;
|
||||
settings.placement = Qgis::LabelPlacement::Horizontal;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::AboveLine );
|
||||
settings.labelPerPart = false;
|
||||
settings.lineSettings().setLineAnchorPercent( 0.5 );
|
||||
@ -4639,7 +4639,7 @@ void TestQgsLabelingEngine::testShowAllLabelsWhenALabelHasNoCandidates()
|
||||
|
||||
settings.fieldName = QStringLiteral( "'xxxxxxxxxxxxxx'" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.lineSettings().setPlacementFlags( QgsLabeling::LinePlacementFlag::OnLine );
|
||||
settings.obstacleSettings().setFactor( 10 );
|
||||
settings.lineSettings().setOverrunDistance( 50 );
|
||||
@ -4706,7 +4706,7 @@ void TestQgsLabelingEngine::testSymbologyScalingFactor()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 7;
|
||||
|
||||
QgsTextFormat format;
|
||||
@ -4771,7 +4771,7 @@ void TestQgsLabelingEngine::testSymbologyScalingFactor2()
|
||||
|
||||
QgsPalLayerSettings settings;
|
||||
settings.fieldName = QStringLiteral( "Class" );
|
||||
settings.placement = QgsPalLayerSettings::AroundPoint;
|
||||
settings.placement = Qgis::LabelPlacement::AroundPoint;
|
||||
settings.dist = 7;
|
||||
|
||||
QgsTextFormat format;
|
||||
|
||||
@ -1818,7 +1818,7 @@ void TestQgsLayoutMap::testLayeredExportLabelsByLayer()
|
||||
pointsLayer->setLabelsEnabled( true );
|
||||
|
||||
settings.fieldName = QStringLiteral( "Name" );
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.zIndex = 3;
|
||||
linesLayer->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) );
|
||||
linesLayer->setLabelsEnabled( true );
|
||||
@ -1957,7 +1957,7 @@ void TestQgsLayoutMap::testLabelResults()
|
||||
|
||||
settings.fieldName = QStringLiteral( "\"id\"" );
|
||||
settings.isExpression = true;
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.priority = 10;
|
||||
settings.placementSettings().setAllowDegradedPlacement( true );
|
||||
settings.placementSettings().setOverlapHandling( Qgis::LabelOverlapHandling::AllowOverlapIfRequired );
|
||||
|
||||
@ -772,13 +772,13 @@ void TestQgsMapRendererJob::stagedRendererWithStagedLabeling()
|
||||
pointsLayer->setLabelsEnabled( true );
|
||||
|
||||
settings.fieldName = QStringLiteral( "Name" );
|
||||
settings.placement = QgsPalLayerSettings::Line;
|
||||
settings.placement = Qgis::LabelPlacement::Line;
|
||||
settings.zIndex = 3;
|
||||
linesLayer->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) );
|
||||
linesLayer->setLabelsEnabled( true );
|
||||
|
||||
settings.fieldName = QStringLiteral( "Name" );
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.zIndex = 2;
|
||||
settings.obstacleSettings().setType( QgsLabelObstacleSettings::PolygonInterior );
|
||||
polygonsLayer->setLabeling( new QgsVectorLayerSimpleLabeling( settings ) );
|
||||
|
||||
@ -236,7 +236,7 @@ void TestQgsPalLabeling::testGeometryGenerator()
|
||||
settings.fieldName = QStringLiteral( "'X'" );
|
||||
settings.isExpression = true;
|
||||
|
||||
settings.placement = QgsPalLayerSettings::OverPoint;
|
||||
settings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
settings.geometryGeneratorEnabled = true;
|
||||
settings.geometryGeneratorType = QgsWkbTypes::PointGeometry;
|
||||
settings.geometryGenerator = "translate($geometry, 1, 0)";
|
||||
|
||||
@ -184,7 +184,7 @@ void TestQgsVectorTileLayer::test_labeling()
|
||||
QgsPalLayerSettings labelSettings;
|
||||
labelSettings.drawLabels = true;
|
||||
labelSettings.fieldName = "name:en";
|
||||
labelSettings.placement = QgsPalLayerSettings::OverPoint;
|
||||
labelSettings.placement = Qgis::LabelPlacement::OverPoint;
|
||||
labelSettings.setFormat( format );
|
||||
|
||||
QgsVectorTileBasicLabelingStyle st;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user