Class: QgsPalLabeling¶
-
class
qgis.core.
QgsPalLabeling
¶ Bases:
sip.wrapper
QgsPalLabeling(QgsPalLabeling)
Enums
Methods
Checks whether a geometry requires preparation before registration with PAL
Prepares a geometry for registration with PAL.
Splits a text string to a list of graphemes, which are the smallest allowable character divisions in the string.
Splits a
text
string to a list of separate lines, using a specified wrap character (wrapCharacter
).called to find out whether the layer is used for labeling
Signals
Attributes
-
geometryRequiresPreparation
(geometry: QgsGeometry, context: QgsRenderContext, ct: QgsCoordinateTransform, clipGeometry: QgsGeometry = QgsGeometry(), mergeLines: bool = False) → bool¶ Checks whether a geometry requires preparation before registration with PAL
- Parameters
geometry – geometry to prepare
context – render context
ct – coordinate transform, or invalid transform if no transformation required
clipGeometry – geometry to clip features to, if applicable
mergeLines –
True
if touching lines from this layer will be merged and treated as single features during labeling
- Returns
True
if geometry requires preparation
New in version 2.9.
-
prepareGeometry
(geometry: QgsGeometry, context: QgsRenderContext, ct: QgsCoordinateTransform, clipGeometry: QgsGeometry = QgsGeometry(), mergeLines: bool = False) → QgsGeometry¶ Prepares a geometry for registration with PAL. Handles reprojection, rotation, clipping, etc.
- Parameters
geometry – geometry to prepare
context – render context
ct – coordinate transform, or invalid transform if no transformation required
clipGeometry – geometry to clip features to, if applicable
mergeLines –
True
if touching lines from this layer will be merged and treated as single features during labeling
- Returns
prepared geometry
New in version 2.9.
-
splitToGraphemes
(text: str) → List[str]¶ Splits a text string to a list of graphemes, which are the smallest allowable character divisions in the string. This accounts for scripts were individual characters are not allowed to be split apart (e.g., Arabic and Indic based scripts)
- Parameters
text – string to split
- Returns
list of graphemes
New in version 2.10.
-
splitToLines
(text: str, wrapCharacter: str, autoWrapLength: int = 0, useMaxLineLengthWhenAutoWrapping: bool = True) → List[str]¶ Splits a
text
string to a list of separate lines, using a specified wrap character (wrapCharacter
). The text string will be split on either newline characters or the wrap character.Since QGIS 3.4 the
autoWrapLength
argument can be used to specify an ideal length of line to automatically wrap text to (automatic wrapping is disabled ifautoWrapLength
is 0). This automatic wrapping is performed after processing wrapping usingwrapCharacter
. When auto wrapping is enabled, theuseMaxLineLengthWhenAutoWrapping
argument controls whether the lines should be wrapped to an ideal maximum ofautoWrapLength
characters, or ifFalse
then the lines are wrapped to an ideal minimum length ofautoWrapLength
characters.New in version 2.9.
-
staticWillUseLayer
(layer: QgsVectorLayer) → bool¶ called to find out whether the layer is used for labeling
New in version 2.4.
-