QGIS API Documentation  2.99.0-Master (0a63d1f)
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 ()
 
void clearEngineSettings ()
 
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...
 
static bool staticWillUseLayer (const QString &layerID)
 

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::DataDefinedProperties, QVariant > &ddValues)
 
static void dataDefinedShapeBackground (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
static void dataDefinedTextBuffer (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
static void dataDefinedTextFormatting (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 
static void dataDefinedTextStyle (QgsPalLayerSettings &tmpLyr, const QMap< QgsPalLayerSettings::DataDefinedProperties, QVariant > &ddValues)
 

Protected Attributes

QList< QgsLabelCandidatemCandidates
 
QHash< QString, QgsVectorLayerDiagramProvider * > mDiagramProviders
 hashtable of diagram providers (key = layer ID) More...
 
QgsLabelingEnginemEngine
 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 731 of file qgspallabeling.h.

Member Enumeration Documentation

◆ Search

Enumerator
Chain 
Popmusic_Tabu 
Popmusic_Chain 
Popmusic_Tabu_Chain 
Falp 

Definition at line 741 of file qgspallabeling.h.

Constructor & Destructor Documentation

◆ QgsPalLabeling()

QgsPalLabeling::QgsPalLabeling ( )

Definition at line 3197 of file qgspallabeling.cpp.

◆ ~QgsPalLabeling()

QgsPalLabeling::~QgsPalLabeling ( )

Definition at line 3202 of file qgspallabeling.cpp.

Member Function Documentation

◆ checkMinimumSizeMM()

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

◆ clearEngineSettings()

void QgsPalLabeling::clearEngineSettings ( )

Definition at line 3963 of file qgspallabeling.cpp.

◆ dataDefinedDropShadow()

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

Definition at line 3725 of file qgspallabeling.cpp.

◆ dataDefinedShapeBackground()

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

Definition at line 3574 of file qgspallabeling.cpp.

◆ dataDefinedTextBuffer()

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

Definition at line 3496 of file qgspallabeling.cpp.

◆ dataDefinedTextFormatting()

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

Definition at line 3441 of file qgspallabeling.cpp.

◆ dataDefinedTextStyle()

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

Definition at line 3407 of file qgspallabeling.cpp.

◆ deleteTemporaryData()

void QgsPalLabeling::deleteTemporaryData ( )
protected

Definition at line 3820 of file qgspallabeling.cpp.

◆ drawLabelCandidateRect()

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

◆ drawLabelRectOnly()

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

◆ geometryRequiresPreparation()

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

◆ isDrawingOutlineLabels()

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

Definition at line 3874 of file qgspallabeling.cpp.

◆ isShowingAllLabels()

bool QgsPalLabeling::isShowingAllLabels ( ) const

Definition at line 3854 of file qgspallabeling.cpp.

◆ isShowingCandidates()

bool QgsPalLabeling::isShowingCandidates ( ) const

Definition at line 3844 of file qgspallabeling.cpp.

◆ isShowingPartialsLabels()

bool QgsPalLabeling::isShowingPartialsLabels ( ) const

Definition at line 3864 of file qgspallabeling.cpp.

◆ loadEngineSettings()

void QgsPalLabeling::loadEngineSettings ( )

load/save engine settings to project file

Definition at line 3953 of file qgspallabeling.cpp.

◆ numCandidatePositions()

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

Definition at line 3824 of file qgspallabeling.cpp.

◆ prepareGeometry()

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

◆ saveEngineSettings()

void QgsPalLabeling::saveEngineSettings ( )

Definition at line 3958 of file qgspallabeling.cpp.

◆ searchMethod()

QgsPalLabeling::Search QgsPalLabeling::searchMethod ( ) const

Definition at line 3839 of file qgspallabeling.cpp.

◆ setDrawingOutlineLabels()

void QgsPalLabeling::setDrawingOutlineLabels ( bool  outline)

Definition at line 3879 of file qgspallabeling.cpp.

◆ setDrawLabelRectOnly()

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

◆ setNumCandidatePositions()

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

Definition at line 3829 of file qgspallabeling.cpp.

◆ setSearchMethod()

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

Definition at line 3834 of file qgspallabeling.cpp.

◆ setShowingAllLabels()

void QgsPalLabeling::setShowingAllLabels ( bool  showing)

Definition at line 3859 of file qgspallabeling.cpp.

◆ setShowingCandidates()

void QgsPalLabeling::setShowingCandidates ( bool  showing)

Definition at line 3849 of file qgspallabeling.cpp.

◆ setShowingPartialsLabels()

void QgsPalLabeling::setShowingPartialsLabels ( bool  showing)

Definition at line 3869 of file qgspallabeling.cpp.

◆ splitToGraphemes()

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

◆ splitToLines()

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

◆ staticWillUseLayer() [1/2]

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

◆ staticWillUseLayer() [2/2]

bool QgsPalLabeling::staticWillUseLayer ( const QString &  layerID)
static

Definition at line 3208 of file qgspallabeling.cpp.

Friends And Related Function Documentation

◆ QgsDxfExport

friend class QgsDxfExport
friend

Definition at line 847 of file qgspallabeling.h.

◆ QgsPalLayerSettings

friend class QgsPalLayerSettings
friend

Definition at line 872 of file qgspallabeling.h.

◆ QgsVectorLayerLabelProvider

friend class QgsVectorLayerLabelProvider
friend

Definition at line 846 of file qgspallabeling.h.

Member Data Documentation

◆ mCandidates

QList<QgsLabelCandidate> QgsPalLabeling::mCandidates
protected

Definition at line 870 of file qgspallabeling.h.

◆ mDiagramProviders

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

hashtable of diagram providers (key = layer ID)

Definition at line 863 of file qgspallabeling.h.

◆ mEngine

QgsLabelingEngine* QgsPalLabeling::mEngine
protected

New labeling engine to interface with PAL.

Definition at line 867 of file qgspallabeling.h.

◆ mInvalidLayerSettings

QgsPalLayerSettings QgsPalLabeling::mInvalidLayerSettings
protected

Definition at line 864 of file qgspallabeling.h.

◆ mLabelProviders

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

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

Definition at line 861 of file qgspallabeling.h.


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