QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
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. | |
QgsAbstractLabelingEngineRule * | create (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. | |
QgsLabelingEngineRuleRegistry & | operator= (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. | |
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().
Definition at line 38 of file qgslabelingengineruleregistry.h.
QgsLabelingEngineRuleRegistry::QgsLabelingEngineRuleRegistry | ( | ) |
Constructor for QgsLabelingEngineRuleRegistry, containing a set of default rules.
Definition at line 20 of file qgslabelingengineruleregistry.cpp.
|
default |
|
delete |
QgsLabelingEngineRuleRegistry cannot be copied.
bool QgsLabelingEngineRuleRegistry::addRule | ( | QgsAbstractLabelingEngineRule * | rule | ) |
Adds a new rule type to the registry.
The registry takes ownership of rule.
true
if the rule was successfully added.Definition at line 68 of file qgslabelingengineruleregistry.cpp.
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.
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.
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.
|
delete |
QgsLabelingEngineRuleRegistry cannot be copied.
void QgsLabelingEngineRuleRegistry::removeRule | ( | const QString & | id | ) |
Removes the rule with matching id from the registry.
Definition at line 83 of file qgslabelingengineruleregistry.cpp.
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.