QGIS API Documentation  2.99.0-Master (08c2e66)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
QgsPalLabeling Class Reference

#include <qgspallabeling.h>

Public Types

enum  Search {
  Chain, Popmusic_Tabu, Popmusic_Chain, Popmusic_Tabu_Chain,
  Falp
}
 

Public Member Functions

 QgsPalLabeling ()
 
 ~QgsPalLabeling ()
 
bool drawLabelRectOnly () const
 Returns whether the engine will only draw the outline rectangles of labels, not the label contents themselves. More...
 
bool isDrawingOutlineLabels () const
 
bool isShowingAllLabels () const
 
bool isShowingCandidates () const
 
bool isShowingPartialsLabels () const
 
void loadEngineSettings ()
 load/save engine settings to project file More...
 
void numCandidatePositions (int &candPoint, int &candLine, int &candPolygon)
 
void saveEngineSettings ()
 
Search searchMethod () const
 
void setDrawingOutlineLabels (bool outline)
 
void setDrawLabelRectOnly (bool drawRect)
 Sets whether the engine should only draw the outline rectangles of labels, not the label contents themselves. More...
 
void setNumCandidatePositions (int candPoint, int candLine, int candPolygon)
 
void setSearchMethod (Search s)
 
void setShowingAllLabels (bool showing)
 
void setShowingCandidates (bool showing)
 
void setShowingPartialsLabels (bool showing)
 

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, QgsGeometry *clipGeometry=nullptr)
 Checks whether a geometry requires preparation before registration with PAL. More...
 
static QgsGeometry prepareGeometry (const QgsGeometry &geometry, QgsRenderContext &context, const QgsCoordinateTransform &ct, QgsGeometry *clipGeometry=nullptr)
 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)
 Splits a text string to a list of separate lines, using a specified wrap character. More...
 
static bool staticWillUseLayer (QgsVectorLayer *layer)
 called to find out whether the layer is used for labeling More...
 

Protected Member Functions

void deleteTemporaryData ()
 

Static Protected Member Functions

static bool checkMinimumSizeMM (const QgsRenderContext &context, const QgsGeometry *geom, double minSize)
 Checks whether a geometry exceeds the minimum required size for a geometry to be labeled. More...
 
static void dataDefinedDropShadow (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues)
 Update temporary QgsPalLayerSettings with any data defined drop shadow values. More...
 
static void dataDefinedShapeBackground (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues)
 Update temporary QgsPalLayerSettings with any data defined shape background values. More...
 
static void dataDefinedTextBuffer (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues)
 Update temporary QgsPalLayerSettings with any data defined text buffer values. More...
 
static void dataDefinedTextFormatting (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues)
 Update temporary QgsPalLayerSettings with any data defined text formatting values. More...
 
static void dataDefinedTextStyle (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::Property, QVariant > &ddValues)
 Update temporary QgsPalLayerSettings with any data defined text style values. More...
 

Protected Attributes

QList< QgsLabelCandidatemCandidates
 
QHash< QString, QgsVectorLayerDiagramProvider * > mDiagramProviders
 hashtable of diagram providers (key = layer ID) More...
 
QgsLabelingEnginemEngine = nullptr
 New labeling engine to interface with PAL. More...
 
QgsPalLayerSettings mInvalidLayerSettings
 
QHash< QString, QgsVectorLayerLabelProvider * > mLabelProviders
 hashtable of label providers, being filled during labeling (key = layer ID) More...
 

Friends

class QgsDxfExport
 
class QgsPalLayerSettings
 
class QgsVectorLayerLabelProvider
 

Detailed Description

Definition at line 704 of file qgspallabeling.h.

Member Enumeration Documentation

Enumerator
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Definition at line 714 of file qgspallabeling.h.

Constructor & Destructor Documentation

QgsPalLabeling::QgsPalLabeling ( )

Definition at line 2747 of file qgspallabeling.cpp.

QgsPalLabeling::~QgsPalLabeling ( )

Definition at line 2752 of file qgspallabeling.cpp.

Member Function Documentation

bool QgsPalLabeling::checkMinimumSizeMM ( const QgsRenderContext context,
const QgsGeometry geom,
double  minSize 
)
staticprotected

Checks whether a geometry exceeds the minimum required size for a geometry to be labeled.

Parameters
contextrender context
geomgeometry
minSizeminimum size for geometry
Returns
true if geometry exceeds minimum size
Note
added in QGIS 2.9

Definition at line 2909 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedDropShadow ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::Property, QVariant > &  ddValues 
)
staticprotected

Update temporary QgsPalLayerSettings with any data defined drop shadow values.

Definition at line 3266 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedShapeBackground ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::Property, QVariant > &  ddValues 
)
staticprotected

Update temporary QgsPalLayerSettings with any data defined shape background values.

Definition at line 3115 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextBuffer ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::Property, QVariant > &  ddValues 
)
staticprotected

Update temporary QgsPalLayerSettings with any data defined text buffer values.

Definition at line 3037 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextFormatting ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::Property, QVariant > &  ddValues 
)
staticprotected

Update temporary QgsPalLayerSettings with any data defined text formatting values.

Definition at line 2982 of file qgspallabeling.cpp.

void QgsPalLabeling::dataDefinedTextStyle ( QgsPalLayerSettings tmpLyr,
const QMap< QgsPalLayerSettings::Property, QVariant > &  ddValues 
)
staticprotected

Update temporary QgsPalLayerSettings with any data defined text style values.

Definition at line 2948 of file qgspallabeling.cpp.

void QgsPalLabeling::deleteTemporaryData ( )
protected

Definition at line 3361 of file qgspallabeling.cpp.

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 3435 of file qgspallabeling.cpp.

bool QgsPalLabeling::drawLabelRectOnly ( ) const

Returns whether the engine will only draw the outline rectangles of labels, not the label contents themselves.

Used for debugging and testing purposes.

See also
setDrawLabelRectOnly
Note
added in QGIS 2.12

Definition at line 3425 of file qgspallabeling.cpp.

bool QgsPalLabeling::geometryRequiresPreparation ( const QgsGeometry geometry,
QgsRenderContext context,
const QgsCoordinateTransform ct,
QgsGeometry clipGeometry = nullptr 
)
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
Returns
true if geometry requires preparation
Note
added in QGIS 2.9

Definition at line 2771 of file qgspallabeling.cpp.

bool QgsPalLabeling::isDrawingOutlineLabels ( ) const
Note
added in 2.4

Definition at line 3415 of file qgspallabeling.cpp.

bool QgsPalLabeling::isShowingAllLabels ( ) const

Definition at line 3395 of file qgspallabeling.cpp.

bool QgsPalLabeling::isShowingCandidates ( ) const

Definition at line 3385 of file qgspallabeling.cpp.

bool QgsPalLabeling::isShowingPartialsLabels ( ) const

Definition at line 3405 of file qgspallabeling.cpp.

void QgsPalLabeling::loadEngineSettings ( )

load/save engine settings to project file

Definition at line 3495 of file qgspallabeling.cpp.

void QgsPalLabeling::numCandidatePositions ( int &  candPoint,
int &  candLine,
int &  candPolygon 
)

Definition at line 3365 of file qgspallabeling.cpp.

QgsGeometry QgsPalLabeling::prepareGeometry ( const QgsGeometry geometry,
QgsRenderContext context,
const QgsCoordinateTransform ct,
QgsGeometry clipGeometry = nullptr 
)
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
Returns
prepared geometry
Note
added in QGIS 2.9

Definition at line 2831 of file qgspallabeling.cpp.

void QgsPalLabeling::saveEngineSettings ( )

Definition at line 3501 of file qgspallabeling.cpp.

QgsPalLabeling::Search QgsPalLabeling::searchMethod ( ) const

Definition at line 3380 of file qgspallabeling.cpp.

void QgsPalLabeling::setDrawingOutlineLabels ( bool  outline)

Definition at line 3420 of file qgspallabeling.cpp.

void QgsPalLabeling::setDrawLabelRectOnly ( bool  drawRect)

Sets whether the engine should only draw the outline rectangles of labels, not the label contents themselves.

Used for debugging and testing purposes.

Parameters
drawRectset to true to enable rect drawing only
See also
drawLabelRectOnly
Note
added in QGIS 2.12

Definition at line 3430 of file qgspallabeling.cpp.

void QgsPalLabeling::setNumCandidatePositions ( int  candPoint,
int  candLine,
int  candPolygon 
)

Definition at line 3370 of file qgspallabeling.cpp.

void QgsPalLabeling::setSearchMethod ( QgsPalLabeling::Search  s)

Definition at line 3375 of file qgspallabeling.cpp.

void QgsPalLabeling::setShowingAllLabels ( bool  showing)

Definition at line 3400 of file qgspallabeling.cpp.

void QgsPalLabeling::setShowingCandidates ( bool  showing)

Definition at line 3390 of file qgspallabeling.cpp.

void QgsPalLabeling::setShowingPartialsLabels ( bool  showing)

Definition at line 3410 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
Note
added in QGIS 2.10

Definition at line 2817 of file qgspallabeling.cpp.

QStringList QgsPalLabeling::splitToLines ( const QString &  text,
const QString &  wrapCharacter 
)
static

Splits a text string to a list of separate lines, using a specified wrap character.

The text string will be split on either newline characters or the wrap character.

Parameters
texttext string to split
wrapCharacteradditional character to wrap on
Returns
list of text split to lines
Note
added in QGIS 2.9

Definition at line 2798 of file qgspallabeling.cpp.

bool QgsPalLabeling::staticWillUseLayer ( QgsVectorLayer layer)
static

called to find out whether the layer is used for labeling

Note
added in 2.4

Definition at line 2758 of file qgspallabeling.cpp.

Friends And Related Function Documentation

friend class QgsDxfExport
friend

Definition at line 818 of file qgspallabeling.h.

friend class QgsPalLayerSettings
friend

Definition at line 843 of file qgspallabeling.h.

friend class QgsVectorLayerLabelProvider
friend

Definition at line 817 of file qgspallabeling.h.

Member Data Documentation

QList<QgsLabelCandidate> QgsPalLabeling::mCandidates
protected

Definition at line 841 of file qgspallabeling.h.

QHash<QString, QgsVectorLayerDiagramProvider*> QgsPalLabeling::mDiagramProviders
protected

hashtable of diagram providers (key = layer ID)

Definition at line 834 of file qgspallabeling.h.

QgsLabelingEngine* QgsPalLabeling::mEngine = nullptr
protected

New labeling engine to interface with PAL.

Definition at line 838 of file qgspallabeling.h.

QgsPalLayerSettings QgsPalLabeling::mInvalidLayerSettings
protected

Definition at line 835 of file qgspallabeling.h.

QHash<QString, QgsVectorLayerLabelProvider*> QgsPalLabeling::mLabelProviders
protected

hashtable of label providers, being filled during labeling (key = layer ID)

Definition at line 832 of file qgspallabeling.h.


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