QGIS API Documentation 4.3.0-Master (0de80482b60)
Loading...
Searching...
No Matches
QgsLabelingResults Class Reference

Stores computed placement from labeling engine. More...

#include <qgslabelingresults.h>

Public Member Functions

 QgsLabelingResults (bool enableSearchTree=true)
 Constructor for QgsLabelingResults.
 QgsLabelingResults (const QgsLabelingResults &)=delete
 ~QgsLabelingResults ()
QList< QgsLabelPositionallLabels () const
 Returns a list of all labels generated by the labeling run.
QList< QgsCalloutPositioncalloutsWithinRectangle (const QgsRectangle &rectangle) const
 Returns a list of callouts with origins or destinations inside the given rectangle.
QList< QgsLabelPositiongroupedLabelPositions (long long groupId) const
 Returns a list of all label positions sharing the same group ID (i.e.
bool hasSearchTree () const
 Returns true if the results were constructed with search tree enabled.
bool insertCallout (const QgsCalloutPosition &position)
 Inserts a rendered callout position.
bool insertLabel (pal::LabelPosition *labelPos, QgsFeatureId featureId, const QString &layerName, const QString &labeltext, const QFont &labelfont, bool diagram=false, bool pinned=false, const QString &providerId=QString(), bool isUnplaced=false, long long linkedId=0, long long linkedPositionIndex=0, long long subPartId=0)
 Inserts label position.
QList< QgsLabelPositionlabelsAtPosition (const QgsPointXY &p) const
 Returns the details of any labels placed at the specified point (in map coordinates).
QList< QgsLabelPositionlabelsWithinRect (const QgsRectangle &r) const
 Returns the details of any labels placed within the specified rectangle (in map coordinates).
QgsLabelingResultsoperator= (const QgsLabelingResults &rh)=delete
void setMapSettings (const QgsMapSettings &settings)
 Sets the map settings associated with the labeling run.

Detailed Description

Stores computed placement from labeling engine.

Definition at line 43 of file qgslabelingresults.h.

Constructor & Destructor Documentation

◆ QgsLabelingResults() [1/2]

QgsLabelingResults::QgsLabelingResults ( bool enableSearchTree = true)

Constructor for QgsLabelingResults.

Parameters
enableSearchTreeset to false to disable the search tree. This can be used to speed up labeling in cases where spatial querying of labels is not required (since QGIS 4.4)

Definition at line 25 of file qgslabelingresults.cpp.

◆ ~QgsLabelingResults()

QgsLabelingResults::~QgsLabelingResults ( )
default

◆ QgsLabelingResults() [2/2]

QgsLabelingResults::QgsLabelingResults ( const QgsLabelingResults & )
delete

Member Function Documentation

◆ allLabels()

QList< QgsLabelPosition > QgsLabelingResults::allLabels ( ) const

Returns a list of all labels generated by the labeling run.

Since
QGIS 3.20

Definition at line 147 of file qgslabelingresults.cpp.

◆ calloutsWithinRectangle()

QList< QgsCalloutPosition > QgsLabelingResults::calloutsWithinRectangle ( const QgsRectangle & rectangle) const

Returns a list of callouts with origins or destinations inside the given rectangle.

The rectangle is specified in map coordinates.

Note
Only available when hasSearchTree() is true.
Since
QGIS 3.20

Definition at line 207 of file qgslabelingresults.cpp.

◆ groupedLabelPositions()

QList< QgsLabelPosition > QgsLabelingResults::groupedLabelPositions ( long long groupId) const

Returns a list of all label positions sharing the same group ID (i.e.

positions for individual characters in a curved label).

Note
Only available when hasSearchTree() is true.
Since
QGIS 3.26

Definition at line 194 of file qgslabelingresults.cpp.

◆ hasSearchTree()

bool QgsLabelingResults::hasSearchTree ( ) const

Returns true if the results were constructed with search tree enabled.

If the search tree is not available, then spatial querying based methods like labelsAtPosition() will not be available.

Since
QGIS 4.4

Definition at line 31 of file qgslabelingresults.cpp.

◆ insertCallout()

bool QgsLabelingResults::insertCallout ( const QgsCalloutPosition & position)

Inserts a rendered callout position.

Returns
true in case of success
Note
not available in Python bindings
Since
QGIS 4.4

Definition at line 129 of file qgslabelingresults.cpp.

◆ insertLabel()

bool QgsLabelingResults::insertLabel ( pal::LabelPosition * labelPos,
QgsFeatureId featureId,
const QString & layerName,
const QString & labeltext,
const QFont & labelfont,
bool diagram = false,
bool pinned = false,
const QString & providerId = QString(),
bool isUnplaced = false,
long long linkedId = 0,
long long linkedPositionIndex = 0,
long long subPartId = 0 )

Inserts label position.

Does not take ownership of labelPos

Returns
true in case of success
Note
not available in Python bindings
Since
QGIS 4.4

Definition at line 36 of file qgslabelingresults.cpp.

◆ labelsAtPosition()

QList< QgsLabelPosition > QgsLabelingResults::labelsAtPosition ( const QgsPointXY & p) const

Returns the details of any labels placed at the specified point (in map coordinates).

Note
Only available when hasSearchTree() is true.

Definition at line 158 of file qgslabelingresults.cpp.

◆ labelsWithinRect()

QList< QgsLabelPosition > QgsLabelingResults::labelsWithinRect ( const QgsRectangle & r) const

Returns the details of any labels placed within the specified rectangle (in map coordinates).

Note
Only available when hasSearchTree() is true.

Definition at line 176 of file qgslabelingresults.cpp.

◆ operator=()

QgsLabelingResults & QgsLabelingResults::operator= ( const QgsLabelingResults & rh)
delete

◆ setMapSettings()

void QgsLabelingResults::setMapSettings ( const QgsMapSettings & settings)

Sets the map settings associated with the labeling run.

Since
QGIS 3.4.8

Definition at line 223 of file qgslabelingresults.cpp.


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