18 #ifndef QGSANNOTATION_H 19 #define QGSANNOTATION_H 21 #include "qgis_core.h" 53 if ( dynamic_cast< QgsTextAnnotation * >( sipCpp ) )
54 sipType = sipType_QgsTextAnnotation;
55 else if ( dynamic_cast< QgsSvgAnnotation * >( sipCpp ) )
56 sipType = sipType_QgsSvgAnnotation;
57 else if ( dynamic_cast< QgsHtmlAnnotation * >( sipCpp ) )
58 sipType = sipType_QgsHtmlAnnotation;
66 Q_PROPERTY(
bool visible READ isVisible WRITE setVisible )
67 Q_PROPERTY(
bool hasFixedMapPosition READ hasFixedMapPosition WRITE setHasFixedMapPosition )
68 Q_PROPERTY(
QgsPointXY mapPosition READ mapPosition WRITE setMapPosition )
69 Q_PROPERTY( QSizeF frameSize READ frameSize WRITE setFrameSize )
88 bool isVisible()
const {
return mVisible; }
94 void setVisible(
bool visible );
111 void setHasFixedMapPosition(
bool fixed );
127 void setMapPosition(
const QgsPointXY &position );
156 void setRelativePosition( QPointF position );
163 Q_DECL_DEPRECATED
void setFrameOffsetFromReferencePoint( QPointF offset )
SIP_DEPRECATED;
170 Q_DECL_DEPRECATED QPointF frameOffsetFromReferencePoint()
const SIP_DEPRECATED;
177 void setFrameOffsetFromReferencePointMm( QPointF offset );
192 Q_DECL_DEPRECATED
void setFrameSize( QSizeF size )
SIP_DEPRECATED;
208 void setFrameSizeMm( QSizeF size );
223 void setContentsMargin(
const QgsMargins &margins );
256 virtual void writeXml( QDomElement &elem, QDomDocument &doc,
const QgsReadWriteContext &context )
const = 0;
264 virtual void readXml(
const QDomElement &itemElem,
const QgsReadWriteContext &context ) = 0;
306 virtual void setAssociatedFeature(
const QgsFeature &feature );
311 void appearanceChanged();
322 void mapLayerChanged();
330 virtual void renderAnnotation(
QgsRenderContext &context, QSizeF size )
const = 0;
336 virtual QSizeF minimumFrameSize()
const;
344 void _writeXml( QDomElement &itemElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
365 void updateBalloon();
376 bool mVisible =
true;
379 bool mHasFixedMapPosition =
true;
388 QPointF mRelativePosition;
391 QPointF mOffsetFromReferencePoint = QPointF( 13, -13 );
397 std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
402 std::unique_ptr<QgsFillSymbol> mFillSymbol;
405 int mBalloonSegment = -1;
408 QPointF mBalloonSegmentPoint1;
411 QPointF mBalloonSegmentPoint2;
420 double mSegmentPointWidthMm = 2.64;
424 #endif // QGSANNOTATION_H QgsFillSymbol * fillSymbol() const
Returns the symbol that is used for rendering the annotation frame.
The class is used as a container of context for various read/write operations on other objects...
Base class for all map layer types.
QPointF frameOffsetFromReferencePointMm() const
Returns the annotation's frame's offset (in millimeters) from the mapPosition() reference point...
QgsCoordinateReferenceSystem mapPositionCrs() const
Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map po...
QgsFeature associatedFeature() const
Returns the feature associated with the annotation, or an invalid feature if none has been set...
A class to represent a 2D point.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
const QgsCoordinateReferenceSystem & crs
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
A marker symbol type, for rendering Point and MultiPoint geometries.
Abstract base class for annotation items which are drawn over a map.
QgsPointXY mapPosition() const
Returns the map position of the annotation, if it is attached to a fixed map position.
QPointF relativePosition() const
Returns the relative position of the annotation, if it is not attached to a fixed map position...
Contains information about the context of a rendering operation.
QgsMargins contentsMargin() const
Returns the margins (in millimeters) between the outside of the frame and the annotation content...
This class represents a coordinate reference system (CRS).
QgsMarkerSymbol * markerSymbol() const
Returns the symbol that is drawn at the annotation's map position.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QgsMapLayer * mapLayer() const
Returns the map layer associated with the annotation.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
bool hasFixedMapPosition() const
Returns true if the annotation is attached to a fixed map position, or false if the annotation uses a...
The QgsMargins class defines the four margins of a rectangle.
QSizeF frameSizeMm() const
Returns the size (in millimeters) of the annotation's frame (the main area in which the annotation's ...