Class: QgsAnnotationItem¶
- class qgis.core.QgsAnnotationItem¶
Bases:
sip.wrapper
Abstract base class for annotation items which are drawn with
QgsAnnotationLayers
.New in version 3.16.
QgsAnnotationItem() Constructor for an annotation item.
Methods
Applies an edit
operation
to the item.Returns the bounding box of the item's geographic location, in the parent layer's coordinate reference system.
Returns a clone of the item.
Copies common properties from the base class from an
other
item.Returns item flags.
Returns the nodes for the item, used for editing the item.
Reads common properties from the base class from the given DOM
element
.Reads the item's state from the given DOM
element
.Renders the item to the specified render
context
.Sets the annotation's symbology reference
scale
.Sets whether the annotation item uses a symbology reference scale.
Sets the item's z
index
, which controls the order in which annotation items are rendered in the layer.Returns the annotation's symbology reference scale.
Retrieves the results of a transient (in progress) edit
operation
on the item.Returns a unique (untranslated) string identifying the type of item.
Returns
True
if the annotation item uses a symbology reference scale.Writes common properties from the base class into an XML
element
.Writes the item's state into an XML
element
.Returns the item's z index, which controls the order in which annotation items are rendered in the layer.
- applyEdit(self, operation: QgsAbstractAnnotationItemEditOperation) Qgis.AnnotationItemEditOperationResult ¶
Applies an edit
operation
to the item.New in version 3.22.
- Parameters
operation (QgsAbstractAnnotationItemEditOperation) –
- Return type
- boundingBox(self) QgsRectangle ¶
Returns the bounding box of the item’s geographic location, in the parent layer’s coordinate reference system.
boundingBox(self, context:
QgsRenderContext
) -> QgsRectangle Returns the bounding box of the item’s geographic location, in the parent layer’s coordinate reference system.- Return type
- clone(self) QgsAnnotationItem ¶
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
- Return type
- copyCommonProperties(self, other: QgsAnnotationItem)¶
Copies common properties from the base class from an
other
item.New in version 3.22.
- Parameters
other (QgsAnnotationItem) –
- flags(self) Qgis.AnnotationItemFlags ¶
Returns item flags.
New in version 3.22.
- Return type
- nodes(self) List[QgsAnnotationItemNode] ¶
Returns the nodes for the item, used for editing the item.
New in version 3.22.
- Return type
List[QgsAnnotationItemNode]
- readCommonProperties(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
Reads common properties from the base class from the given DOM
element
.See also
New in version 3.22.
- Parameters
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type
bool
- readXml(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
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
See also
- Parameters
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type
bool
- render(self, context: QgsRenderContext, feedback: QgsFeedback)¶
Renders the item to the specified render
context
.The
feedback
argument can be used to detect render cancellations during expensive render operations.- Parameters
context (QgsRenderContext) –
feedback (QgsFeedback) –
- setSymbologyReferenceScale(self, scale: float)¶
Sets the annotation’s symbology reference
scale
.The reference scale will only be used if
useSymbologyReferenceScale()
returnsTrue
.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
See also
- Parameters
scale (float) –
- setUseSymbologyReferenceScale(self, enabled: bool)¶
Sets whether the annotation item uses a symbology reference scale.
See also
See also
- Parameters
enabled (bool) –
- setZIndex(self, index: int)¶
Sets the item’s z
index
, which controls the order in which annotation items are rendered in the layer.See also
- Parameters
index (int) –
- symbologyReferenceScale(self) float ¶
Returns the annotation’s symbology reference scale.
The reference scale will only be used if
useSymbologyReferenceScale()
returnsTrue
.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
See also
- Return type
float
- transientEditResults(self, operation: QgsAbstractAnnotationItemEditOperation) QgsAnnotationItemEditOperationTransientResults ¶
Retrieves the results of a transient (in progress) edit
operation
on the item.New in version 3.22.
- Parameters
operation (QgsAbstractAnnotationItemEditOperation) –
- Return type
- type(self) str ¶
Returns a unique (untranslated) string identifying the type of item.
- Return type
str
- useSymbologyReferenceScale(self) bool ¶
Returns
True
if the annotation item uses a symbology reference scale.See also
See also
- Return type
bool
- writeCommonProperties(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Writes common properties from the base class into an XML
element
.See also
New in version 3.22.
- Parameters
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool
- writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Writes the item’s state into an XML
element
.Implementations should include a call to
writeCommonProperties()
to store the base class properties.See also
See also
- Parameters
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
bool
- zIndex(self) int ¶
Returns the item’s z index, which controls the order in which annotation items are rendered in the layer.
See also
- Return type
int