Skip to content

Commit

Permalink
[FEATURE][labeling] Add data defined control over callout origin
Browse files Browse the repository at this point in the history
and destination points

Allows users to data define the starting and ending points for
label callout lines, which is useful when needing to manually
control the exact placement of individual callout lines.
  • Loading branch information
nyalldawson committed Feb 23, 2021
1 parent 61edbb3 commit ee25819
Show file tree
Hide file tree
Showing 10 changed files with 772 additions and 209 deletions.
26 changes: 24 additions & 2 deletions python/core/auto_generated/callouts/qgscallout.sip.in
Expand Up @@ -49,6 +49,10 @@ relevant symbology elements to render them.
DrawCalloutToAllParts,
AnchorPointPosition,
LabelAnchorPointPosition,
OriginX,
OriginY,
DestinationX,
DestinationY,
};

enum DrawOrder
Expand Down Expand Up @@ -376,11 +380,29 @@ The ``calloutContext`` argument is used to specify additional contextual informa
how a callout is being rendered.
%End

QgsGeometry labelAnchorGeometry( QRectF bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const;
QgsGeometry labelAnchorGeometry( QRectF bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const /Deprecated/;
%Docstring
Returns the anchor point geometry for a label with the given bounding box and ``anchor`` point mode.

.. versionadded:: 3.14
.. deprecated::
QGIS 3.20 use :py:func:`~QgsCallout.calloutLabelPoint` instead
%End

QgsGeometry calloutLabelPoint( QRectF bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext ) const;
%Docstring
Returns the anchor point geometry for a label with the given bounding box and ``anchor`` point mode.

.. versionadded:: 3.20
%End

QgsGeometry calloutLineToPart( const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext ) const;
%Docstring
Calculates the direct line from a label geometry to an anchor geometry part, respecting the various
callout settings which influence how the callout end should be placed in the anchor geometry.

Returns a null geometry if the callout line cannot be calculated.

.. versionadded:: 3.20
%End

};
Expand Down

0 comments on commit ee25819

Please sign in to comment.