QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
The QgsLabelingEngine class provides map labeling functionality. More...
#include <qgslabelingengine.h>
Public Member Functions | |
QgsLabelingEngine () | |
Construct the labeling engine with default settings. More... | |
QgsLabelingEngine (const QgsLabelingEngine &rh)=delete | |
QgsLabelingEngine cannot be copied. More... | |
~QgsLabelingEngine () | |
Clean up everything (especially the registered providers) More... | |
void | addProvider (QgsAbstractLabelProvider *provider) |
Add provider of label features. Takes ownership of the provider. More... | |
const QgsLabelingEngineSettings & | engineSettings () const |
Gets associated labeling engine settings. More... | |
const QgsMapSettings & | mapSettings () const |
Gets associated map settings. More... | |
QgsLabelingEngine & | operator= (const QgsLabelingEngine &rh)=delete |
QgsLabelingEngine cannot be copied. More... | |
QList< QgsMapLayer * > | participatingLayers () const |
Returns a list of layers with providers in the engine. More... | |
void | removeProvider (QgsAbstractLabelProvider *provider) |
Remove provider if the provider's initialization failed. Provider instance is deleted. More... | |
QgsLabelingResults * | results () const |
For internal use by the providers. More... | |
void | run (QgsRenderContext &context) |
compute the labeling with given map settings and providers More... | |
void | setMapSettings (const QgsMapSettings &mapSettings) |
Associate map settings instance. More... | |
QgsLabelingResults * | takeResults () |
Returns pointer to recently computed results and pass the ownership of results to the caller. More... | |
Protected Member Functions | |
void | processProvider (QgsAbstractLabelProvider *provider, QgsRenderContext &context, pal::Pal &p) |
Protected Attributes | |
QgsMapSettings | mMapSettings |
Associated map settings instance. More... | |
QList< QgsAbstractLabelProvider * > | mProviders |
List of providers (the are owned by the labeling engine) More... | |
std::unique_ptr< QgsLabelingResults > | mResults |
Resulting labeling layout. More... | |
QList< QgsAbstractLabelProvider * > | mSubProviders |
The QgsLabelingEngine class provides map labeling functionality.
The input for the engine is a list of label provider objects and map settings. Based on the input, the engine computes layout of labels for the given map view with no collisions between the labels. Drawing of resulting labels is done again by label providers.
The labeling engine is used for the map rendering in QgsMapRendererJob instances, individual map layer renderers may add label providers - for example, QgsVectorLayerRenderer may add text label provider and diagram provider (if labeling / diagrams were configured for such vector layer).
The labeling engine may also be used independently from map rendering loop:
Definition at line 165 of file qgslabelingengine.h.
QgsLabelingEngine::QgsLabelingEngine | ( | ) |
Construct the labeling engine with default settings.
Definition at line 74 of file qgslabelingengine.cpp.
QgsLabelingEngine::~QgsLabelingEngine | ( | ) |
Clean up everything (especially the registered providers)
Definition at line 78 of file qgslabelingengine.cpp.
|
delete |
QgsLabelingEngine cannot be copied.
void QgsLabelingEngine::addProvider | ( | QgsAbstractLabelProvider * | provider | ) |
Add provider of label features. Takes ownership of the provider.
Definition at line 107 of file qgslabelingengine.cpp.
|
inline |
Gets associated labeling engine settings.
Definition at line 184 of file qgslabelingengine.h.
|
inline |
Gets associated map settings.
Definition at line 181 of file qgslabelingengine.h.
|
delete |
QgsLabelingEngine cannot be copied.
QList< QgsMapLayer * > QgsLabelingEngine::participatingLayers | ( | ) | const |
Returns a list of layers with providers in the engine.
Definition at line 91 of file qgslabelingengine.cpp.
|
protected |
Definition at line 122 of file qgslabelingengine.cpp.
void QgsLabelingEngine::removeProvider | ( | QgsAbstractLabelProvider * | provider | ) |
Remove provider if the provider's initialization failed. Provider instance is deleted.
Definition at line 113 of file qgslabelingengine.cpp.
|
inline |
For internal use by the providers.
Definition at line 205 of file qgslabelingengine.h.
void QgsLabelingEngine::run | ( | QgsRenderContext & | context | ) |
compute the labeling with given map settings and providers
Definition at line 192 of file qgslabelingengine.cpp.
void QgsLabelingEngine::setMapSettings | ( | const QgsMapSettings & | mapSettings | ) |
Associate map settings instance.
Definition at line 84 of file qgslabelingengine.cpp.
QgsLabelingResults * QgsLabelingEngine::takeResults | ( | ) |
Returns pointer to recently computed results and pass the ownership of results to the caller.
Definition at line 352 of file qgslabelingengine.cpp.
|
protected |
Associated map settings instance.
Definition at line 212 of file qgslabelingengine.h.
|
protected |
List of providers (the are owned by the labeling engine)
Definition at line 215 of file qgslabelingengine.h.
|
protected |
Resulting labeling layout.
Definition at line 219 of file qgslabelingengine.h.
|
protected |
Definition at line 216 of file qgslabelingengine.h.