33 res.reserve(
static_cast< int >( mRules.size() ) );
34 for (
auto &it : mRules )
36 res.append( it.first );
43 auto it = mRules.find(
id );
44 if ( it == mRules.end() )
47 return it->second->displayType();
52 auto it = mRules.find(
id );
53 if ( it == mRules.end() )
56 return it->second->isAvailable();
61 auto it = mRules.find(
id );
62 if ( it == mRules.end() )
65 return it->second->clone();
73 if ( mRules.find( rule->
id() ) != mRules.end() )
79 mRules[ rule->
id() ] = std::unique_ptr< QgsAbstractLabelingEngineRule >( rule );
Abstract base class for labeling engine rules.
virtual QString id() const =0
Returns a string uniquely identifying the rule subclass.
A labeling engine rule which prevents labels being placed overlapping features from a different layer...
A labeling engine rule which prevents labels being placed too far from features from a different laye...
A labeling engine rule which prevents labels being placed too close to features from a different laye...
A labeling engine rule which prevents labels being placed too close to labels from a different layer.
QgsAbstractLabelingEngineRule * create(const QString &id) const
Creates a new rule from the type with matching id.
QgsLabelingEngineRuleRegistry()
Constructor for QgsLabelingEngineRuleRegistry, containing a set of default rules.
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()
bool addRule(QgsAbstractLabelingEngineRule *rule)
Adds a new rule type to the registry.
QString displayType(const QString &id) const
Returns a user-friendly, translated string representing the rule type with matching id.
QStringList ruleIds() const
Returns a list of the rule IDs for rules present in the registry.
void removeRule(const QString &id)
Removes the rule with matching id from the registry.