QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Static Public Member Functions | Friends | List of all members
QgsPalLabeling Class Reference

#include <qgspallabeling.h>

Static Public Member Functions

static void drawLabelCandidateRect (pal::LabelPosition *lp, QPainter *painter, const QgsMapToPixel *xform, QList< QgsLabelCandidate > *candidates=nullptr)
 
static bool geometryRequiresPreparation (const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
 Checks whether a geometry requires preparation before registration with PAL. More...
 
static QgsGeometry prepareGeometry (const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, const QgsGeometry &clipGeometry=QgsGeometry(), bool mergeLines=false)
 Prepares a geometry for registration with PAL. More...
 
static QStringList splitToGraphemes (const QString &text)
 Splits a text string to a list of graphemes, which are the smallest allowable character divisions in the string. More...
 
static QStringList splitToLines (const QString &text, const QString &wrapCharacter, int autoWrapLength=0, bool useMaxLineLengthWhenAutoWrapping=true)
 Splits a text string to a list of separate lines, using a specified wrap character (wrapCharacter). More...
 
static bool staticWillUseLayer (QgsVectorLayer *layer)
 called to find out whether the layer is used for labeling More...
 

Friends

class QgsDxfExport
 
class QgsPalLayerSettings
 
class QgsVectorLayerLabelProvider
 

Detailed Description

Definition at line 1054 of file qgspallabeling.h.

Member Function Documentation

void QgsPalLabeling::drawLabelCandidateRect ( pal::LabelPosition lp,
QPainter *  painter,
const QgsMapToPixel xform,
QList< QgsLabelCandidate > *  candidates = nullptr 
)
static
Note
not available in Python bindings

Definition at line 3487 of file qgspallabeling.cpp.

bool QgsPalLabeling::geometryRequiresPreparation ( const QgsGeometry geometry,
QgsRenderContext context,
const QgsCoordinateTransform ct,
const QgsGeometry clipGeometry = QgsGeometry(),
bool  mergeLines = false 
)
static

Checks whether a geometry requires preparation before registration with PAL.

Parameters
geometrygeometry to prepare
contextrender context
ctcoordinate transform, or invalid transform if no transformation required
clipGeometrygeometry to clip features to, if applicable
mergeLinesTRUE if touching lines from this layer will be merged and treated as single features during labeling
Returns
true if geometry requires preparation
Since
QGIS 2.9

Definition at line 2860 of file qgspallabeling.cpp.

QgsGeometry QgsPalLabeling::prepareGeometry ( const QgsGeometry geometry,
QgsRenderContext context,
const QgsCoordinateTransform ct,
const QgsGeometry clipGeometry = QgsGeometry(),
bool  mergeLines = false 
)
static

Prepares a geometry for registration with PAL.

Handles reprojection, rotation, clipping, etc.

Parameters
geometrygeometry to prepare
contextrender context
ctcoordinate transform, or invalid transform if no transformation required
clipGeometrygeometry to clip features to, if applicable
mergeLinesTRUE if touching lines from this layer will be merged and treated as single features during labeling
Returns
prepared geometry
Since
QGIS 2.9

Definition at line 2937 of file qgspallabeling.cpp.

QStringList QgsPalLabeling::splitToGraphemes ( const QString &  text)
static

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
textstring to split
Returns
list of graphemes
Since
QGIS 2.10

Definition at line 2923 of file qgspallabeling.cpp.

QStringList QgsPalLabeling::splitToLines ( const QString &  text,
const QString &  wrapCharacter,
int  autoWrapLength = 0,
bool  useMaxLineLengthWhenAutoWrapping = true 
)
static

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 if autoWrapLength is 0). This automatic wrapping is performed after processing wrapping using wrapCharacter. When auto wrapping is enabled, the useMaxLineLengthWhenAutoWrapping argument controls whether the lines should be wrapped to an ideal maximum of autoWrapLength characters, or if false then the lines are wrapped to an ideal minimum length of autoWrapLength characters.

Since
QGIS 2.9

Definition at line 2892 of file qgspallabeling.cpp.

bool QgsPalLabeling::staticWillUseLayer ( QgsVectorLayer layer)
static

called to find out whether the layer is used for labeling

Since
QGIS 2.4

Definition at line 2854 of file qgspallabeling.cpp.

Friends And Related Function Documentation

friend class QgsDxfExport
friend

Definition at line 1137 of file qgspallabeling.h.

friend class QgsPalLayerSettings
friend

Definition at line 1149 of file qgspallabeling.h.

friend class QgsVectorLayerLabelProvider
friend

Definition at line 1136 of file qgspallabeling.h.


The documentation for this class was generated from the following files: