QGIS API Documentation
2.12.0-Lyon
|
#include <qgsrulebasedlabeling.h>
Public Types | |
enum | RegisterResult { Filtered = 0, Inactive, Registered } |
The result of registering a rule. More... | |
Public Member Functions | |
Rule (QgsPalLayerSettings *settings, int scaleMinDenom=0, int scaleMaxDenom=0, const QString &filterExp=QString(), const QString &description=QString(), bool elseRule=false) | |
takes ownership of settings More... | |
~Rule () | |
bool | active () const |
Returns if this rule is active. More... | |
void | appendChild (Rule *rule) |
add child rule, take ownership, sets this as parent More... | |
const RuleList & | children () const |
Return all children rules of this rule. More... | |
RuleList & | children () |
Return all children rules of this rule. More... | |
Rule * | clone () const |
clone this rule, return new instance More... | |
void | createSubProviders (QgsVectorLayer *layer, RuleToProviderMap &subProviders) |
add providers More... | |
bool | dependsOnScale () const |
QString | description () const |
A human readable description for this rule. More... | |
QString | filterExpression () const |
A filter that will check if this rule applies. More... | |
void | insertChild (int i, Rule *rule) |
add child rule, take ownership, sets this as parent More... | |
bool | isElse () const |
Check if this rule is an ELSE rule. More... | |
const Rule * | parent () const |
The parent rule. More... | |
Rule * | parent () |
The parent rule. More... | |
void | prepare (const QgsRenderContext &context, QStringList &attributeNames, RuleToProviderMap &subProviders) |
call prepare() on sub-providers and populate attributeNames More... | |
RegisterResult | registerFeature (QgsFeature &feature, QgsRenderContext &context, RuleToProviderMap &subProviders) |
register individual features More... | |
void | removeChildAt (int i) |
delete child rule More... | |
QDomElement | save (QDomDocument &doc) const |
store labeling info to XML element More... | |
int | scaleMaxDenom () const |
int | scaleMinDenom () const |
void | setActive (bool state) |
Sets if this rule is active. More... | |
void | setDescription (const QString &description) |
Set a human readable description for this rule. More... | |
void | setFilterExpression (const QString &filterExp) |
Set the expression used to check if a given feature shall be rendered with this rule. More... | |
void | setIsElse (bool iselse) |
Sets if this rule is an ELSE rule. More... | |
void | setScaleMaxDenom (int scaleMaxDenom) |
Set the maximum denominator for which this rule shall apply. More... | |
void | setScaleMinDenom (int scaleMinDenom) |
Set the minimum denominator for which this rule shall apply. More... | |
void | setSettings (QgsPalLayerSettings *settings) |
set new settings (or NULL). Deletes old settings if any. More... | |
QgsPalLayerSettings * | settings () const |
Static Public Member Functions | |
static Rule * | create (const QDomElement &ruleElem) |
Create a rule from an XML definition. More... | |
Protected Member Functions | |
void | initFilter () |
bool | isFilterOK (QgsFeature &f, QgsRenderContext &context) const |
Check if a given feature shall be labelled by this rule. More... | |
bool | isScaleOK (double scale) const |
Check if this rule applies for a given scale. More... | |
void | updateElseRules () |
Check which child rules are else rules and update the internal list of else rules. More... | |
Protected Attributes | |
RuleList | mChildren |
QString | mDescription |
bool | mElseRule |
RuleList | mElseRules |
QgsExpression * | mFilter |
QString | mFilterExp |
bool | mIsActive |
Rule * | mParent |
int | mScaleMaxDenom |
int | mScaleMinDenom |
QgsPalLayerSettings * | mSettings |
Definition at line 25 of file qgsrulebasedlabeling.h.
The result of registering a rule.
Enumerator | |
---|---|
Filtered |
The rule does not apply. |
Inactive |
The rule is inactive. |
Registered |
Something was registered. |
Definition at line 33 of file qgsrulebasedlabeling.h.
QgsRuleBasedLabeling::Rule::Rule | ( | QgsPalLayerSettings * | settings, |
int | scaleMinDenom = 0 , |
||
int | scaleMaxDenom = 0 , |
||
const QString & | filterExp = QString() , |
||
const QString & | description = QString() , |
||
bool | elseRule = false |
||
) |
takes ownership of settings
Definition at line 45 of file qgsrulebasedlabeling.cpp.
QgsRuleBasedLabeling::Rule::~Rule | ( | ) |
Definition at line 56 of file qgsrulebasedlabeling.cpp.
|
inline |
Returns if this rule is active.
Definition at line 60 of file qgsrulebasedlabeling.h.
void QgsRuleBasedLabeling::Rule::appendChild | ( | QgsRuleBasedLabeling::Rule * | rule | ) |
add child rule, take ownership, sets this as parent
Definition at line 102 of file qgsrulebasedlabeling.cpp.
|
inline |
Return all children rules of this rule.
Definition at line 117 of file qgsrulebasedlabeling.h.
|
inline |
Return all children rules of this rule.
Definition at line 123 of file qgsrulebasedlabeling.h.
QgsRuleBasedLabeling::Rule * QgsRuleBasedLabeling::Rule::clone | ( | ) | const |
clone this rule, return new instance
Definition at line 124 of file qgsrulebasedlabeling.cpp.
|
static |
Create a rule from an XML definition.
ruleElem | The XML rule element |
Definition at line 135 of file qgsrulebasedlabeling.cpp.
void QgsRuleBasedLabeling::Rule::createSubProviders | ( | QgsVectorLayer * | layer, |
QgsRuleBasedLabeling::RuleToProviderMap & | subProviders | ||
) |
add providers
Definition at line 203 of file qgsrulebasedlabeling.cpp.
|
inline |
Definition at line 41 of file qgsrulebasedlabeling.h.
|
inline |
A human readable description for this rule.
Definition at line 54 of file qgsrulebasedlabeling.h.
|
inline |
A filter that will check if this rule applies.
Definition at line 48 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 73 of file qgsrulebasedlabeling.cpp.
void QgsRuleBasedLabeling::Rule::insertChild | ( | int | i, |
QgsRuleBasedLabeling::Rule * | rule | ||
) |
add child rule, take ownership, sets this as parent
Definition at line 109 of file qgsrulebasedlabeling.cpp.
|
inline |
Check if this rule is an ELSE rule.
Definition at line 66 of file qgsrulebasedlabeling.h.
|
protected |
Check if a given feature shall be labelled by this rule.
f | The feature to test |
context | The context in which the rendering happens |
Definition at line 291 of file qgsrulebasedlabeling.cpp.
|
protected |
Check if this rule applies for a given scale.
scale | The scale to check. If set to 0, it will always return true. |
Definition at line 301 of file qgsrulebasedlabeling.cpp.
|
inline |
|
inline |
void QgsRuleBasedLabeling::Rule::prepare | ( | const QgsRenderContext & | context, |
QStringList & | attributeNames, | ||
QgsRuleBasedLabeling::RuleToProviderMap & | subProviders | ||
) |
call prepare() on sub-providers and populate attributeNames
Definition at line 219 of file qgsrulebasedlabeling.cpp.
QgsRuleBasedLabeling::Rule::RegisterResult QgsRuleBasedLabeling::Rule::registerFeature | ( | QgsFeature & | feature, |
QgsRenderContext & | context, | ||
QgsRuleBasedLabeling::RuleToProviderMap & | subProviders | ||
) |
register individual features
Definition at line 244 of file qgsrulebasedlabeling.cpp.
void QgsRuleBasedLabeling::Rule::removeChildAt | ( | int | i | ) |
delete child rule
Definition at line 116 of file qgsrulebasedlabeling.cpp.
QDomElement QgsRuleBasedLabeling::Rule::save | ( | QDomDocument & | doc | ) | const |
store labeling info to XML element
Definition at line 175 of file qgsrulebasedlabeling.cpp.
|
inline |
Definition at line 43 of file qgsrulebasedlabeling.h.
|
inline |
Definition at line 42 of file qgsrulebasedlabeling.h.
|
inline |
Sets if this rule is active.
state | Determines if the rule should be activated or deactivated |
Definition at line 101 of file qgsrulebasedlabeling.h.
|
inline |
Set a human readable description for this rule.
description | Description |
Definition at line 96 of file qgsrulebasedlabeling.h.
|
inline |
Set the expression used to check if a given feature shall be rendered with this rule.
filterExp | An expression |
Definition at line 90 of file qgsrulebasedlabeling.h.
|
inline |
Sets if this rule is an ELSE rule.
iselse | If true, this rule is an ELSE rule |
Definition at line 107 of file qgsrulebasedlabeling.h.
|
inline |
Set the maximum denominator for which this rule shall apply.
E.g. 100'000 if it shall be evaluated between 1:1000 and 1:100'000 Set to 0 to disable the maximum check
scaleMaxDenom | maximum scale denominator for this rule |
Definition at line 84 of file qgsrulebasedlabeling.h.
|
inline |
Set the minimum denominator for which this rule shall apply.
E.g. 1000 if it shall be evaluated between 1:1000 and 1:100'000 Set to 0 to disable the minimum check
scaleMinDenom | The minimum scale denominator for this rule |
Definition at line 77 of file qgsrulebasedlabeling.h.
void QgsRuleBasedLabeling::Rule::setSettings | ( | QgsPalLayerSettings * | settings | ) |
set new settings (or NULL). Deletes old settings if any.
Definition at line 64 of file qgsrulebasedlabeling.cpp.
|
inline |
Definition at line 40 of file qgsrulebasedlabeling.h.
|
protected |
Check which child rules are else rules and update the internal list of else rules.
Definition at line 91 of file qgsrulebasedlabeling.cpp.
|
protected |
Definition at line 202 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 200 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 201 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 203 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 207 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 200 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 204 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 197 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 199 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 199 of file qgsrulebasedlabeling.h.
|
protected |
Definition at line 198 of file qgsrulebasedlabeling.h.