Class: QgsAnnotationLineTextItem¶
- class qgis.core.QgsAnnotationLineTextItem¶
Bases:
QgsAnnotationItem
An annotation item which renders text along a line geometry.
New in version 3.32.
QgsAnnotationLineTextItem(text: str, curve:
QgsCurve
) Constructor forQgsAnnotationLineTextItem
, with the specifiedcurve
andtext
.Methods
- param operation:
- rtype:
QgsRectangle
- rtype:
QgsAnnotationLineTextItem
Copies common properties from the base class from an
other
item.Creates a new linestring annotation item.
- rtype:
Qgis.AnnotationItemFlags
Returns the text format used to render the text.
Returns the geometry of the item.
- rtype:
List[QgsAnnotationItemNode]
Returns the offset distance from the line
geometry()
to the text's baseline.Returns the map unit scale for the offset from line
geometry()
distance.Returns the units for the offset from line
geometry()
distance.Reads common properties from the base class from the given DOM
element
.- param element:
- param context:
Sets the text
format
used to render the text.Sets the
geometry
of the item.Sets the offset
distance
from the linegeometry()
to the text's baseline.Sets the map unit
scale
for the offset from linegeometry()
distance.Sets the
unit
for the offset from linegeometry()
distance.Sets the
text
rendered by the item.Returns the text rendered by the item.
- param operation:
- rtype:
str
Writes common properties from the base class into an XML
element
.- param element:
- applyEdit(self, operation: QgsAbstractAnnotationItemEditOperation) Qgis.AnnotationItemEditOperationResult ¶
- Parameters:
operation (QgsAbstractAnnotationItemEditOperation) –
- Return type:
- boundingBox(self) QgsRectangle ¶
- boundingBox(self, context: QgsRenderContext) QgsRectangle
- Return type:
- clone(self) QgsAnnotationLineTextItem ¶
- Return type:
- copyCommonProperties(self, other: QgsAnnotationItem)¶
Copies common properties from the base class from an
other
item.New in version 3.22.
- create() QgsAnnotationLineTextItem ¶
Creates a new linestring annotation item.
- Return type:
- flags(self) Qgis.AnnotationItemFlags ¶
- Return type:
- format(self) QgsTextFormat ¶
Returns the text format used to render the text.
See also
- Return type:
- geometry(self) QgsCurve ¶
Returns the geometry of the item.
The coordinate reference system for the line will be the parent layer’s
QgsAnnotationLayer.crs()
.See also
- Return type:
- nodes(self) List[QgsAnnotationItemNode] ¶
- Return type:
List[QgsAnnotationItemNode]
- offsetFromLine(self) float ¶
Returns the offset distance from the line
geometry()
to the text’s baseline. Units are specified throughoffsetFromLineUnit()
.See also
See also
- Return type:
float
- offsetFromLineMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the offset from line
geometry()
distance.See also
See also
See also
- Return type:
- offsetFromLineUnit(self) Qgis.RenderUnit ¶
Returns the units for the offset from line
geometry()
distance.See also
See also
- Return type:
- 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.
- readXml(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
- Parameters:
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type:
bool
- render(self, context: QgsRenderContext, feedback: QgsFeedback)¶
- Parameters:
context (QgsRenderContext) –
feedback (QgsFeedback) –
- setFormat(self, format: QgsTextFormat)¶
Sets the text
format
used to render the text.See also
- Parameters:
format (QgsTextFormat) –
- setGeometry(self, geometry: QgsCurve)¶
Sets the
geometry
of the item. Ownership ofgeometry
is transferred.The coordinate reference system for the line will be the parent layer’s
QgsAnnotationLayer.crs()
.See also
- Parameters:
geometry (QgsCurve) –
- setOffsetFromLine(self, distance: float)¶
Sets the offset
distance
from the linegeometry()
to the text’s baseline. Units are specified throughsetOffsetFromLineUnit()
.See also
See also
- Parameters:
distance (float) –
- setOffsetFromLineMapUnitScale(self, scale: QgsMapUnitScale)¶
Sets the map unit
scale
for the offset from linegeometry()
distance.See also
See also
See also
- Parameters:
scale (QgsMapUnitScale) –
- setOffsetFromLineUnit(self, unit: Qgis.RenderUnit)¶
Sets the
unit
for the offset from linegeometry()
distance.See also
See also
- Parameters:
unit (Qgis.RenderUnit) –
- setText(self, text: str)¶
Sets the
text
rendered by the item.See also
- Parameters:
text (str) –
- transientEditResults(self, operation: QgsAbstractAnnotationItemEditOperation) QgsAnnotationItemEditOperationTransientResults ¶
- Parameters:
operation (QgsAbstractAnnotationItemEditOperation) –
- Return type:
- 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
New in version 3.22.
- writeXml(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool ¶
- Parameters:
element (QDomElement) –
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
bool