QGIS/python/core/annotations/qgsannotation.sip
Nyall Dawson aa14926ca8 Move map layer association for annotations to QgsAnnotation
Previously only some annotations had (incomplete) support for
attaching to a particular vector layer and synchronising their
visibility with the layer's visibility.

This handling has all been moved up to QgsAnnotation, so that
all annotation types can be attached to layers.

This will allow selective annotation visibility based on the
visible layers of a particular canvas, eg in multi-canvas
environments.

Additionally:
- show the attached layer in the annotation properties
dialog, and allow it to be cleared to always show the
annotation
- allow attaching annotations to non-vector layers
- add unit tests for visibility
2017-01-30 08:36:20 +10:00

66 lines
1.8 KiB
Plaintext

class QgsAnnotation : QObject
{
%TypeHeaderCode
#include <qgsannotation.h>
%End
public:
QgsAnnotation( QObject* parent /TransferThis/ = nullptr );
bool isVisible() const;
void setVisible( bool visible );
bool hasFixedMapPosition() const;
void setHasFixedMapPosition( bool fixed );
QgsPoint mapPosition() const;
void setMapPosition( const QgsPoint& position );
QgsCoordinateReferenceSystem mapPositionCrs() const;
void setMapPositionCrs( const QgsCoordinateReferenceSystem& crs );
QPointF relativePosition() const;
void setRelativePosition( QPointF position );
void setFrameOffsetFromReferencePoint( QPointF offset );
QPointF frameOffsetFromReferencePoint() const;
void setFrameSize( QSizeF size );
QSizeF frameSize() const;
void setFrameBorderWidth( double width );
double frameBorderWidth() const;
void setFrameColor( const QColor& color );
QColor frameColor() const;
void setFrameBackgroundColor( const QColor& color );
QColor frameBackgroundColor() const;
void render( QgsRenderContext& context ) const;
virtual void writeXml( QDomElement& elem, QDomDocument & doc ) const = 0;
virtual void readXml( const QDomElement& itemElem, const QDomDocument& doc ) = 0;
void setMarkerSymbol( QgsMarkerSymbol* symbol /Transfer/ );
QgsMarkerSymbol* markerSymbol() const;
QgsMapLayer* mapLayer() const;
void setMapLayer( QgsMapLayer* layer );
signals:
void appearanceChanged();
void moved();
protected:
virtual void renderAnnotation( QgsRenderContext& context, QSizeF size ) const = 0;
virtual QSizeF minimumFrameSize() const;
void _writeXml( QDomElement& itemElem, QDomDocument& doc ) const;
void _readXml( const QDomElement& annotationElem, const QDomDocument& doc );
};