18#ifndef QGSANNOTATION_H
19#define QGSANNOTATION_H
58 sipType = sipType_QgsTextAnnotation;
60 sipType = sipType_QgsSvgAnnotation;
62 sipType = sipType_QgsHtmlAnnotation;
100 void setVisible(
bool visible );
117 void setHasFixedMapPosition(
bool fixed );
133 void setMapPosition(
const QgsPointXY &position );
162 void setRelativePosition( QPointF position );
169 Q_DECL_DEPRECATED
void setFrameOffsetFromReferencePoint( QPointF offset )
SIP_DEPRECATED;
176 Q_DECL_DEPRECATED QPointF frameOffsetFromReferencePoint() const
SIP_DEPRECATED;
183 void setFrameOffsetFromReferencePointMm( QPointF offset );
198 Q_DECL_DEPRECATED
void setFrameSize( QSizeF size )
SIP_DEPRECATED;
214 void setFrameSizeMm( QSizeF size );
229 void setContentsMargin(
const QgsMargins &margins );
312 virtual void setAssociatedFeature(
const QgsFeature &feature );
387 bool mVisible =
true;
390 bool mHasFixedMapPosition =
true;
399 QPointF mRelativePosition;
402 QPointF mOffsetFromReferencePoint = QPointF( 13, -13 );
408 std::unique_ptr<QgsMarkerSymbol> mMarkerSymbol;
413 std::unique_ptr<QgsFillSymbol> mFillSymbol;
422 double mSegmentPointWidthMm = 2.64;
void appearanceChanged()
Emitted whenever the annotation's appearance changes.
Q_DECL_DEPRECATED void setFrameSize(QSizeF size)
Sets the size (in pixels) of the annotation's frame (the main area in which the annotation's content ...
QgsMargins contentsMargin() const
Returns the margins (in millimeters) between the outside of the frame and the annotation content.
QgsCoordinateReferenceSystem mapPositionCrs() const
Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map po...
QPointF frameOffsetFromReferencePointMm() const
Returns the annotation's frame's offset (in millimeters) from the mapPosition() reference point.
virtual void renderAnnotation(QgsRenderContext &context, QSizeF size) const =0
Renders the annotation's contents to a target /a context at the specified /a size.
void setMapPosition(const QgsPointXY &position)
Sets the map position of the annotation, if it is attached to a fixed map position.
QgsMarkerSymbol * markerSymbol() const
Returns the symbol that is drawn at the annotation's map position.
void moved()
Emitted when the annotation's position has changed and items need to be moved to reflect this.
void _writeXml(QDomElement &itemElem, QDomDocument &doc, const QgsReadWriteContext &context) const
Writes common annotation properties to a DOM element.
QgsPointXY mapPosition() const
Returns the map position of the annotation, if it is attached to a fixed map position.
QgsMapLayer * mapLayer() const
Returns the map layer associated with the annotation.
bool hasFixedMapPosition() const
Returns true if the annotation is attached to a fixed map position, or false if the annotation uses a...
QgsFeature associatedFeature() const
Returns the feature associated with the annotation, or an invalid feature if none has been set.
void _readXml(const QDomElement &annotationElem, const QgsReadWriteContext &context)
Reads common annotation properties from a DOM element.
void copyCommonProperties(QgsAnnotation *target) const
Copies common annotation properties to the targe annotation.
virtual QSizeF minimumFrameSize() const
Returns the minimum frame size for the annotation.
bool isVisible() const
Returns true if the annotation is visible and should be rendered.
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation's state from a DOM element.
void setHasFixedMapPosition(bool fixed)
Sets whether the annotation is attached to a fixed map position, or uses a position relative to the c...
QgsAnnotation(QObject *parent=nullptr)
Constructor for QgsAnnotation.
void setMarkerSymbol(QgsMarkerSymbol *symbol)
Sets the symbol that is drawn at the annotation's map position.
void setVisible(bool visible)
Sets whether the annotation is visible and should be rendered.
QSizeF frameSizeMm() const
Returns the size (in millimeters) of the annotation's frame (the main area in which the annotation's ...
virtual QgsAnnotation * clone() const =0
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current sta...
QPointF relativePosition() const
Returns the relative position of the annotation, if it is not attached to a fixed map position.
virtual void writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes the annotation state to a DOM element.
void mapLayerChanged()
Emitted when the map layer associated with the annotation changes.
Represents a coordinate reference system (CRS).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
An annotation item that embeds HTML content.
Base class for all map layer types.
Defines the four margins of a rectangle.
A marker symbol type, for rendering Point and MultiPoint geometries.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
An annotation which renders the contents of an SVG file.
An annotation item that displays formatted text from a QTextDocument document.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.