QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Member Functions | Protected Member Functions | List of all members
QgsAnnotationItem Class Referenceabstract

Abstract base class for annotation items which are drawn with QgsAnnotationLayers. More...

#include <qgsannotationitem.h>

Inheritance diagram for QgsAnnotationItem:
Inheritance graph
[legend]

Public Member Functions

 QgsAnnotationItem ()=default
 Constructor for an annotation item. More...
 
 QgsAnnotationItem (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied. More...
 
virtual ~QgsAnnotationItem ()=default
 
virtual Qgis::AnnotationItemEditOperationResult applyEdit (QgsAbstractAnnotationItemEditOperation *operation)
 Applies an edit operation to the item. More...
 
virtual QgsRectangle boundingBox () const =0
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system. More...
 
virtual QgsRectangle boundingBox (QgsRenderContext &context) const
 Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system. More...
 
virtual QgsAnnotationItemclone ()=0
 Returns a clone of the item. More...
 
virtual Qgis::AnnotationItemFlags flags () const
 Returns item flags. More...
 
virtual QList< QgsAnnotationItemNodenodes () const
 Returns the nodes for the item, used for editing the item. More...
 
QgsAnnotationItemoperator= (const QgsAnnotationItem &other)=delete
 QgsAnnotationItem cannot be copied. More...
 
virtual bool readXml (const QDomElement &element, const QgsReadWriteContext &context)=0
 Reads the item's state from the given DOM element. More...
 
virtual void render (QgsRenderContext &context, QgsFeedback *feedback)=0
 Renders the item to the specified render context. More...
 
void setSymbologyReferenceScale (double scale)
 Sets the annotation's symbology reference scale. More...
 
void setUseSymbologyReferenceScale (bool enabled)
 Sets whether the annotation item uses a symbology reference scale. More...
 
void setZIndex (int index)
 Sets the item's z index, which controls the order in which annotation items are rendered in the layer. More...
 
double symbologyReferenceScale () const
 Returns the annotation's symbology reference scale. More...
 
virtual QgsAnnotationItemEditOperationTransientResultstransientEditResults (QgsAbstractAnnotationItemEditOperation *operation)
 Retrieves the results of a transient (in progress) edit operation on the item. More...
 
virtual QString type () const =0
 Returns a unique (untranslated) string identifying the type of item. More...
 
bool useSymbologyReferenceScale () const
 Returns true if the annotation item uses a symbology reference scale. More...
 
virtual bool writeXml (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0
 Writes the item's state into an XML element. More...
 
int zIndex () const
 Returns the item's z index, which controls the order in which annotation items are rendered in the layer. More...
 

Protected Member Functions

void copyCommonProperties (const QgsAnnotationItem *other)
 Copies common properties from the base class from an other item. More...
 
bool readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context)
 Reads common properties from the base class from the given DOM element. More...
 
bool writeCommonProperties (QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
 Writes common properties from the base class into an XML element. More...
 

Detailed Description

Abstract base class for annotation items which are drawn with QgsAnnotationLayers.

Since
QGIS 3.16

Definition at line 42 of file qgsannotationitem.h.

Constructor & Destructor Documentation

◆ QgsAnnotationItem() [1/2]

QgsAnnotationItem::QgsAnnotationItem ( )
default

Constructor for an annotation item.

◆ QgsAnnotationItem() [2/2]

QgsAnnotationItem::QgsAnnotationItem ( const QgsAnnotationItem other)
delete

QgsAnnotationItem cannot be copied.

◆ ~QgsAnnotationItem()

virtual QgsAnnotationItem::~QgsAnnotationItem ( )
virtualdefault

Member Function Documentation

◆ applyEdit()

Qgis::AnnotationItemEditOperationResult QgsAnnotationItem::applyEdit ( QgsAbstractAnnotationItemEditOperation operation)
virtual

Applies an edit operation to the item.

Since
QGIS 3.22

Reimplemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

Definition at line 26 of file qgsannotationitem.cpp.

◆ boundingBox() [1/2]

virtual QgsRectangle QgsAnnotationItem::boundingBox ( ) const
pure virtual

Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.

Implemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ boundingBox() [2/2]

virtual QgsRectangle QgsAnnotationItem::boundingBox ( QgsRenderContext context) const
inlinevirtual

Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.

Reimplemented in QgsAnnotationMarkerItem, and QgsAnnotationPointTextItem.

Definition at line 115 of file qgsannotationitem.h.

◆ clone()

virtual QgsAnnotationItem * QgsAnnotationItem::clone ( )
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.

See also
copyCommonProperties()

Implemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ copyCommonProperties()

void QgsAnnotationItem::copyCommonProperties ( const QgsAnnotationItem other)
protected

Copies common properties from the base class from an other item.

Since
QGIS 3.22

Definition at line 41 of file qgsannotationitem.cpp.

◆ flags()

Qgis::AnnotationItemFlags QgsAnnotationItem::flags ( ) const
virtual

Returns item flags.

Since
QGIS 3.22

Reimplemented in QgsAnnotationMarkerItem, and QgsAnnotationPointTextItem.

Definition at line 21 of file qgsannotationitem.cpp.

◆ nodes()

QList< QgsAnnotationItemNode > QgsAnnotationItem::nodes ( ) const
virtual

Returns the nodes for the item, used for editing the item.

Since
QGIS 3.22

Reimplemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

Definition at line 36 of file qgsannotationitem.cpp.

◆ operator=()

QgsAnnotationItem & QgsAnnotationItem::operator= ( const QgsAnnotationItem other)
delete

QgsAnnotationItem cannot be copied.

◆ readCommonProperties()

bool QgsAnnotationItem::readCommonProperties ( const QDomElement &  element,
const QgsReadWriteContext context 
)
protected

Reads common properties from the base class from the given DOM element.

See also
readXml()
Since
QGIS 3.22

Definition at line 56 of file qgsannotationitem.cpp.

◆ readXml()

virtual bool QgsAnnotationItem::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)
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.

See also
writeXml()
readCommonProperties()

Implemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ render()

virtual void QgsAnnotationItem::render ( QgsRenderContext context,
QgsFeedback feedback 
)
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, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ setSymbologyReferenceScale()

void QgsAnnotationItem::setSymbologyReferenceScale ( double  scale)
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.

See also
symbologyReferenceScale()
setUseSymbologyReferenceScale()

Definition at line 230 of file qgsannotationitem.h.

◆ setUseSymbologyReferenceScale()

void QgsAnnotationItem::setUseSymbologyReferenceScale ( bool  enabled)
inline

Sets whether the annotation item uses a symbology reference scale.

See also
useSymbologyReferenceScale()
setSymbologyReferenceScale()

Definition at line 196 of file qgsannotationitem.h.

◆ setZIndex()

void QgsAnnotationItem::setZIndex ( int  index)
inline

Sets the item's z index, which controls the order in which annotation items are rendered in the layer.

See also
zIndex()

Definition at line 173 of file qgsannotationitem.h.

◆ symbologyReferenceScale()

double QgsAnnotationItem::symbologyReferenceScale ( ) const
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.

See also
setSymbologyReferenceScale()
useSymbologyReferenceScale()

Definition at line 213 of file qgsannotationitem.h.

◆ transientEditResults()

QgsAnnotationItemEditOperationTransientResults * QgsAnnotationItem::transientEditResults ( QgsAbstractAnnotationItemEditOperation operation)
virtual

Retrieves the results of a transient (in progress) edit operation on the item.

Since
QGIS 3.22

Reimplemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

Definition at line 31 of file qgsannotationitem.cpp.

◆ type()

virtual QString QgsAnnotationItem::type ( ) const
pure virtual

Returns a unique (untranslated) string identifying the type of item.

Implemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ useSymbologyReferenceScale()

bool QgsAnnotationItem::useSymbologyReferenceScale ( ) const
inline

Returns true if the annotation item uses a symbology reference scale.

See also
setUseSymbologyReferenceScale()
symbologyReferenceScale()

Definition at line 188 of file qgsannotationitem.h.

◆ writeCommonProperties()

bool QgsAnnotationItem::writeCommonProperties ( QDomElement &  element,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
protected

Writes common properties from the base class into an XML element.

See also
writeXml()
Since
QGIS 3.22

Definition at line 48 of file qgsannotationitem.cpp.

◆ writeXml()

virtual bool QgsAnnotationItem::writeXml ( QDomElement &  element,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
pure virtual

Writes the item's state into an XML element.

Implementations should include a call to writeCommonProperties() to store the base class properties.

See also
readXml()
writeCommonProperties()

Implemented in QgsAnnotationLineItem, QgsAnnotationMarkerItem, QgsAnnotationPointTextItem, and QgsAnnotationPolygonItem.

◆ zIndex()

int QgsAnnotationItem::zIndex ( ) const
inline

Returns the item's z index, which controls the order in which annotation items are rendered in the layer.

See also
setZIndex()

Definition at line 165 of file qgsannotationitem.h.


The documentation for this class was generated from the following files: