QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
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 )
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 );
307 virtual void setAssociatedFeature(
const QgsFeature &feature );
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
void mapLayerChanged()
Emitted when the map layer associated with the annotation changes.
virtual void writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes the annotation state to a DOM element.
QgsMargins contentsMargin() const
Returns the margins (in millimeters) between the outside of the frame and the annotation content.
The class is used as a container of context for various read/write operations on other objects.
const QgsCoordinateReferenceSystem & crs
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation's state from a DOM element.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g.
virtual void renderAnnotation(QgsRenderContext &context, QSizeF size) const =0
Renders the annotation's contents to a target /a context at the specified /a size.
QgsMapLayer * mapLayer() const
Returns the map layer associated with the annotation.
An annotation which renders the contents of an SVG file.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Abstract base class for annotation items which are drawn over a map.
virtual QgsAnnotation * clone() const =0
Clones the annotation, returning a new copy of the annotation reflecting the annotation's current sta...
QgsFillSymbol * fillSymbol() const
Returns the symbol that is used for rendering the annotation frame.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsFeature associatedFeature() const
Returns the feature associated with the annotation, or an invalid feature if none has been set.
The QgsMargins class defines the four margins of a rectangle.
bool isVisible() const
Returns true if the annotation is visible and should be rendered.
QPointer< QgsMapLayer > QgsWeakMapLayerPointer
Weak pointer for QgsMapLayer.
An annotation item that embeds HTML content.
This class represents a coordinate reference system (CRS).
A class to represent a 2D point.
QgsMarkerSymbol * markerSymbol() const
Returns the symbol that is drawn at the annotation's map position.
An annotation item that displays formatted text from a QTextDocument document.
Base class for all map layer types.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void appearanceChanged()
Emitted whenever the annotation's appearance changes.
QPointF relativePosition() const
Returns the relative position of the annotation, if it is not attached to a fixed map position.
bool hasFixedMapPosition() const
Returns true if the annotation is attached to a fixed map position, or false if the annotation uses a...
QgsCoordinateReferenceSystem mapPositionCrs() const
Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map po...
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QgsPointXY mapPosition() const
Returns the map position of the annotation, if it is attached to a fixed map position.
void moved()
Emitted when the annotation's position has changed and items need to be moved to reflect this.