QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
QgsLabelingEngineRuleRegistry Class Reference

A registry for labeling engine rules. More...

#include <qgslabelingengineruleregistry.h>

Public Member Functions

 QgsLabelingEngineRuleRegistry ()
 Constructor for QgsLabelingEngineRuleRegistry, containing a set of default rules.
 
 QgsLabelingEngineRuleRegistry (const QgsLabelingEngineRuleRegistry &other)=delete
 QgsLabelingEngineRuleRegistry cannot be copied.
 
 ~QgsLabelingEngineRuleRegistry ()
 
bool addRule (QgsAbstractLabelingEngineRule *rule)
 Adds a new rule type to the registry.
 
QgsAbstractLabelingEngineRulecreate (const QString &id) const
 Creates a new rule from the type with matching id.
 
QString displayType (const QString &id) const
 Returns a user-friendly, translated string representing the rule type with matching id.
 
bool isAvailable (const QString &id) const
 Returns true if the rule is with matching id is available for use within the current QGIS environment.
 
QgsLabelingEngineRuleRegistryoperator= (const QgsLabelingEngineRuleRegistry &other)=delete
 QgsLabelingEngineRuleRegistry cannot be copied.
 
void removeRule (const QString &id)
 Removes the rule with matching id from the registry.
 
QStringList ruleIds () const
 Returns a list of the rule IDs for rules present in the registry.
 

Detailed Description

A registry for labeling engine rules.

Labeling engine rules implement custom logic to modify the labeling solution for a map render, e.g. by preventing labels being placed which violate custom constraints.

This registry stores available rules and is responsible for creating rules.

QgsLabelingEngineRuleRegistry is not usually directly created, but rather accessed through QgsApplication::labelEngineRuleRegistry().

Since
QGIS 3.40

Definition at line 38 of file qgslabelingengineruleregistry.h.

Constructor & Destructor Documentation

◆ QgsLabelingEngineRuleRegistry() [1/2]

QgsLabelingEngineRuleRegistry::QgsLabelingEngineRuleRegistry ( )

Constructor for QgsLabelingEngineRuleRegistry, containing a set of default rules.

Definition at line 20 of file qgslabelingengineruleregistry.cpp.

◆ ~QgsLabelingEngineRuleRegistry()

QgsLabelingEngineRuleRegistry::~QgsLabelingEngineRuleRegistry ( )
default

◆ QgsLabelingEngineRuleRegistry() [2/2]

QgsLabelingEngineRuleRegistry::QgsLabelingEngineRuleRegistry ( const QgsLabelingEngineRuleRegistry other)
delete

QgsLabelingEngineRuleRegistry cannot be copied.

Member Function Documentation

◆ addRule()

bool QgsLabelingEngineRuleRegistry::addRule ( QgsAbstractLabelingEngineRule rule)

Adds a new rule type to the registry.

The registry takes ownership of rule.

Returns
true if the rule was successfully added.
See also
removeRule()

Definition at line 68 of file qgslabelingengineruleregistry.cpp.

◆ create()

QgsAbstractLabelingEngineRule * QgsLabelingEngineRuleRegistry::create ( const QString &  id) const

Creates a new rule from the type with matching id.

Returns nullptr if no matching rule was found in the registry.

The caller takes ownership of the returned object.

Definition at line 59 of file qgslabelingengineruleregistry.cpp.

◆ displayType()

QString QgsLabelingEngineRuleRegistry::displayType ( const QString &  id) const

Returns a user-friendly, translated string representing the rule type with matching id.

Definition at line 41 of file qgslabelingengineruleregistry.cpp.

◆ isAvailable()

bool QgsLabelingEngineRuleRegistry::isAvailable ( const QString &  id) const

Returns true if the rule is with matching id is available for use within the current QGIS environment.

Rules can return false if required dependencies are not available, e.g. if a library version is too old for the rule.

Definition at line 50 of file qgslabelingengineruleregistry.cpp.

◆ operator=()

QgsLabelingEngineRuleRegistry & QgsLabelingEngineRuleRegistry::operator= ( const QgsLabelingEngineRuleRegistry other)
delete

QgsLabelingEngineRuleRegistry cannot be copied.

◆ removeRule()

void QgsLabelingEngineRuleRegistry::removeRule ( const QString &  id)

Removes the rule with matching id from the registry.

See also
addRule()

Definition at line 83 of file qgslabelingengineruleregistry.cpp.

◆ ruleIds()

QStringList QgsLabelingEngineRuleRegistry::ruleIds ( ) const

Returns a list of the rule IDs for rules present in the registry.

Definition at line 30 of file qgslabelingengineruleregistry.cpp.


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