QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Abstract base class for annotation items which are drawn with QgsAnnotationLayers. More...
#include <qgsannotationitem.h>
Public Member Functions | |
QgsAnnotationItem () | |
QgsAnnotationItem (const QgsAnnotationItem &other)=delete | |
virtual | ~QgsAnnotationItem () |
virtual Q_DECL_DEPRECATED Qgis::AnnotationItemEditOperationResult | applyEdit (QgsAbstractAnnotationItemEditOperation *operation) |
Applies an edit operation to the item. | |
virtual Qgis::AnnotationItemEditOperationResult | applyEditV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) |
Applies an edit operation to the item. | |
virtual QgsRectangle | boundingBox () const =0 |
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system. | |
virtual QgsRectangle | boundingBox (QgsRenderContext &context) const |
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system. | |
QgsCallout * | callout () const |
Returns the item's callout renderer, responsible for drawing item callouts. | |
QgsGeometry | calloutAnchor () const |
Returns the callout's anchor geometry. | |
virtual QgsAnnotationItem * | clone () const =0 |
Returns a clone of the item. | |
bool | enabled () const |
Returns true if the item is enabled and will be rendered in the layer. | |
virtual Qgis::AnnotationItemFlags | flags () const |
Returns item flags. | |
virtual Q_DECL_DEPRECATED QList< QgsAnnotationItemNode > | nodes () const |
Returns the nodes for the item, used for editing the item. | |
virtual QList< QgsAnnotationItemNode > | nodesV2 (const QgsAnnotationItemEditContext &context) const |
Returns the nodes for the item, used for editing the item. | |
QSizeF | offsetFromCallout () const |
Returns the (optional) offset of the annotation item from the calloutAnchor(). | |
Qgis::RenderUnit | offsetFromCalloutUnit () const |
Returns the units for the offsetFromCallout(). | |
QgsAnnotationItem & | operator= (const QgsAnnotationItem &other)=delete |
virtual bool | readXml (const QDomElement &element, const QgsReadWriteContext &context)=0 |
Reads the item's state from the given DOM element. | |
virtual void | render (QgsRenderContext &context, QgsFeedback *feedback)=0 |
Renders the item to the specified render context. | |
void | setCallout (QgsCallout *callout) |
Sets the item's callout renderer, responsible for drawing item callouts. | |
void | setCalloutAnchor (const QgsGeometry &anchor) |
Sets the callout's anchor geometry. | |
void | setEnabled (bool enabled) |
Sets if the item will be rendered or not in the layer. | |
void | setOffsetFromCallout (const QSizeF &offset) |
Sets the offset of the annotation item from the calloutAnchor(). | |
void | setOffsetFromCalloutUnit (Qgis::RenderUnit unit) |
Sets the unit for the offsetFromCallout(). | |
void | setSymbologyReferenceScale (double scale) |
Sets the annotation's symbology reference scale. | |
void | setUseSymbologyReferenceScale (bool enabled) |
Sets whether the annotation item uses a symbology reference scale. | |
void | setZIndex (int index) |
Sets the item's z index, which controls the order in which annotation items are rendered in the layer. | |
double | symbologyReferenceScale () const |
Returns the annotation's symbology reference scale. | |
virtual Q_DECL_DEPRECATED QgsAnnotationItemEditOperationTransientResults * | transientEditResults (QgsAbstractAnnotationItemEditOperation *operation) |
Retrieves the results of a transient (in progress) edit operation on the item. | |
virtual QgsAnnotationItemEditOperationTransientResults * | transientEditResultsV2 (QgsAbstractAnnotationItemEditOperation *operation, const QgsAnnotationItemEditContext &context) |
Retrieves the results of a transient (in progress) edit operation on the item. | |
virtual QString | type () const =0 |
Returns a unique (untranslated) string identifying the type of item. | |
bool | useSymbologyReferenceScale () const |
Returns true if the annotation item uses a symbology reference scale. | |
virtual bool | writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0 |
Writes the item's state into an XML element. | |
int | zIndex () const |
Returns the item's z index, which controls the order in which annotation items are rendered in the layer. | |
Protected Member Functions | |
virtual void | copyCommonProperties (const QgsAnnotationItem *other) |
Copies common properties from the base class from an other item. | |
virtual bool | readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context) |
Reads common properties from the base class from the given DOM element. | |
void | renderCallout (QgsRenderContext &context, const QRectF &rect, double angle, QgsCallout::QgsCalloutContext &calloutContext, QgsFeedback *feedback) |
Renders the item's callout. | |
virtual bool | writeCommonProperties (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const |
Writes common properties from the base class into an XML element. | |
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
Definition at line 43 of file qgsannotationitem.h.
|
default |
|
delete |
|
virtualdefault |
|
virtual |
Applies an edit operation to the item.
Definition at line 35 of file qgsannotationitem.cpp.
|
virtual |
Applies an edit operation to the item.
Reimplemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectItem.
Definition at line 40 of file qgsannotationitem.cpp.
|
pure virtual |
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectItem.
|
inlinevirtual |
Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
Reimplemented in QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationRectItem.
Definition at line 123 of file qgsannotationitem.h.
QgsCallout * QgsAnnotationItem::callout | ( | ) | const |
Returns the item's callout renderer, responsible for drawing item callouts.
Ownership is not transferred.
By default items do not have a callout, and it is necessary to be explicitly set a callout style (via setCallout() ) and set the callout anchor geometry (via set setCalloutAnchor() ).
Definition at line 71 of file qgsannotationitem.cpp.
QgsGeometry QgsAnnotationItem::calloutAnchor | ( | ) | const |
Returns the callout's anchor geometry.
The anchor dictates the geometry which the option item callout() should connect to. Depending on the callout subclass and anchor geometry type, the actual shape of the rendered callout may vary.
The callout anchor geometry is in the parent layer's coordinate reference system.
Definition at line 81 of file qgsannotationitem.cpp.
|
pure virtual |
Returns a clone of the item.
Ownership is transferred to the caller.
Implementations should include a call to copyCommonProperties() to copy the base class properties.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPictureItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectangleTextItem.
|
protectedvirtual |
Copies common properties from the base class from an other item.
Reimplemented in QgsAnnotationRectItem.
Definition at line 91 of file qgsannotationitem.cpp.
|
inline |
Returns true
if the item is enabled and will be rendered in the layer.
Definition at line 203 of file qgsannotationitem.h.
|
virtual |
Returns item flags.
Reimplemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, QgsAnnotationRectangleTextItem, and QgsAnnotationRectItem.
Definition at line 30 of file qgsannotationitem.cpp.
|
virtual |
Returns the nodes for the item, used for editing the item.
Definition at line 59 of file qgsannotationitem.cpp.
|
virtual |
Returns the nodes for the item, used for editing the item.
Reimplemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectItem.
Definition at line 64 of file qgsannotationitem.cpp.
QSizeF QgsAnnotationItem::offsetFromCallout | ( | ) | const |
Returns the (optional) offset of the annotation item from the calloutAnchor().
Some annotation item subclasses support placement relative to the callout anchor. For these items, the offset from callout defines how far (in screen/page units) the item should be placed from the anchor point.
Units are defined by offsetFromCalloutUnit()
Definition at line 196 of file qgsannotationitem.cpp.
Qgis::RenderUnit QgsAnnotationItem::offsetFromCalloutUnit | ( | ) | const |
Returns the units for the offsetFromCallout().
Definition at line 186 of file qgsannotationitem.cpp.
|
delete |
|
protectedvirtual |
Reads common properties from the base class from the given DOM element.
Reimplemented in QgsAnnotationRectItem.
Definition at line 130 of file qgsannotationitem.cpp.
|
pure virtual |
Reads the item's state from the given DOM element.
Implementations should include a call to readCommonProperties() to read the base class properties.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPictureItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectangleTextItem.
|
pure virtual |
Renders the item to the specified render context.
The feedback argument can be used to detect render cancellations during expensive render operations.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectItem.
|
protected |
Renders the item's callout.
The item must have valid callout() set.
Definition at line 161 of file qgsannotationitem.cpp.
void QgsAnnotationItem::setCallout | ( | QgsCallout * | callout | ) |
Sets the item's callout renderer, responsible for drawing item callouts.
Ownership of callout is transferred to the item.
Definition at line 76 of file qgsannotationitem.cpp.
void QgsAnnotationItem::setCalloutAnchor | ( | const QgsGeometry & | anchor | ) |
Sets the callout's anchor geometry.
The anchor dictates the geometry which the option item callout() should connect to. Depending on the callout subclass and anchor geometry type, the actual shape of the rendered callout may vary.
The callout anchor geometry must be specified in the parent layer's coordinate reference system.
Definition at line 86 of file qgsannotationitem.cpp.
|
inline |
Sets if the item will be rendered or not in the layer.
Definition at line 211 of file qgsannotationitem.h.
void QgsAnnotationItem::setOffsetFromCallout | ( | const QSizeF & | offset | ) |
Sets the offset of the annotation item from the calloutAnchor().
Some annotation item subclasses support placement relative to the callout anchor. For these items, the offset from callout defines how far (in screen/page units) the item should be placed from the anchor point.
Units are defined by offsetFromCalloutUnit()
Definition at line 201 of file qgsannotationitem.cpp.
void QgsAnnotationItem::setOffsetFromCalloutUnit | ( | Qgis::RenderUnit | unit | ) |
Sets the unit for the offsetFromCallout().
Definition at line 191 of file qgsannotationitem.cpp.
|
inline |
Sets the annotation's symbology reference scale.
The reference scale will only be used if useSymbologyReferenceScale() returns true
.
This represents the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render.
The symbology reference scale is an optional property which specifies the reference scale at which symbology in paper units (such a millimeters or points) is fixed to. For instance, if the scale is 1000 then a 2mm thick line will be rendered at exactly 2mm thick when a map is rendered at 1:1000, or 1mm thick when rendered at 1:2000, or 4mm thick at 1:500.
Definition at line 275 of file qgsannotationitem.h.
|
inline |
Sets whether the annotation item uses a symbology reference scale.
Definition at line 241 of file qgsannotationitem.h.
|
inline |
Sets the item's z index, which controls the order in which annotation items are rendered in the layer.
Definition at line 195 of file qgsannotationitem.h.
|
inline |
Returns the annotation's symbology reference scale.
The reference scale will only be used if useSymbologyReferenceScale() returns true
.
This represents the desired scale denominator for the rendered map, eg 1000.0 for a 1:1000 map render.
The symbology reference scale is an optional property which specifies the reference scale at which symbology in paper units (such a millimeters or points) is fixed to. For instance, if the scale is 1000 then a 2mm thick line will be rendered at exactly 2mm thick when a map is rendered at 1:1000, or 1mm thick when rendered at 1:2000, or 4mm thick at 1:500.
Definition at line 258 of file qgsannotationitem.h.
|
virtual |
Retrieves the results of a transient (in progress) edit operation on the item.
Definition at line 47 of file qgsannotationitem.cpp.
|
virtual |
Retrieves the results of a transient (in progress) edit operation on the item.
Reimplemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectItem.
Definition at line 52 of file qgsannotationitem.cpp.
|
pure virtual |
Returns a unique (untranslated) string identifying the type of item.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPictureItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectangleTextItem.
|
inline |
Returns true
if the annotation item uses a symbology reference scale.
Definition at line 233 of file qgsannotationitem.h.
|
protectedvirtual |
Writes common properties from the base class into an XML element.
Reimplemented in QgsAnnotationRectItem.
Definition at line 106 of file qgsannotationitem.cpp.
|
pure virtual |
Writes the item's state into an XML element.
Implementations should include a call to writeCommonProperties() to store the base class properties.
Implemented in QgsAnnotationLineItem, QgsAnnotationLineTextItem, QgsAnnotationMarkerItem, QgsAnnotationPictureItem, QgsAnnotationPointTextItem, QgsAnnotationPolygonItem, and QgsAnnotationRectangleTextItem.
|
inline |
Returns the item's z index, which controls the order in which annotation items are rendered in the layer.
Definition at line 187 of file qgsannotationitem.h.