QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsStagedRenderLabelingEngine Class Reference

A QgsLabelingEngine implementation, which only calculates the labeling solution during its run() method. More...

#include <qgslabelingengine.h>

Inheritance diagram for QgsStagedRenderLabelingEngine:
Inheritance graph
[legend]

Public Member Functions

 QgsStagedRenderLabelingEngine ()
 Construct the labeling engine with default settings.
 
 QgsStagedRenderLabelingEngine (const QgsStagedRenderLabelingEngine &rh)=delete
 
void finalize ()
 Finalizes and cleans up the engine following the rendering of labels for the last layer to be labeled (via renderLabelsForLayer() ).
 
QgsStagedRenderLabelingEngineoperator= (const QgsStagedRenderLabelingEngine &rh)=delete
 
void renderLabelsForLayer (QgsRenderContext &context, const QString &layerId)
 Renders all the labels which belong only to the layer with matching layerId to the specified render context.
 
void run (QgsRenderContext &context) override
 Runs the labeling job.
 
- Public Member Functions inherited from QgsLabelingEngine
 QgsLabelingEngine ()
 Construct the labeling engine with default settings.
 
 QgsLabelingEngine (const QgsLabelingEngine &rh)=delete
 
virtual ~QgsLabelingEngine ()
 Clean up everything (especially the registered providers)
 
QString addProvider (QgsAbstractLabelProvider *provider)
 Adds a provider of label features.
 
const QgsLabelingEngineSettingsengineSettings () const
 Gets associated labeling engine settings.
 
const QgsMapSettingsmapSettings () const
 Gets associated map settings.
 
QgsLabelingEngineoperator= (const QgsLabelingEngine &rh)=delete
 
QStringList participatingLayerIds () const
 Returns a list of layer IDs for layers with providers in the engine.
 
QList< QgsMapLayer * > participatingLayers () const
 Returns a list of layers with providers in the engine.
 
bool prepare (QgsRenderContext &context)
 Prepares the engine for rendering in the specified context.
 
QgsAbstractLabelProviderproviderById (const QString &id)
 Returns the provider with matching id, where id corresponds to the value returned by the addProvider() call.
 
void removeProvider (QgsAbstractLabelProvider *provider)
 Remove provider if the provider's initialization failed. Provider instance is deleted.
 
QgsLabelingResultsresults () const
 For internal use by the providers.
 
void setMapSettings (const QgsMapSettings &mapSettings)
 Associate map settings instance.
 
QgsLabelingResultstakeResults ()
 Returns pointer to recently computed results and pass the ownership of results to the caller.
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsLabelingEngine
static void drawLabelCandidateRect (pal::LabelPosition *lp, QgsRenderContext &context, const QgsMapToPixel *xform, QList< QgsLabelCandidate > *candidates=nullptr)
 Draws label candidate rectangles.
 
static void drawLabelMetrics (pal::LabelPosition *label, QgsMapToPixel xform, QgsRenderContext &context, const QPointF &renderPoint)
 Draws label metrics.
 
- Protected Member Functions inherited from QgsLabelingEngine
void cleanup ()
 Cleans up the engine following a call to registerLabels() or solve().
 
void drawLabels (QgsRenderContext &context, const QString &layerId=QString())
 Draws labels to the specified render context.
 
void processProvider (QgsAbstractLabelProvider *provider, QgsRenderContext &context, pal::Pal &p)
 
void registerLabels (QgsRenderContext &context)
 Runs the label registration step.
 
void solve (QgsRenderContext &context)
 Solves the label problem.
 
- Protected Attributes inherited from QgsLabelingEngine
std::vector< std::unique_ptr< QgsAbstractLabelingEngineRule > > mEngineRules
 
QList< pal::LabelPosition * > mLabels
 
QgsMapSettings mMapSettings
 Associated map settings instance.
 
std::unique_ptr< pal::PalmPal
 
std::unique_ptr< pal::ProblemmProblem
 
QList< QgsAbstractLabelProvider * > mProviders
 List of providers (the are owned by the labeling engine)
 
QHash< QString, QgsAbstractLabelProvider * > mProvidersById
 
std::unique_ptr< QgsLabelingResultsmResults
 Resulting labeling layout.
 
QList< QgsAbstractLabelProvider * > mSubProviders
 List of labeling engine rules (owned by the labeling engine)
 
QList< pal::LabelPosition * > mUnlabeled
 

Detailed Description

A QgsLabelingEngine implementation, which only calculates the labeling solution during its run() method.

The actual rendering of labels themselves is deferred to follow up calls to ....

Note
this class is not a part of public API yet. See notes in QgsLabelingEngine
not available in Python bindings
Since
QGIS 3.10

Definition at line 543 of file qgslabelingengine.h.

Constructor & Destructor Documentation

◆ QgsStagedRenderLabelingEngine() [1/2]

QgsStagedRenderLabelingEngine::QgsStagedRenderLabelingEngine ( )

Construct the labeling engine with default settings.

Definition at line 858 of file qgslabelingengine.cpp.

◆ QgsStagedRenderLabelingEngine() [2/2]

QgsStagedRenderLabelingEngine::QgsStagedRenderLabelingEngine ( const QgsStagedRenderLabelingEngine rh)
delete

Member Function Documentation

◆ finalize()

void QgsStagedRenderLabelingEngine::finalize ( )

Finalizes and cleans up the engine following the rendering of labels for the last layer to be labeled (via renderLabelsForLayer() ).

Definition at line 887 of file qgslabelingengine.cpp.

◆ operator=()

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

◆ renderLabelsForLayer()

void QgsStagedRenderLabelingEngine::renderLabelsForLayer ( QgsRenderContext context,
const QString &  layerId 
)

Renders all the labels which belong only to the layer with matching layerId to the specified render context.

Definition at line 882 of file qgslabelingengine.cpp.

◆ run()

void QgsStagedRenderLabelingEngine::run ( QgsRenderContext context)
overridevirtual

Runs the labeling job.

Depending on the concrete labeling engine class, this will either run the whole labeling job, including rendering the labels themselves, OR possibly just run the labeling job but leave the rendering to a future, deferred stage.

Implements QgsLabelingEngine.

Definition at line 864 of file qgslabelingengine.cpp.


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