mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
1245 lines
33 KiB
Plaintext
1245 lines
33 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/callouts/qgscallout.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsCallout
|
|
{
|
|
%Docstring(signature="appended")
|
|
Abstract base class for callout renderers.
|
|
|
|
Implementations of :py:class:`QgsCallout` are responsible for performing
|
|
the actual render of callouts, including determining the desired shape
|
|
of the callout and using any relevant symbology elements to render them.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
%ConvertToSubClassCode
|
|
if ( sipCpp->type() == "simple" && dynamic_cast<QgsSimpleLineCallout *>( sipCpp ) != NULL )
|
|
{
|
|
sipType = sipType_QgsSimpleLineCallout;
|
|
}
|
|
else if ( sipCpp->type() == "manhattan" && dynamic_cast<QgsManhattanLineCallout *>( sipCpp ) != NULL )
|
|
{
|
|
sipType = sipType_QgsManhattanLineCallout;
|
|
}
|
|
else if ( sipCpp->type() == "curved" && dynamic_cast<QgsCurvedLineCallout *>( sipCpp ) != NULL )
|
|
{
|
|
sipType = sipType_QgsCurvedLineCallout;
|
|
}
|
|
else if ( sipCpp->type() == "balloon" && dynamic_cast<QgsBalloonCallout *>( sipCpp ) != NULL )
|
|
{
|
|
sipType = sipType_QgsBalloonCallout;
|
|
}
|
|
else
|
|
{
|
|
sipType = 0;
|
|
}
|
|
%End
|
|
public:
|
|
|
|
enum class Property
|
|
{
|
|
MinimumCalloutLength,
|
|
OffsetFromAnchor,
|
|
OffsetFromLabel,
|
|
DrawCalloutToAllParts,
|
|
AnchorPointPosition,
|
|
LabelAnchorPointPosition,
|
|
OriginX,
|
|
OriginY,
|
|
DestinationX,
|
|
DestinationY,
|
|
Curvature,
|
|
Orientation,
|
|
Margins,
|
|
WedgeWidth,
|
|
CornerRadius,
|
|
BlendMode,
|
|
};
|
|
|
|
enum DrawOrder
|
|
{
|
|
OrderBelowAllLabels,
|
|
OrderBelowIndividualLabels,
|
|
};
|
|
|
|
enum AnchorPoint
|
|
{
|
|
PoleOfInaccessibility,
|
|
PointOnExterior,
|
|
PointOnSurface,
|
|
Centroid,
|
|
};
|
|
|
|
enum LabelAnchorPoint
|
|
{
|
|
LabelPointOnExterior,
|
|
LabelCentroid,
|
|
LabelTopLeft,
|
|
LabelTopMiddle,
|
|
LabelTopRight,
|
|
LabelMiddleLeft,
|
|
LabelMiddleRight,
|
|
LabelBottomLeft,
|
|
LabelBottomMiddle,
|
|
LabelBottomRight,
|
|
};
|
|
|
|
QgsCallout();
|
|
%Docstring
|
|
Constructor for QgsCallout.
|
|
%End
|
|
virtual ~QgsCallout();
|
|
|
|
virtual QString type() const = 0;
|
|
%Docstring
|
|
Returns a unique string representing the callout type.
|
|
%End
|
|
|
|
virtual QgsCallout *clone() const = 0 /Factory/;
|
|
%Docstring
|
|
Duplicates a callout by creating a deep copy of the callout.
|
|
|
|
Caller takes ownership of the returned object.
|
|
%End
|
|
|
|
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
|
|
%Docstring
|
|
Returns the properties describing the callout encoded in a string
|
|
format.
|
|
|
|
Subclasses must ensure that they include the base class'
|
|
:py:func:`~QgsCallout.properties` in their returned value.
|
|
|
|
.. seealso:: :py:func:`readProperties`
|
|
|
|
.. seealso:: :py:func:`saveProperties`
|
|
%End
|
|
|
|
virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
|
|
%Docstring
|
|
Reads a string map of an callout's properties and restores the callout
|
|
to the state described by the properties map.
|
|
|
|
Subclasses must ensure that they call the base class'
|
|
:py:func:`~QgsCallout.readProperties` method.
|
|
|
|
.. seealso:: :py:func:`properties`
|
|
%End
|
|
|
|
virtual bool saveProperties( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
|
|
%Docstring
|
|
Saves the current state of the callout to a DOM ``element``. The default
|
|
behavior is to save the properties string map returned by
|
|
:py:func:`~QgsCallout.properties`.
|
|
|
|
:return: ``True`` if save was successful
|
|
|
|
.. seealso:: :py:func:`readProperties`
|
|
%End
|
|
|
|
virtual void restoreProperties( const QDomElement &element, const QgsReadWriteContext &context );
|
|
%Docstring
|
|
Restores the callout's properties from a DOM element.
|
|
|
|
The default behavior is the read the DOM contents and call
|
|
:py:func:`~QgsCallout.readProperties` on the subclass.
|
|
|
|
.. seealso:: :py:func:`readProperties`
|
|
%End
|
|
|
|
bool containsAdvancedEffects() const;
|
|
%Docstring
|
|
Returns ``True`` if the callout requires advanced effects such as blend
|
|
modes, which require output in raster formats to be fully respected.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
virtual void startRender( QgsRenderContext &context );
|
|
%Docstring
|
|
Prepares the callout for rendering on the specified render ``context``.
|
|
|
|
.. warning::
|
|
|
|
This MUST be called prior to calling :py:func:`~QgsCallout.render` on the callout, and must always
|
|
be accompanied by a corresponding call to :py:func:`~QgsCallout.stopRender`.
|
|
|
|
.. seealso:: :py:func:`stopRender`
|
|
%End
|
|
|
|
virtual void stopRender( QgsRenderContext &context );
|
|
%Docstring
|
|
Finalises the callout after a set of rendering operations on the
|
|
specified render ``context``.
|
|
|
|
.. warning::
|
|
|
|
This MUST be called after to after :py:func:`~QgsCallout.render` operations on the callout, and must always
|
|
be accompanied by a corresponding prior call to :py:func:`~QgsCallout.startRender`.
|
|
|
|
.. seealso:: :py:func:`startRender`
|
|
%End
|
|
|
|
virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
|
|
%Docstring
|
|
Returns the set of attributes referenced by the callout. This includes
|
|
attributes required by any data defined properties associated with the
|
|
callout.
|
|
|
|
.. warning::
|
|
|
|
This must only be called after a corresponding call to :py:func:`~QgsCallout.startRender` with
|
|
the same render ``context``.
|
|
%End
|
|
|
|
virtual DrawOrder drawOrder() const;
|
|
%Docstring
|
|
Returns the desired drawing order (stacking) to use while rendering this
|
|
callout.
|
|
|
|
The default order is QgsCallout.OrderBelowIndividualLabels.
|
|
%End
|
|
|
|
class QgsCalloutContext
|
|
{
|
|
%Docstring(signature="appended")
|
|
Contains additional contextual information about the context in which a
|
|
callout is being rendered.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
public:
|
|
bool allFeaturePartsLabeled;
|
|
|
|
QgsCoordinateReferenceSystem originalFeatureCrs;
|
|
|
|
QgsCoordinateTransform originalFeatureToMapTransform( const QgsRenderContext &renderContext ) const;
|
|
%Docstring
|
|
Returns the coordinate transform to convert from the original layer
|
|
associated with the callout to the destination map CRS.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
void addCalloutPosition( const QgsCalloutPosition &position );
|
|
%Docstring
|
|
Adds a rendered callout position.
|
|
|
|
The position details such as the callout line origin and destination
|
|
should be populated by the callout subclass during rendering operations.
|
|
|
|
.. note::
|
|
|
|
the feature ID, layer ID and provider ID of the :py:class:`QgsCalloutPosition` will be automatically populated.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
QList< QgsCalloutPosition > positions() const;
|
|
%Docstring
|
|
Returns the list of rendered callout positions.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
};
|
|
|
|
void render( QgsRenderContext &context, const QRectF &rect, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext );
|
|
%Docstring
|
|
Renders the callout onto the specified render ``context``.
|
|
|
|
The ``rect`` argument gives the desired size and position of the body of
|
|
the callout (e.g. the actual label geometry). The ``angle`` argument
|
|
specifies the rotation of the callout body (in degrees clockwise from
|
|
horizontal). It is assumed that angle rotation specified via ``angle``
|
|
is applied around the center of ``rect``.
|
|
|
|
The ``anchor`` argument dictates the geometry which the callout should
|
|
connect to. Depending on the callout subclass and anchor geometry type,
|
|
the actual shape of the rendered callout may vary. E.g. a subclass may
|
|
prefer to attach to the centroid of the ``anchor``, while another
|
|
subclass may prefer to attach to the closest point on ``anchor``
|
|
instead.
|
|
|
|
Both ``rect`` and ``anchor`` must be specified in painter coordinates
|
|
(i.e. pixels).
|
|
|
|
The ``calloutContext`` argument is used to specify additional contextual
|
|
information about how a callout is being rendered.
|
|
|
|
.. warning::
|
|
|
|
A prior call to :py:func:`~QgsCallout.startRender` must have been made before calling this method, and
|
|
after all :py:func:`~QgsCallout.render` operations are complete a call to :py:func:`~QgsCallout.stopRender` must be made.
|
|
%End
|
|
|
|
bool enabled() const;
|
|
%Docstring
|
|
Returns ``True`` if the the callout is enabled.
|
|
|
|
.. seealso:: :py:func:`setEnabled`
|
|
%End
|
|
|
|
void setEnabled( bool enabled );
|
|
%Docstring
|
|
Sets whether the callout is ``enabled``.
|
|
|
|
.. seealso:: :py:func:`enabled`
|
|
%End
|
|
|
|
QgsPropertyCollection &dataDefinedProperties();
|
|
%Docstring
|
|
Returns a reference to the callout's property collection, used for data
|
|
defined overrides.
|
|
|
|
.. seealso:: :py:func:`setDataDefinedProperties`
|
|
%End
|
|
|
|
|
|
void setDataDefinedProperties( const QgsPropertyCollection &collection );
|
|
%Docstring
|
|
Sets the callout's property ``collection``, used for data defined
|
|
overrides.
|
|
|
|
Any existing properties will be discarded.
|
|
|
|
.. seealso:: :py:func:`dataDefinedProperties`
|
|
|
|
.. seealso:: Property
|
|
%End
|
|
|
|
static QgsPropertiesDefinition propertyDefinitions();
|
|
%Docstring
|
|
Returns the definitions for data defined properties available for use in
|
|
callouts.
|
|
%End
|
|
|
|
AnchorPoint anchorPoint() const;
|
|
%Docstring
|
|
Returns the feature's anchor point position.
|
|
|
|
.. seealso:: :py:func:`setAnchorPoint`
|
|
%End
|
|
|
|
void setAnchorPoint( AnchorPoint anchor );
|
|
%Docstring
|
|
Sets the feature's ``anchor`` point position.
|
|
|
|
.. seealso:: :py:func:`anchorPoint`
|
|
%End
|
|
|
|
static QString encodeAnchorPoint( AnchorPoint anchor );
|
|
%Docstring
|
|
Encodes an ``anchor`` point to its string representation.
|
|
|
|
:return: encoded string
|
|
|
|
.. seealso:: :py:func:`decodeAnchorPoint`
|
|
%End
|
|
|
|
static QgsCallout::AnchorPoint decodeAnchorPoint( const QString &name, bool *ok = 0 );
|
|
%Docstring
|
|
Attempts to decode a string representation of an anchor point name to
|
|
the corresponding anchor point.
|
|
|
|
:param name: encoded anchor point name
|
|
:param ok: if specified, will be set to ``True`` if the anchor point was
|
|
successfully decoded
|
|
|
|
:return: decoded name
|
|
|
|
.. seealso:: :py:func:`encodeAnchorPoint`
|
|
%End
|
|
|
|
|
|
LabelAnchorPoint labelAnchorPoint() const;
|
|
%Docstring
|
|
Returns the label's anchor point position.
|
|
|
|
.. seealso:: :py:func:`setLabelAnchorPoint`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
void setLabelAnchorPoint( LabelAnchorPoint anchor );
|
|
%Docstring
|
|
Sets the label's ``anchor`` point position.
|
|
|
|
.. seealso:: :py:func:`labelAnchorPoint`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
static QString encodeLabelAnchorPoint( LabelAnchorPoint anchor );
|
|
%Docstring
|
|
Encodes a label ``anchor`` point to its string representation.
|
|
|
|
:return: encoded string
|
|
|
|
.. seealso:: :py:func:`decodeLabelAnchorPoint`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
static QgsCallout::LabelAnchorPoint decodeLabelAnchorPoint( const QString &name, bool *ok = 0 );
|
|
%Docstring
|
|
Attempts to decode a string representation of a label anchor point name
|
|
to the corresponding anchor point.
|
|
|
|
:param name: encoded label anchor point name
|
|
:param ok: if specified, will be set to ``True`` if the anchor point was
|
|
successfully decoded
|
|
|
|
:return: decoded name
|
|
|
|
.. seealso:: :py:func:`encodeLabelAnchorPoint`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
QPainter::CompositionMode blendMode() const;
|
|
%Docstring
|
|
Returns the blending mode used for drawing callouts.
|
|
|
|
.. seealso:: :py:func:`setBlendMode`
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
void setBlendMode( QPainter::CompositionMode mode );
|
|
%Docstring
|
|
Sets the blending ``mode`` used for drawing callouts.
|
|
|
|
.. seealso:: :py:func:`blendMode`
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
protected:
|
|
|
|
virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) = 0;
|
|
%Docstring
|
|
Performs the actual rendering of the callout implementation onto the
|
|
specified render ``context``.
|
|
|
|
The ``bodyBoundingBox`` argument gives the desired size and position of
|
|
the body of the callout (e.g. the actual label geometry). The ``angle``
|
|
argument specifies the rotation of the callout body (in degrees
|
|
clockwise from horizontal). It is assumed that angle rotation specified
|
|
via ``angle`` is applied around the center of ``rect``.
|
|
|
|
The ``anchor`` argument dictates the geometry which the callout should
|
|
connect to. Depending on the callout subclass and anchor geometry type,
|
|
the actual shape of the rendered callout may vary. E.g. a subclass may
|
|
prefer to attach to the centroid of the ``anchor``, while another
|
|
subclass may prefer to attach to the closest point on ``anchor``
|
|
instead.
|
|
|
|
Both ``rect`` and ``anchor`` are specified in painter coordinates (i.e.
|
|
pixels).
|
|
|
|
The ``calloutContext`` argument is used to specify additional contextual
|
|
information about how a callout is being rendered.
|
|
%End
|
|
|
|
QgsGeometry labelAnchorGeometry( const QRectF &bodyBoundingBox, const double angle, LabelAnchorPoint anchor ) const /Deprecated="Since 3.20. Use calloutLabelPoint() instead."/;
|
|
%Docstring
|
|
Returns the anchor point geometry for a label with the given bounding
|
|
box and ``anchor`` point mode.
|
|
|
|
.. deprecated:: 3.20
|
|
|
|
Use :py:func:`~QgsCallout.calloutLabelPoint` instead.
|
|
%End
|
|
|
|
QgsGeometry calloutLabelPoint( const QRectF &bodyBoundingBox, double angle, LabelAnchorPoint anchor, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) const;
|
|
%Docstring
|
|
Returns the anchor point geometry for a label with the given bounding
|
|
box and ``anchor`` point mode.
|
|
|
|
The ``pinned`` argument will be set to ``True`` if the callout label
|
|
point is pinned (manually placed).
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
QgsGeometry calloutLineToPart( const QgsGeometry &labelGeometry, const QgsAbstractGeometry *partGeometry, QgsRenderContext &context, const QgsCalloutContext &calloutContext, bool &pinned ) 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.
|
|
|
|
The ``pinned`` argument will be set to ``True`` if the callout anchor
|
|
point is pinned (manually placed).
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
};
|
|
|
|
class QgsSimpleLineCallout : QgsCallout
|
|
{
|
|
%Docstring(signature="appended")
|
|
A simple direct line callout style.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
public:
|
|
|
|
QgsSimpleLineCallout();
|
|
~QgsSimpleLineCallout();
|
|
|
|
|
|
static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) /Factory/;
|
|
%Docstring
|
|
Creates a new QgsSimpleLineCallout, using the settings serialized in the
|
|
``properties`` map (corresponding to the output from
|
|
:py:func:`QgsSimpleLineCallout.properties()` ).
|
|
%End
|
|
|
|
virtual QString type() const;
|
|
|
|
virtual QgsSimpleLineCallout *clone() const;
|
|
|
|
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
|
|
|
|
virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
|
|
|
|
virtual void startRender( QgsRenderContext &context );
|
|
|
|
virtual void stopRender( QgsRenderContext &context );
|
|
|
|
virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
|
|
|
|
|
|
QgsLineSymbol *lineSymbol();
|
|
%Docstring
|
|
Returns the line symbol used to render the callout line.
|
|
|
|
Ownership is not transferred.
|
|
|
|
.. seealso:: :py:func:`setLineSymbol`
|
|
%End
|
|
|
|
void setLineSymbol( QgsLineSymbol *symbol /Transfer/ );
|
|
%Docstring
|
|
Sets the line ``symbol`` used to render the callout line. Ownership of
|
|
``symbol`` is transferred to the callout.
|
|
|
|
.. seealso:: :py:func:`lineSymbol`
|
|
%End
|
|
|
|
double minimumLength() const;
|
|
%Docstring
|
|
Returns the minimum length of callout lines. Units are specified through
|
|
:py:func:`~QgsSimpleLineCallout.minimumLengthUnits`.
|
|
|
|
.. seealso:: :py:func:`setMinimumLength`
|
|
|
|
.. seealso:: :py:func:`minimumLengthUnit`
|
|
%End
|
|
|
|
void setMinimumLength( double length );
|
|
%Docstring
|
|
Sets the minimum ``length`` of callout lines. Units are specified
|
|
through :py:func:`~QgsSimpleLineCallout.setMinimumLengthUnit`.
|
|
|
|
.. seealso:: :py:func:`minimumLength`
|
|
|
|
.. seealso:: :py:func:`setMinimumLengthUnit`
|
|
%End
|
|
|
|
void setMinimumLengthUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the minimum length of callout lines.
|
|
|
|
.. seealso:: :py:func:`minimumLengthUnit`
|
|
|
|
.. seealso:: :py:func:`setMinimumLength`
|
|
%End
|
|
|
|
Qgis::RenderUnit minimumLengthUnit() const;
|
|
%Docstring
|
|
Returns the units for the minimum length of callout lines.
|
|
|
|
.. seealso:: :py:func:`setMinimumLengthUnit`
|
|
|
|
.. seealso:: :py:func:`minimumLength`
|
|
%End
|
|
|
|
void setMinimumLengthMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the minimum callout length.
|
|
|
|
.. seealso:: :py:func:`minimumLengthMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setMinimumLengthUnit`
|
|
|
|
.. seealso:: :py:func:`setMinimumLength`
|
|
%End
|
|
|
|
const QgsMapUnitScale &minimumLengthMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the minimum callout length.
|
|
|
|
.. seealso:: :py:func:`setMinimumLengthMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`minimumLengthUnit`
|
|
|
|
.. seealso:: :py:func:`minimumLength`
|
|
%End
|
|
|
|
|
|
double offsetFromAnchor() const;
|
|
%Docstring
|
|
Returns the offset distance from the anchor point at which to start the
|
|
line. Units are specified through
|
|
:py:func:`~QgsSimpleLineCallout.offsetFromAnchorUnit`.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorUnit`
|
|
%End
|
|
|
|
void setOffsetFromAnchor( double distance );
|
|
%Docstring
|
|
Sets the offset ``distance`` from the anchor point at which to start the
|
|
line. Units are specified through
|
|
:py:func:`~QgsSimpleLineCallout.setOffsetFromAnchorUnit`.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
%End
|
|
|
|
void setOffsetFromAnchorUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the offset from anchor distance.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
%End
|
|
|
|
Qgis::RenderUnit offsetFromAnchorUnit() const;
|
|
%Docstring
|
|
Returns the units for the offset from anchor point.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
%End
|
|
|
|
void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the offset from anchor.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
%End
|
|
|
|
const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the offset from anchor.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
%End
|
|
|
|
double offsetFromLabel() const;
|
|
%Docstring
|
|
Returns the offset distance from label area at which to end the line.
|
|
Units are specified through
|
|
:py:func:`~QgsSimpleLineCallout.offsetFromLabelUnit`.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabel`
|
|
|
|
.. seealso:: :py:func:`offsetFromLabelUnit`
|
|
%End
|
|
|
|
void setOffsetFromLabel( double distance );
|
|
%Docstring
|
|
Sets the offset ``distance`` from label area at which to end the line.
|
|
Units are specified through
|
|
:py:func:`~QgsSimpleLineCallout.setOffsetFromLabelUnit`.
|
|
|
|
.. seealso:: :py:func:`offsetFromLabel`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabelUnit`
|
|
%End
|
|
|
|
void setOffsetFromLabelUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the offset from label area distance.
|
|
|
|
.. seealso:: :py:func:`offsetFromLabel`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabel`
|
|
%End
|
|
|
|
Qgis::RenderUnit offsetFromLabelUnit() const;
|
|
%Docstring
|
|
Returns the units for the offset from label area.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabelUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromLabel`
|
|
%End
|
|
|
|
void setOffsetFromLabelMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the offset from label area.
|
|
|
|
.. seealso:: :py:func:`offsetFromLabelMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabelUnit`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabel`
|
|
%End
|
|
|
|
const QgsMapUnitScale &offsetFromLabelMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the minimum callout length.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromLabelMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`offsetFromLabelUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromLabel`
|
|
%End
|
|
|
|
bool drawCalloutToAllParts() const;
|
|
%Docstring
|
|
Returns ``True`` if callout lines should be drawn to all feature parts.
|
|
|
|
.. seealso:: :py:func:`setDrawCalloutToAllParts`
|
|
%End
|
|
|
|
void setDrawCalloutToAllParts( bool drawToAllParts );
|
|
%Docstring
|
|
Sets whether callout lines should be drawn to all feature parts.
|
|
|
|
.. seealso:: :py:func:`drawCalloutToAllParts`
|
|
%End
|
|
|
|
protected:
|
|
virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext );
|
|
|
|
|
|
virtual QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) const /Factory/;
|
|
%Docstring
|
|
Creates a callout line between ``start`` and ``end`` in the desired
|
|
style.
|
|
|
|
The base class method returns a straight line.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
private:
|
|
QgsSimpleLineCallout( const QgsSimpleLineCallout &other );
|
|
QgsSimpleLineCallout &operator=( const QgsSimpleLineCallout & );
|
|
};
|
|
|
|
|
|
class QgsManhattanLineCallout : QgsSimpleLineCallout
|
|
{
|
|
%Docstring(signature="appended")
|
|
Draws straight (right angled) lines as callouts.
|
|
|
|
.. versionadded:: 3.10
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
public:
|
|
|
|
QgsManhattanLineCallout();
|
|
|
|
|
|
static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) /Factory/;
|
|
%Docstring
|
|
Creates a new QgsManhattanLineCallout, using the settings serialized in
|
|
the ``properties`` map (corresponding to the output from
|
|
:py:func:`QgsManhattanLineCallout.properties()` ).
|
|
%End
|
|
|
|
virtual QString type() const;
|
|
|
|
virtual QgsManhattanLineCallout *clone() const;
|
|
|
|
|
|
protected:
|
|
virtual QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext ) const /Factory/;
|
|
|
|
|
|
private:
|
|
QgsManhattanLineCallout( const QgsManhattanLineCallout &other );
|
|
QgsManhattanLineCallout &operator=( const QgsManhattanLineCallout & );
|
|
};
|
|
|
|
|
|
class QgsCurvedLineCallout : QgsSimpleLineCallout
|
|
{
|
|
%Docstring(signature="appended")
|
|
Draws curved lines as callouts.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
public:
|
|
|
|
enum Orientation
|
|
{
|
|
Automatic,
|
|
Clockwise,
|
|
CounterClockwise,
|
|
};
|
|
|
|
QgsCurvedLineCallout();
|
|
|
|
|
|
static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) /Factory/;
|
|
%Docstring
|
|
Creates a new QgsCurvedLineCallout, using the settings serialized in the
|
|
``properties`` map (corresponding to the output from
|
|
:py:func:`QgsCurvedLineCallout.properties()` ).
|
|
%End
|
|
|
|
virtual QString type() const;
|
|
|
|
virtual QgsCurvedLineCallout *clone() const;
|
|
|
|
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
|
|
|
|
|
|
double curvature() const;
|
|
%Docstring
|
|
Returns the callout line's curvature.
|
|
|
|
The curvature is a percentage value (with typical ranges between 0.0 and
|
|
1.0), representing the overall curvature of the line.
|
|
|
|
.. seealso:: :py:func:`setCurvature`
|
|
%End
|
|
|
|
void setCurvature( double curvature );
|
|
%Docstring
|
|
Sets the callout line's ``curvature``.
|
|
|
|
The ``curvature`` is a percentage value (with typical ranges between 0.0
|
|
and 1.0), representing the overall curvature of the line.
|
|
|
|
.. seealso:: :py:func:`curvature`
|
|
%End
|
|
|
|
Orientation orientation() const;
|
|
%Docstring
|
|
Returns the callout line's curve orientation.
|
|
|
|
.. seealso:: :py:func:`setOrientation`
|
|
%End
|
|
|
|
void setOrientation( Orientation orientation );
|
|
%Docstring
|
|
Sets the callout line's curve ``orientation``.
|
|
|
|
.. seealso:: :py:func:`orientation`
|
|
%End
|
|
|
|
protected:
|
|
virtual QgsCurve *createCalloutLine( const QgsPoint &start, const QgsPoint &end, QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext ) const /Factory/;
|
|
|
|
|
|
private:
|
|
QgsCurvedLineCallout( const QgsCurvedLineCallout &other );
|
|
QgsCurvedLineCallout &operator=( const QgsCurvedLineCallout & );
|
|
};
|
|
|
|
|
|
class QgsBalloonCallout : QgsCallout
|
|
{
|
|
%Docstring(signature="appended")
|
|
A cartoon talking bubble callout style.
|
|
|
|
.. versionadded:: 3.20
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscallout.h"
|
|
%End
|
|
public:
|
|
|
|
QgsBalloonCallout();
|
|
~QgsBalloonCallout();
|
|
|
|
|
|
static QgsCallout *create( const QVariantMap &properties = QVariantMap(), const QgsReadWriteContext &context = QgsReadWriteContext() ) /Factory/;
|
|
%Docstring
|
|
Creates a new QgsBalloonCallout, using the settings serialized in the
|
|
``properties`` map (corresponding to the output from
|
|
:py:func:`QgsBalloonCallout.properties()` ).
|
|
%End
|
|
|
|
virtual QString type() const;
|
|
|
|
virtual QgsBalloonCallout *clone() const;
|
|
|
|
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
|
|
|
|
virtual void readProperties( const QVariantMap &props, const QgsReadWriteContext &context );
|
|
|
|
virtual void startRender( QgsRenderContext &context );
|
|
|
|
virtual void stopRender( QgsRenderContext &context );
|
|
|
|
virtual QSet< QString > referencedFields( const QgsRenderContext &context ) const;
|
|
|
|
|
|
QgsFillSymbol *fillSymbol();
|
|
%Docstring
|
|
Returns the fill symbol used to render the callout.
|
|
|
|
Ownership is not transferred.
|
|
|
|
.. seealso:: :py:func:`setFillSymbol`
|
|
%End
|
|
|
|
void setFillSymbol( QgsFillSymbol *symbol /Transfer/ );
|
|
%Docstring
|
|
Sets the fill ``symbol`` used to render the callout. Ownership of
|
|
``symbol`` is transferred to the callout.
|
|
|
|
.. seealso:: :py:func:`fillSymbol`
|
|
%End
|
|
|
|
QgsMarkerSymbol *markerSymbol();
|
|
%Docstring
|
|
Returns the marker symbol used to render the callout endpoint.
|
|
|
|
May be ``None``, if no endpoint marker will be used.
|
|
|
|
The marker will always be rendered below the fill symbol for the
|
|
callout.
|
|
|
|
Ownership is not transferred.
|
|
|
|
.. seealso:: :py:func:`setMarkerSymbol`
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
void setMarkerSymbol( QgsMarkerSymbol *symbol /Transfer/ );
|
|
%Docstring
|
|
Sets the marker ``symbol`` used to render the callout endpoint.
|
|
Ownership of ``symbol`` is transferred to the callout.
|
|
|
|
Set to ``None`` to disable the endpoint marker.
|
|
|
|
The marker will always be rendered below the fill symbol for the
|
|
callout.
|
|
|
|
.. seealso:: :py:func:`markerSymbol`
|
|
|
|
.. versionadded:: 3.40
|
|
%End
|
|
|
|
double offsetFromAnchor() const;
|
|
%Docstring
|
|
Returns the offset distance from the anchor point at which to start the
|
|
line. Units are specified through
|
|
:py:func:`~QgsBalloonCallout.offsetFromAnchorUnit`.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorUnit`
|
|
%End
|
|
|
|
void setOffsetFromAnchor( double distance );
|
|
%Docstring
|
|
Sets the offset ``distance`` from the anchor point at which to start the
|
|
line. Units are specified through
|
|
:py:func:`~QgsBalloonCallout.setOffsetFromAnchorUnit`.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
%End
|
|
|
|
void setOffsetFromAnchorUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the offset from anchor distance.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
%End
|
|
|
|
Qgis::RenderUnit offsetFromAnchorUnit() const;
|
|
%Docstring
|
|
Returns the units for the offset from anchor point.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
%End
|
|
|
|
void setOffsetFromAnchorMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the offset from anchor.
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchor`
|
|
%End
|
|
|
|
const QgsMapUnitScale &offsetFromAnchorMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the offset from anchor.
|
|
|
|
.. seealso:: :py:func:`setOffsetFromAnchorMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchorUnit`
|
|
|
|
.. seealso:: :py:func:`offsetFromAnchor`
|
|
%End
|
|
|
|
const QgsMargins &margins() const;
|
|
%Docstring
|
|
Returns the margins between the outside of the callout frame and the
|
|
label's bounding rectangle.
|
|
|
|
Units are retrieved via :py:func:`~QgsBalloonCallout.marginsUnit`
|
|
|
|
.. note::
|
|
|
|
Negative margins are acceptable.
|
|
|
|
.. seealso:: :py:func:`setMargins`
|
|
|
|
.. seealso:: :py:func:`marginsUnit`
|
|
%End
|
|
|
|
void setMargins( const QgsMargins &margins );
|
|
%Docstring
|
|
Sets the ``margins`` between the outside of the callout frame and the
|
|
label's bounding rectangle.
|
|
|
|
Units are set via :py:func:`~QgsBalloonCallout.setMarginsUnit`
|
|
|
|
.. note::
|
|
|
|
Negative margins are acceptable.
|
|
|
|
.. seealso:: :py:func:`margins`
|
|
|
|
.. seealso:: :py:func:`setMarginsUnit`
|
|
%End
|
|
|
|
void setMarginsUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the margins between the outside of the callout
|
|
frame and the label's bounding rectangle.
|
|
|
|
.. seealso:: :py:func:`margins`
|
|
|
|
.. seealso:: :py:func:`marginsUnit`
|
|
%End
|
|
|
|
Qgis::RenderUnit marginsUnit() const;
|
|
%Docstring
|
|
Returns the units for the margins between the outside of the callout
|
|
frame and the label's bounding rectangle.
|
|
|
|
.. seealso:: :py:func:`setMarginsUnit`
|
|
|
|
.. seealso:: :py:func:`margins`
|
|
%End
|
|
|
|
double wedgeWidth() const;
|
|
%Docstring
|
|
Returns the width of the wedge shape at the side it connects with the
|
|
label.
|
|
|
|
Units are specified through
|
|
:py:func:`~QgsBalloonCallout.wedgeWidthUnit`.
|
|
|
|
.. seealso:: :py:func:`setWedgeWidth`
|
|
|
|
.. seealso:: :py:func:`wedgeWidthUnit`
|
|
%End
|
|
|
|
void setWedgeWidth( double width );
|
|
%Docstring
|
|
Sets the ``width`` of the wedge shape at the side it connects with the
|
|
label.
|
|
|
|
Units are specified through
|
|
:py:func:`~QgsBalloonCallout.setWedgeWidthUnit`.
|
|
|
|
.. seealso:: :py:func:`wedgeWidth`
|
|
|
|
.. seealso:: :py:func:`setWedgeWidthUnit`
|
|
%End
|
|
|
|
void setWedgeWidthUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the wedge width.
|
|
|
|
.. seealso:: :py:func:`wedgeWidthUnit`
|
|
|
|
.. seealso:: :py:func:`setWedgeWidth`
|
|
%End
|
|
|
|
Qgis::RenderUnit wedgeWidthUnit() const;
|
|
%Docstring
|
|
Returns the units for the wedge width.
|
|
|
|
.. seealso:: :py:func:`setWedgeWidthUnit`
|
|
|
|
.. seealso:: :py:func:`wedgeWidth`
|
|
%End
|
|
|
|
void setWedgeWidthMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the wedge width.
|
|
|
|
.. seealso:: :py:func:`wedgeWidthMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setWedgeWidthUnit`
|
|
|
|
.. seealso:: :py:func:`setWedgeWidth`
|
|
%End
|
|
|
|
const QgsMapUnitScale &wedgeWidthMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the wedge width.
|
|
|
|
.. seealso:: :py:func:`setWedgeWidthMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`wedgeWidthUnit`
|
|
|
|
.. seealso:: :py:func:`wedgeWidth`
|
|
%End
|
|
|
|
double cornerRadius() const;
|
|
%Docstring
|
|
Returns the corner radius of the balloon shapes.
|
|
|
|
Units are specified through
|
|
:py:func:`~QgsBalloonCallout.wedgeWidthUnit`.
|
|
|
|
.. seealso:: :py:func:`setCornerRadius`
|
|
|
|
.. seealso:: :py:func:`cornerRadiusUnit`
|
|
%End
|
|
|
|
void setCornerRadius( double radius );
|
|
%Docstring
|
|
Sets the ``radius`` of the corners for the balloon shapes.
|
|
|
|
Units are specified through
|
|
:py:func:`~QgsBalloonCallout.setCornerRadiusUnit`.
|
|
|
|
.. seealso:: :py:func:`cornerRadius`
|
|
|
|
.. seealso:: :py:func:`setCornerRadiusUnit`
|
|
%End
|
|
|
|
void setCornerRadiusUnit( Qgis::RenderUnit unit );
|
|
%Docstring
|
|
Sets the ``unit`` for the corner radius.
|
|
|
|
.. seealso:: :py:func:`cornerRadiusUnit`
|
|
|
|
.. seealso:: :py:func:`setCornerRadius`
|
|
%End
|
|
|
|
Qgis::RenderUnit cornerRadiusUnit() const;
|
|
%Docstring
|
|
Returns the units for the corner radius.
|
|
|
|
.. seealso:: :py:func:`setCornerRadiusUnit`
|
|
|
|
.. seealso:: :py:func:`cornerRadius`
|
|
%End
|
|
|
|
void setCornerRadiusMapUnitScale( const QgsMapUnitScale &scale );
|
|
%Docstring
|
|
Sets the map unit ``scale`` for the corner radius.
|
|
|
|
.. seealso:: :py:func:`cornerRadiusMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`setCornerRadiusUnit`
|
|
|
|
.. seealso:: :py:func:`setCornerRadius`
|
|
%End
|
|
|
|
const QgsMapUnitScale &cornerRadiusMapUnitScale() const;
|
|
%Docstring
|
|
Returns the map unit scale for the corner radius.
|
|
|
|
.. seealso:: :py:func:`setCornerRadiusMapUnitScale`
|
|
|
|
.. seealso:: :py:func:`cornerRadiusUnit`
|
|
|
|
.. seealso:: :py:func:`cornerRadius`
|
|
%End
|
|
|
|
|
|
protected:
|
|
virtual void draw( QgsRenderContext &context, const QRectF &bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext );
|
|
|
|
|
|
private:
|
|
QgsBalloonCallout( const QgsBalloonCallout &other );
|
|
QgsBalloonCallout &operator=( const QgsBalloonCallout & );
|
|
};
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/callouts/qgscallout.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|