Class: QgsLabelPosition¶
Represents the calculated placement of a map label.
Attributes
ID of feature associated with this label. |
|
If non zero, indicates that the label position is part of a group of label positions (i.e. a character in a curved label). |
|
Heeght of label bounding box, in map units. |
|
|
|
|
|
|
|
Font which the label is rendered using. |
|
A polygon geometry representing the label's bounds in map coordinates. |
|
String shown in label. |
|
ID of associated map layer. |
|
ID of the associated label provider. |
|
Rotation of label, in degrees clockwise. |
|
|
|
Width of label bounding box, in map units. |
- class qgis.core.QgsLabelPosition[source]¶
Bases:
object
- __init__(id: int, r: float, corners: Iterable[QgsPointXY], rect: QgsRectangle, w: float, h: float, layer: str | None, labeltext: str | None, labelfont: QFont, upside_down: bool, diagram: bool = False, pinned: bool = False, providerId: str | None = '', labelGeometry: QgsGeometry = QgsGeometry(), isUnplaced: bool = False)
Constructor for QgsLabelPosition.
- Parameters:
id (int) – associated feature ID
r (float) – label rotation in degrees clockwise
corners (Iterable[QgsPointXY]) – corner points of label bounding box, in map units
rect (QgsRectangle) – label bounding box, in map units
w (float) – width of label, in map units
h (float) – height of label, in map units
layer (Optional[str]) – ID of associated map layer
labeltext (Optional[str]) – text rendered for label
labelfont (QFont) – font used to render label
upside_down (bool) –
True
if label is upside downdiagram (bool = False) –
True
if label is a diagrampinned (bool = False) –
True
if label has pinned placementproviderId (Optional[str] = '') – ID of associated label provider
labelGeometry (
QgsGeometry
= QgsGeometry()) – polygon geometry of label boundaryisUnplaced (bool = False) – set to
True
if label was unplaced (e.g. due to collisions with other labels)
- __init__()
- __init__(a0: QgsLabelPosition)
- Parameters:
a0 (QgsLabelPosition)
- cornerPoints¶
- featureId: QgsFeatureId¶
ID of feature associated with this label.
- groupedLabelId: int¶
If non zero, indicates that the label position is part of a group of label positions (i.e. a character in a curved label).
All other linked positions will share the same groupedLabelId.
- height: float¶
Heeght of label bounding box, in map units.
- isDiagram: bool¶
True
if label is a diagram.
- isPinned: bool¶
True
if label position has been pinned.
- isUnplaced: bool¶
True
if label position corresponds to an unplaced label.Added in version 3.10.
- labelFont: QFont¶
Font which the label is rendered using.
- labelGeometry: QgsGeometry¶
A polygon geometry representing the label’s bounds in map coordinates.
Added in version 3.4.9.
- labelRect¶
- labelText: str¶
String shown in label.
- layerID: str¶
ID of associated map layer.
- providerID: str¶
ID of the associated label provider.
- rotation: float¶
Rotation of label, in degrees clockwise.
- upsideDown: bool¶
True
if label is upside down.
- width: float¶
Width of label bounding box, in map units.