| 
    QGIS API Documentation
    3.26.3-Buenos Aires (65e4edfdad)
    
   | 
 
 
 
 
Go to the documentation of this file.
   15 #ifndef QGSRULEBASEDLABELING_H 
   16 #define QGSRULEBASEDLABELING_H 
   18 #include "qgis_core.h" 
   19 #include <QStringList> 
   46     typedef QList<QgsRuleBasedLabeling::Rule *> 
RuleList;
 
   47     typedef QMap<QgsRuleBasedLabeling::Rule *, QgsVectorLayerLabelProvider *> 
RuleToProviderMap;
 
   59         Rule( 
QgsPalLayerSettings *settings 
SIP_TRANSFER, 
double maximumScale = 0, 
double minimumScale = 0, 
const QString &filterExp = QString(), 
const QString &description = QString(), 
bool elseRule = 
false );
 
   65         Rule &operator=( 
const Rule &rh ) = 
delete;
 
  125         bool active()
 const { 
return mIsActive; }
 
  132         bool isElse()
 const { 
return mElseRule; }
 
  170         void setDescription( 
const QString &description ) { mDescription = description; }
 
  232         void removeChildAt( 
int i );
 
  276         void subProviderIds( QStringList &list ) const 
SIP_SKIP;
 
  299         bool requiresAdvancedEffects() const;
 
  333         bool isScaleOK( 
double scale ) 
const;
 
  343         void updateElseRules();
 
  346         Rule *mParent = 
nullptr; 
 
  347         std::unique_ptr<QgsPalLayerSettings> mSettings;
 
  348         double mMaximumScale = 0;
 
  349         double mMinimumScale = 0;
 
  351         QString mDescription;
 
  352         bool mElseRule = 
false;
 
  355         bool mIsActive = 
true; 
 
  357         QString mRuleKey = QUuid::createUuid().toString(); 
 
  359         std::unique_ptr<QgsExpression> mFilter;
 
  369     const Rule *rootRule() const 
SIP_SKIP;
 
  376     QString type() const override;
 
  381     QStringList subProviders() const override;
 
  394     bool requiresAdvancedEffects() const override;
 
  395     void toSld( QDomNode &parent, const QVariantMap &props ) const override;
 
  425     QList<QgsAbstractLabelProvider *> 
subProviders() 
override;
 
  429     std::unique_ptr<QgsRuleBasedLabeling> 
mRules;
 
  436 #endif // QGSRULEBASEDLABELING_H 
  
void setRuleKey(const QString &key)
Override the assigned rule key (should be used just internally by rule-based labeling)
 
A child rule for QgsRuleBasedLabeling.
 
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
 
The class is used as a container of context for various read/write operations on other objects.
 
Contains settings for how a map layer will be labeled.
 
std::unique_ptr< QgsRuleBasedLabeling > mRules
owned copy
 
@ Inactive
The rule is inactive.
 
void setActive(bool state)
Sets if this rule is active.
 
Contains information about the context of a rendering operation.
 
QgsRuleBasedLabeling::Rule * parent()
The parent rule.
 
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
 
Abstract base class for all rendered symbols.
 
The QgsVectorLayerLabelProvider class implements a label provider for vector layers....
 
Rule based labeling for a vector layer.
 
void setDescription(const QString &description)
Set a human readable description for this rule.
 
QString filterExpression() const
A filter that will check if this rule applies.
 
bool active() const
Returns if this rule is active.
 
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
 
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
 
const QgsRuleBasedLabeling::Rule * parent() const
The parent rule.
 
QMap< QgsRuleBasedLabeling::Rule *, QgsVectorLayerLabelProvider * > RuleToProviderMap
 
QgsPalLayerSettings * settings() const
Returns the labeling settings.
 
QgsRuleBasedLabeling::RuleToProviderMap mSubProviders
label providers are owned by labeling engine
 
void setIsElse(bool iselse)
Sets if this rule is an ELSE rule.
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
 
double maximumScale() const
Returns the maximum map scale (i.e.
 
QList< QgsRuleBasedLabeling::Rule * > RuleList
 
void setFilterExpression(const QString &filterExp)
Set the expression used to check if a given feature shall be rendered with this rule.
 
virtual QList< QgsAbstractLabelProvider * > subProviders()
Returns list of child providers - useful if the provider needs to put labels into more layers with di...
 
RegisterResult
The result of registering a rule.
 
bool isElse() const
Check if this rule is an ELSE rule.
 
bool dependsOnScale() const
Determines if scale based labeling is active.
 
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
 
A geometry is the spatial representation of a feature.
 
const QgsRuleBasedLabeling::RuleList & children() const
Returns all children rules of this rule.
 
Represents a vector layer which manages a vector based data sets.
 
QString description() const
A human readable description for this rule.
 
virtual QList< QgsLabelFeature * > registerFeature(const QgsFeature &feature, QgsRenderContext &context, const QgsGeometry &obstacleGeometry=QgsGeometry(), const QgsSymbol *symbol=nullptr)
Register a feature for labeling as one or more QgsLabelFeature objects stored into mLabels.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
The QgsLabelFeature class describes a feature that should be used within the labeling engine....
 
virtual bool prepare(QgsRenderContext &context, QSet< QString > &attributeNames)
Prepare for registration of features.
 
double minimumScale() const
Returns the minimum map scale (i.e.
 
QgsRuleBasedLabeling::RuleList & children()
Returns all children rules of this rule.
 
Class for parsing and evaluation of expressions (formerly called "search strings")....
 
QString ruleKey() const
Unique rule identifier (for identification of rule within labeling, used as provider ID)
 
Label provider for rule based labeling.