18 #ifndef QGSANNOTATION_H
19 #define QGSANNOTATION_H
21 #include "qgis_core.h"
55 sipType = sipType_QgsTextAnnotation;
57 sipType = sipType_QgsSvgAnnotation;
59 sipType = sipType_QgsHtmlAnnotation;
67 Q_PROPERTY(
bool visible READ isVisible WRITE setVisible )
68 Q_PROPERTY(
bool hasFixedMapPosition READ hasFixedMapPosition WRITE setHasFixedMapPosition )
69 Q_PROPERTY(
QgsPointXY mapPosition READ mapPosition WRITE setMapPosition )
70 Q_PROPERTY( QSizeF frameSize READ frameSize WRITE setFrameSize )
89 bool isVisible()
const {
return mVisible; }
95 void setVisible(
bool visible );
112 void setHasFixedMapPosition(
bool fixed );
128 void setMapPosition(
const QgsPointXY &position );
157 void setRelativePosition( QPointF position );
164 Q_DECL_DEPRECATED
void setFrameOffsetFromReferencePoint( QPointF offset )
SIP_DEPRECATED;
171 Q_DECL_DEPRECATED QPointF frameOffsetFromReferencePoint() const
SIP_DEPRECATED;
178 void setFrameOffsetFromReferencePointMm( QPointF offset );
185 QPointF frameOffsetFromReferencePointMm()
const {
return mOffsetFromReferencePoint; }
193 Q_DECL_DEPRECATED
void setFrameSize( QSizeF size )
SIP_DEPRECATED;
209 void setFrameSizeMm( QSizeF size );
217 QSizeF frameSizeMm()
const {
return mFrameSize; }
224 void setContentsMargin(
const QgsMargins &margins );
257 virtual void writeXml( QDomElement &elem, QDomDocument &doc,
const QgsReadWriteContext &context )
const = 0;
265 virtual void readXml(
const QDomElement &itemElem,
const QgsReadWriteContext &context ) = 0;
307 virtual void setAssociatedFeature(
const QgsFeature &feature );
323 void appearanceChanged();
334 void mapLayerChanged();
342 virtual void renderAnnotation(
QgsRenderContext &context, QSizeF size )
const = 0;
348 virtual QSizeF minimumFrameSize()
const;
356 void _writeXml( QDomElement &itemElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
377 void updateBalloon();
388 bool mVisible =
true;
391 bool mHasFixedMapPosition =
true;
400 QPointF mRelativePosition;
403 QPointF mOffsetFromReferencePoint = QPointF( 13, -13 );
409 std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
414 std::unique_ptr<QgsFillSymbol> mFillSymbol;
417 int mBalloonSegment = -1;
420 QPointF mBalloonSegmentPoint1;
423 QPointF mBalloonSegmentPoint2;
432 double mSegmentPointWidthMm = 2.64;
436 #endif // QGSANNOTATION_H