QGIS/python/core/auto_generated/annotations/qgsannotation.sip.in

349 lines
9.9 KiB
Plaintext
Raw Normal View History

2017-05-23 09:45:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsAnnotation : QObject
{
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
2017-05-23 09:45:57 +02:00
.. versionadded:: 3.0
Abstract base class for annotation items which are drawn over a map.
2017-12-15 10:36:55 -04:00
QgsAnnotation is an abstract base class for map annotation items. These annotations can be
drawn within a map, and have either a fixed map position (retrieved using mapPosition())
or are placed relative to the map's frame (retrieved using relativePosition()).
Annotations with a fixed map position also have a corresponding
QgsCoordinateReferenceSystem, which can be determined by calling mapPositionCrs().
2017-05-23 09:45:57 +02:00
2017-12-15 10:36:55 -04:00
Derived classes should implement their custom painting routines within
a renderAnnotation() override.
2017-05-23 09:45:57 +02:00
%End
%TypeHeaderCode
2017-05-23 09:45:57 +02:00
#include "qgsannotation.h"
%End
%ConvertToSubClassCode
2017-05-23 09:45:57 +02:00
if ( dynamic_cast< QgsTextAnnotation * >( sipCpp ) )
sipType = sipType_QgsTextAnnotation;
else if ( dynamic_cast< QgsSvgAnnotation * >( sipCpp ) )
sipType = sipType_QgsSvgAnnotation;
else if ( dynamic_cast< QgsHtmlAnnotation * >( sipCpp ) )
sipType = sipType_QgsHtmlAnnotation;
else
sipType = NULL;
%End
public:
QgsAnnotation( QObject *parent /TransferThis/ = 0 );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsAnnotation.
2017-05-23 09:45:57 +02:00
%End
2017-04-20 13:39:36 +10:00
virtual QgsAnnotation *clone() const = 0 /Factory/;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Clones the annotation, returning a new copy of the annotation
reflecting the annotation's current state.
2017-05-23 09:45:57 +02:00
%End
2017-04-20 13:39:36 +10:00
bool isVisible() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the annotation is visible and should be rendered.
.. seealso:: :py:func:`setVisible`
2017-05-23 09:45:57 +02:00
%End
void setVisible( bool visible );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the annotation is visible and should be rendered.
.. seealso:: :py:func:`isVisible`
2017-05-23 09:45:57 +02:00
%End
bool hasFixedMapPosition() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns true if the annotation is attached to a fixed map position, or
false if the annotation uses a position relative to the current map
extent.
.. seealso:: :py:func:`setHasFixedMapPosition`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`mapPosition`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`relativePosition`
2017-05-23 09:45:57 +02:00
%End
void setHasFixedMapPosition( bool fixed );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets whether the annotation is attached to a fixed map position, or
uses a position relative to the current map extent.
.. seealso:: :py:func:`hasFixedMapPosition`
2017-05-23 09:45:57 +02:00
%End
QgsPointXY mapPosition() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the map position of the annotation, if it is attached to a fixed map
position.
.. seealso:: :py:func:`setMapPosition`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`hasFixedMapPosition`
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`mapPositionCrs`
2017-05-23 09:45:57 +02:00
%End
void setMapPosition( const QgsPointXY &position );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the map position of the annotation, if it is attached to a fixed map
position.
.. seealso:: :py:func:`mapPosition`
2017-05-23 09:45:57 +02:00
%End
QgsCoordinateReferenceSystem mapPositionCrs() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the CRS of the map position, or an invalid CRS if the annotation does
not have a fixed map position.
.. seealso:: :py:func:`setMapPositionCrs`
2017-05-23 09:45:57 +02:00
%End
void setMapPositionCrs( const QgsCoordinateReferenceSystem &crs );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the CRS of the map position.
.. seealso:: :py:func:`mapPositionCrs`
2017-05-23 09:45:57 +02:00
%End
QPointF relativePosition() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the relative position of the annotation, if it is not attached to a fixed map
position. The coordinates in the return point should be between 0 and 1, and represent
the relative percentage for the position compared to the map width and height.
.. seealso:: :py:func:`setRelativePosition`
2017-05-23 09:45:57 +02:00
%End
void setRelativePosition( QPointF position );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the relative position of the annotation, if it is not attached to a fixed map
position. The coordinates in the return point should be between 0 and 1, and represent
the relative percentage for the position compared to the map width and height.
.. seealso:: :py:func:`relativePosition`
2017-05-23 09:45:57 +02:00
%End
void setFrameOffsetFromReferencePoint( QPointF offset );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the annotation's frame's offset from the mapPosition() reference point.
.. seealso:: :py:func:`frameOffsetFromReferencePoint`
2017-05-23 09:45:57 +02:00
%End
QPointF frameOffsetFromReferencePoint() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the annotation's frame's offset from the mapPosition() reference point.
.. seealso:: :py:func:`setFrameOffsetFromReferencePoint`
2017-05-23 09:45:57 +02:00
%End
void setFrameSize( QSizeF size );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the size of the annotation's frame (the main area in which
the annotation's content is drawn).
.. seealso:: :py:func:`frameSize`
2017-05-23 09:45:57 +02:00
%End
QSizeF frameSize() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the size of the annotation's frame (the main area in which
the annotation's content is drawn).
.. seealso:: :py:func:`setFrameSize`
2017-05-23 09:45:57 +02:00
%End
void setContentsMargin( const QgsMargins &margins );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the margins (in millimeters) between the outside of the frame and the annotation
content.
.. seealso:: :py:func:`contentsMargin`
2017-05-23 09:45:57 +02:00
%End
QgsMargins contentsMargin() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the margins (in millimeters) between the outside of the frame and the annotation
content.
.. seealso:: :py:func:`setContentsMargin`
2017-05-23 09:45:57 +02:00
%End
void setFillSymbol( QgsFillSymbol *symbol /Transfer/ );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the fill symbol used for rendering the annotation frame. Ownership
of the symbol is transferred to the annotation.
.. seealso:: :py:func:`fillSymbol`
2017-05-23 09:45:57 +02:00
%End
QgsFillSymbol *fillSymbol() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the symbol that is used for rendering the annotation frame.
.. seealso:: :py:func:`setFillSymbol`
2017-05-23 09:45:57 +02:00
%End
void render( QgsRenderContext &context ) const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Renders the annotation to a target render context.
2017-05-23 09:45:57 +02:00
%End
2017-05-23 09:45:57 +02:00
virtual void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const = 0;
%Docstring
2017-12-15 10:36:55 -04:00
Writes the annotation state to a DOM element. Derived classes should
call _writeXml() within their implementation of this method.
.. seealso:: :py:func:`readXml`
2017-12-15 10:36:55 -04:00
.. seealso:: _writeXml
2017-05-23 09:45:57 +02:00
%End
virtual void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) = 0;
%Docstring
2017-12-15 10:36:55 -04:00
Restores the annotation's state from a DOM element. Derived classes should
call _readXml() within their implementation of this method.
.. seealso:: :py:func:`writeXml`
2017-12-15 10:36:55 -04:00
.. seealso:: _readXml
2017-05-23 09:45:57 +02:00
%End
void setMarkerSymbol( QgsMarkerSymbol *symbol /Transfer/ );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the symbol that is drawn at the annotation's map position. Ownership
of the symbol is transferred to the annotation.
.. seealso:: :py:func:`markerSymbol`
2017-05-23 09:45:57 +02:00
%End
QgsMarkerSymbol *markerSymbol() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the symbol that is drawn at the annotation's map position.
.. seealso:: :py:func:`setMarkerSymbol`
2017-05-23 09:45:57 +02:00
%End
QgsMapLayer *mapLayer() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the map layer associated with the annotation. Annotations can be
associated with a map layer if their visibility should be synchronized
with the layer's visibility.
.. seealso:: :py:func:`setMapLayer`
2017-05-23 09:45:57 +02:00
%End
void setMapLayer( QgsMapLayer *layer );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the map layer associated with the annotation. Annotations can be
associated with a map layer if their visibility should be synchronized
with the layer's visibility.
.. seealso:: :py:func:`mapLayer`
2017-05-23 09:45:57 +02:00
%End
QgsFeature associatedFeature() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the feature associated with the annotation, or an invalid
feature if none has been set.
.. seealso:: :py:func:`setAssociatedFeature`
2017-05-23 09:45:57 +02:00
%End
virtual void setAssociatedFeature( const QgsFeature &feature );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets the feature associated with the annotation.
.. seealso:: :py:func:`associatedFeature`
2017-05-23 09:45:57 +02:00
%End
signals:
void appearanceChanged();
2017-05-23 09:45:57 +02:00
%Docstring
Emitted whenever the annotation's appearance changes
%End
void moved();
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the annotation's position has changed and items need
to be moved to reflect this.
2017-05-23 09:45:57 +02:00
%End
2017-01-30 17:40:41 +10:00
void mapLayerChanged();
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when the map layer associated with the annotation changes.
2017-05-23 09:45:57 +02:00
%End
protected:
virtual void renderAnnotation( QgsRenderContext &context, QSizeF size ) const = 0;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Renders the annotation's contents to a target /a context at the specified /a size.
Derived classes should implement their custom annotation drawing logic here.
2017-05-23 09:45:57 +02:00
%End
virtual QSizeF minimumFrameSize() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the minimum frame size for the annotation. Subclasses should implement this if they
cannot be resized smaller than a certain minimum size.
2017-05-23 09:45:57 +02:00
%End
void _writeXml( QDomElement &itemElem, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Writes common annotation properties to a DOM element.
This method should be called from subclasses in their writeXml method.
.. seealso:: :py:func:`writeXml`
2017-12-15 10:36:55 -04:00
.. seealso:: _readXml
2017-05-23 09:45:57 +02:00
%End
2017-05-23 09:45:57 +02:00
void _readXml( const QDomElement &annotationElem, const QgsReadWriteContext &context );
%Docstring
2017-12-15 10:36:55 -04:00
Reads common annotation properties from a DOM element.
This method should be called from subclasses in their readXml method.
.. seealso:: :py:func:`readXml`
2017-12-15 10:36:55 -04:00
.. seealso:: _writeXml
2017-05-23 09:45:57 +02:00
%End
2017-04-20 13:39:36 +10:00
void copyCommonProperties( QgsAnnotation *target ) const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Copies common annotation properties to the ``targe``
annotation.
Can be used within QgsAnnotation.clone() implementations
to assist with creating copies.
2017-05-23 09:45:57 +02:00
%End
2017-04-20 13:39:36 +10:00
};
2017-05-23 09:45:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotation.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/