QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
18 #ifndef QGSANNOTATION_H
19 #define QGSANNOTATION_H
21 #include "qgis_core.h"
59 sipType = sipType_QgsTextAnnotation;
61 sipType = sipType_QgsSvgAnnotation;
63 sipType = sipType_QgsHtmlAnnotation;
71 Q_PROPERTY(
bool visible READ isVisible WRITE setVisible )
72 Q_PROPERTY(
bool hasFixedMapPosition READ hasFixedMapPosition WRITE setHasFixedMapPosition )
73 Q_PROPERTY(
QgsPointXY mapPosition READ mapPosition WRITE setMapPosition )
74 Q_PROPERTY( QSizeF frameSize READ frameSize WRITE setFrameSize )
95 bool isVisible()
const {
return mVisible; }
101 void setVisible(
bool visible );
118 void setHasFixedMapPosition(
bool fixed );
134 void setMapPosition(
const QgsPointXY &position );
163 void setRelativePosition( QPointF position );
170 Q_DECL_DEPRECATED
void setFrameOffsetFromReferencePoint( QPointF offset )
SIP_DEPRECATED;
177 Q_DECL_DEPRECATED QPointF frameOffsetFromReferencePoint() const
SIP_DEPRECATED;
184 void setFrameOffsetFromReferencePointMm( QPointF offset );
191 QPointF frameOffsetFromReferencePointMm()
const {
return mOffsetFromReferencePoint; }
199 Q_DECL_DEPRECATED
void setFrameSize( QSizeF size )
SIP_DEPRECATED;
215 void setFrameSizeMm( QSizeF size );
223 QSizeF frameSizeMm()
const {
return mFrameSize; }
230 void setContentsMargin(
const QgsMargins &margins );
263 virtual void writeXml( QDomElement &elem, QDomDocument &doc,
const QgsReadWriteContext &context )
const = 0;
271 virtual void readXml(
const QDomElement &itemElem,
const QgsReadWriteContext &context ) = 0;
313 virtual void setAssociatedFeature(
const QgsFeature &feature );
329 void appearanceChanged();
340 void mapLayerChanged();
348 virtual void renderAnnotation(
QgsRenderContext &context, QSizeF size )
const = 0;
354 virtual QSizeF minimumFrameSize()
const;
362 void _writeXml( QDomElement &itemElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
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;
423 double mSegmentPointWidthMm = 2.64;
427 #endif // QGSANNOTATION_H
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
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
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.
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.
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. This is the base class for all map layer types (vector,...
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
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 unique ID, geometry and a list of field...
QgsPointXY mapPosition() const
Returns the map position of the annotation, if it is attached to a fixed map position.