Class: QgsAnnotationPolygonItem

class qgis.core.QgsAnnotationPolygonItem

Bases: QgsAnnotationItem

An annotation item which renders a fill symbol for a polygon geometry.

Added in version 3.16.

QgsAnnotationPolygonItem(polygon: Optional[QgsCurvePolygon]) Constructor for QgsAnnotationPolygonItem, with the specified polygon geometry.

Methods

applyEdit

param operation:

boundingBox

rtype:

QgsRectangle

clone

rtype:

Optional[QgsAnnotationPolygonItem]

copyCommonProperties

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

create

Creates a new polygon annotation item.

geometry

Returns the geometry of the item.

nodes

rtype:

List[QgsAnnotationItemNode]

readCommonProperties

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

readXml

param element:

render

param context:

setGeometry

Sets the geometry of the item.

setSymbol

Sets the symbol used to render the polygon item.

symbol

Returns the symbol used to render the item.

transientEditResults

param operation:

type

rtype:

str

writeCommonProperties

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

writeXml

param element:

applyEdit(self, operation: QgsAbstractAnnotationItemEditOperation | None) Qgis.AnnotationItemEditOperationResult
Parameters:

operation (Optional[QgsAbstractAnnotationItemEditOperation])

Return type:

Qgis.AnnotationItemEditOperationResult

boundingBox(self) QgsRectangle
Return type:

QgsRectangle

clone(self) QgsAnnotationPolygonItem | None
Return type:

Optional[QgsAnnotationPolygonItem]

copyCommonProperties(self, other: QgsAnnotationItem | None)

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

Added in version 3.22.

create() QgsAnnotationPolygonItem | None

Creates a new polygon annotation item.

Return type:

Optional[QgsAnnotationPolygonItem]

geometry(self) QgsCurvePolygon | None

Returns the geometry of the item.

The coordinate reference system for the polygon will be the parent layer’s QgsAnnotationLayer.crs().

See also

setGeometry()

Return type:

Optional[QgsCurvePolygon]

nodes(self) List[QgsAnnotationItemNode]
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

readXml()

Added in version 3.22.

readXml(self, element: QDomElement, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool

render(self, context: QgsRenderContext, feedback: QgsFeedback | None)
Parameters:
setGeometry(self, geometry: QgsCurvePolygon | None)

Sets the geometry of the item.

The coordinate reference system for the polygon will be the parent layer’s QgsAnnotationLayer.crs().

See also

geometry()

Parameters:

geometry (Optional[QgsCurvePolygon])

setSymbol(self, symbol: QgsFillSymbol | None)

Sets the symbol used to render the polygon item.

The item takes ownership of the symbol.

See also

symbol()

Parameters:

symbol (Optional[QgsFillSymbol])

symbol(self) QgsFillSymbol | None

Returns the symbol used to render the item.

See also

setSymbol()

Return type:

Optional[QgsFillSymbol]

transientEditResults(self, operation: QgsAbstractAnnotationItemEditOperation | None) QgsAnnotationItemEditOperationTransientResults | None
Parameters:

operation (Optional[QgsAbstractAnnotationItemEditOperation])

Return type:

Optional[QgsAnnotationItemEditOperationTransientResults]

type(self) str
Return type:

str

writeCommonProperties(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool

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

See also

writeXml()

Added in version 3.22.

writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool
Parameters:
Return type:

bool