QGIS/python/core/auto_generated/callouts/qgscallout.sip.in

271 lines
8.5 KiB
Plaintext
Raw Normal View History

2019-07-04 16:37:00 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/callouts/qgscallout.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsCallout
{
%Docstring
Abstract base class for callout renderers.
Implementations of 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
public:
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
2019-07-05 11:05:58 +10:00
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
2019-07-04 16:37:00 +10:00
%Docstring
Returns the properties describing the callout encoded in a
string format.
Subclasses must ensure that they include the base class' 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' readProperties()
method.
.. seealso:: :py:func:`properties`
%End
2019-07-05 11:05:58 +10:00
virtual bool saveProperties( QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context ) const;
2019-07-04 16:37:00 +10:00
%Docstring
Saves the current state of the callout to a DOM ``element``. The default
behavior is to save the properties string map returned by
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 readProperties() on the subclass.
.. seealso:: :py:func:`readProperties`
%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 render() on the callout, and must always
be accompanied by a corresponding call to 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 render() operations on the callout, and must always
be accompanied by a corresponding prior call to 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 startRender() with
the same render ``context``.
%End
void render( QgsRenderContext &context, QRectF rect, const double angle, const QgsGeometry &anchor );
%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).
.. warning::
A prior call to startRender() must have been made before calling this method, and
after all render() operations are complete a call to 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
protected:
virtual void draw( QgsRenderContext &context, QRectF rect, const double angle, const QgsGeometry &anchor ) = 0;
%Docstring
Performs the actual rendering of the callout implementation 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`` are specified in painter coordinates (i.e. pixels).
%End
};
class QgsSimpleLineCallout : QgsCallout
{
%Docstring
A simple direct line callout style.
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgscallout.h"
%End
public:
QgsSimpleLineCallout();
QgsSimpleLineCallout( const QgsSimpleLineCallout &other );
2019-07-05 11:05:58 +10:00
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
QgsSimpleLineCallout.properties() ).
%End
2019-07-04 16:37:00 +10:00
virtual QString type() const;
virtual QgsSimpleLineCallout *clone() const;
2019-07-05 11:05:58 +10:00
virtual QVariantMap properties( const QgsReadWriteContext &context ) const;
2019-07-04 16:37:00 +10:00
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();
void setLineSymbol( QgsLineSymbol *symbol /Transfer/ );
protected:
virtual void draw( QgsRenderContext &context, QRectF rect, const double angle, const QgsGeometry &anchor );
};
class QgsManhattanLineCallout : QgsSimpleLineCallout
{
%TypeHeaderCode
#include "qgscallout.h"
%End
public:
QgsManhattanLineCallout();
QgsManhattanLineCallout( const QgsManhattanLineCallout &other );
2019-07-05 11:05:58 +10:00
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
QgsManhattanLineCallout.properties() ).
%End
virtual QString type() const;
virtual QgsManhattanLineCallout *clone() const;
protected:
virtual void draw( QgsRenderContext &context, QRectF rect, const double angle, const QgsGeometry &anchor );
};
2019-07-04 16:37:00 +10:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/callouts/qgscallout.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/