|
QGIS API Documentation
2.14.11-Essen
|
The QgsLabelingEngineV2 class provides map labeling functionality. More...
#include <qgslabelingenginev2.h>
Public Types | |
| enum | Flag { UseAllLabels = 1 << 1, UsePartialCandidates = 1 << 2, RenderOutlineLabels = 1 << 3, DrawLabelRectOnly = 1 << 4, DrawCandidates = 1 << 5, DrawShadowRects = 1 << 6 } |
Public Member Functions | |
| QgsLabelingEngineV2 () | |
| Construct the labeling engine with default settings. More... | |
| ~QgsLabelingEngineV2 () | |
| Clean up everything (especially the registered providers) More... | |
| void | addProvider (QgsAbstractLabelProvider *provider) |
| Add provider of label features. Takes ownership of the provider. More... | |
| Flags | flags () const |
| Get flags of the labeling engine. More... | |
| const QgsMapSettings & | mapSettings () const |
| Get associated map settings. More... | |
| void | numCandidatePositions (int &candPoint, int &candLine, int &candPolygon) |
| Get number of candidate positions that will be generated for each label feature (default to 8) More... | |
| void | readSettingsFromProject () |
| Read configuration of the labeling engine from the current project file. 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... | |
| QgsPalLabeling::Search | searchMethod () const |
| Which search method to use for removal collisions between labels. More... | |
| void | setFlag (Flag f, bool enabled=true) |
| Set whether a particual flag is enabled. More... | |
| void | setFlags (const Flags &flags) |
| Set flags of the labeling engine. More... | |
| void | setMapSettings (const QgsMapSettings &mapSettings) |
| Associate map settings instance. More... | |
| void | setNumCandidatePositions (int candPoint, int candLine, int candPolygon) |
| Set number of candidate positions that will be generated for each label feature. More... | |
| void | setSearchMethod (QgsPalLabeling::Search s) |
| Set which search method to use for removal collisions between labels. More... | |
| QgsLabelingResults * | takeResults () |
| Return pointer to recently computed results and pass the ownership of results to the caller. More... | |
| bool | testFlag (Flag f) const |
| Test whether a particular flag is enabled. More... | |
| void | writeSettingsToProject () |
| Write configuration of the labeling engine to the current project file. More... | |
Protected Member Functions | |
| void | processProvider (QgsAbstractLabelProvider *provider, QgsRenderContext &context, pal::Pal &p) |
Protected Attributes | |
| int | mCandLine |
| int | mCandPoint |
| Number of candedate positions that will be generated for features. More... | |
| int | mCandPolygon |
| Flags | mFlags |
| Flags. More... | |
| QgsMapSettings | mMapSettings |
| Associated map settings instance. More... | |
| QList< QgsAbstractLabelProvider * > | mProviders |
| List of providers (the are owned by the labeling engine) More... | |
| QgsLabelingResults * | mResults |
| Resulting labeling layout. More... | |
| QgsPalLabeling::Search | mSearchMethod |
| search method to use for removal collisions between labels More... | |
| QList< QgsAbstractLabelProvider * > | mSubProviders |
The QgsLabelingEngineV2 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 155 of file qgslabelingenginev2.h.
Definition at line 163 of file qgslabelingenginev2.h.
| QgsLabelingEngineV2::QgsLabelingEngineV2 | ( | ) |
Construct the labeling engine with default settings.
Definition at line 68 of file qgslabelingenginev2.cpp.
| QgsLabelingEngineV2::~QgsLabelingEngineV2 | ( | ) |
Clean up everything (especially the registered providers)
Definition at line 79 of file qgslabelingenginev2.cpp.
| void QgsLabelingEngineV2::addProvider | ( | QgsAbstractLabelProvider * | provider | ) |
Add provider of label features. Takes ownership of the provider.
Definition at line 86 of file qgslabelingenginev2.cpp.
|
inline |
Get flags of the labeling engine.
Definition at line 197 of file qgslabelingenginev2.h.
|
inline |
Get associated map settings.
Definition at line 177 of file qgslabelingenginev2.h.
|
inline |
Get number of candidate positions that will be generated for each label feature (default to 8)
Definition at line 204 of file qgslabelingenginev2.h.
|
protected |
Definition at line 101 of file qgslabelingenginev2.cpp.
| void QgsLabelingEngineV2::readSettingsFromProject | ( | ) |
Read configuration of the labeling engine from the current project file.
Definition at line 338 of file qgslabelingenginev2.cpp.
| void QgsLabelingEngineV2::removeProvider | ( | QgsAbstractLabelProvider * | provider | ) |
Remove provider if the provider's initialization failed. Provider instance is deleted.
Definition at line 92 of file qgslabelingenginev2.cpp.
|
inline |
For internal use by the providers.
Definition at line 192 of file qgslabelingenginev2.h.
| void QgsLabelingEngineV2::run | ( | QgsRenderContext & | context | ) |
compute the labeling with given map settings and providers
Definition at line 174 of file qgslabelingenginev2.cpp.
|
inline |
Which search method to use for removal collisions between labels.
Definition at line 211 of file qgslabelingenginev2.h.
|
inline |
Set whether a particual flag is enabled.
Definition at line 201 of file qgslabelingenginev2.h.
|
inline |
Set flags of the labeling engine.
Definition at line 195 of file qgslabelingenginev2.h.
|
inline |
Associate map settings instance.
Definition at line 175 of file qgslabelingenginev2.h.
|
inline |
Set number of candidate positions that will be generated for each label feature.
Definition at line 206 of file qgslabelingenginev2.h.
|
inline |
Set which search method to use for removal collisions between labels.
Definition at line 209 of file qgslabelingenginev2.h.
| QgsLabelingResults * QgsLabelingEngineV2::takeResults | ( | ) |
Return pointer to recently computed results and pass the ownership of results to the caller.
Definition at line 330 of file qgslabelingenginev2.cpp.
|
inline |
Test whether a particular flag is enabled.
Definition at line 199 of file qgslabelingenginev2.h.
| void QgsLabelingEngineV2::writeSettingsToProject | ( | ) |
Write configuration of the labeling engine to the current project file.
Definition at line 356 of file qgslabelingenginev2.cpp.
|
protected |
Definition at line 232 of file qgslabelingenginev2.h.
|
protected |
Number of candedate positions that will be generated for features.
Definition at line 232 of file qgslabelingenginev2.h.
|
protected |
Definition at line 232 of file qgslabelingenginev2.h.
|
protected |
Flags.
Definition at line 228 of file qgslabelingenginev2.h.
|
protected |
Associated map settings instance.
Definition at line 223 of file qgslabelingenginev2.h.
|
protected |
List of providers (the are owned by the labeling engine)
Definition at line 225 of file qgslabelingenginev2.h.
|
protected |
Resulting labeling layout.
Definition at line 235 of file qgslabelingenginev2.h.
|
protected |
search method to use for removal collisions between labels
Definition at line 230 of file qgslabelingenginev2.h.
|
protected |
Definition at line 226 of file qgslabelingenginev2.h.
1.8.13