mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-01 00:05:25 -04:00
Not an ideal implementation (too much logic resides in the gui QgsMapCanvasAnnotationItem class), but any approach using current api will be dependant on some hacks. Ideally we need a QgsVectorDataProvider method for finding the closest feature(s) to a point(/line/polygon) within a certain tolerance, with provider specific implementations which offload this to the data store's spatial indices. Then this handling could be bumped up to reside in QgsAnnotation.
69 lines
1.9 KiB
Plaintext
69 lines
1.9 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 );
|
|
|
|
QgsFeature associatedFeature() const;
|
|
virtual void setAssociatedFeature( const QgsFeature& feature );
|
|
|
|
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 );
|
|
|
|
};
|