QGIS API Documentation
2.8.2-Wien
|
This class keeps data about a rules for rule-based renderer. More...
#include <qgsrulebasedrendererv2.h>
Public Member Functions | |
Rule (QgsSymbolV2 *symbol, int scaleMinDenom=0, int scaleMaxDenom=0, QString filterExp=QString(), QString label=QString(), QString description=QString(), bool elseRule=false) | |
Constructor takes ownership of the symbol. | |
~Rule () | |
void | appendChild (Rule *rule) |
add child rule, take ownership, sets this as parent | |
bool | checkState () const |
RuleList & | children () |
Rule * | clone () const |
clone this rule, return new instance | |
QSet< int > | collectZLevels () |
get all used z-levels from this rule and children | |
bool | dependsOnScale () const |
RuleList | descendants () const |
QString | description () const |
QString | dump (int offset=0) const |
QgsExpression * | filter () const |
QString | filterExpression () const |
Rule * | findRuleByKey (QString key) |
Try to find a rule given its unique key. | |
void | insertChild (int i, Rule *rule) |
add child rule, take ownership, sets this as parent | |
bool | isElse () |
bool | isFilterOK (QgsFeature &f) const |
bool | isScaleOK (double scale) const |
QString | label () const |
QgsLegendSymbolList | legendSymbolItems (double scaleDenominator=-1, QString rule="") |
QgsLegendSymbolListV2 | legendSymbolItemsV2 (int currentLevel=-1) const |
Rule * | parent () |
void | removeChild (Rule *rule) |
delete child rule | |
void | removeChildAt (int i) |
delete child rule | |
bool | renderFeature (FeatureToRender &featToRender, QgsRenderContext &context, RenderQueue &renderQueue) |
QString | ruleKey () const |
Unique rule identifier (for identification of rule within renderer) | |
RuleList | rulesForFeature (QgsFeature &feat) |
tell which rules will be used to render the feature | |
QDomElement | save (QDomDocument &doc, QgsSymbolV2Map &symbolMap) |
int | scaleMaxDenom () const |
int | scaleMinDenom () const |
void | setCheckState (bool state) |
void | setDescription (QString description) |
void | setFilterExpression (QString filterExp) |
void | setIsElse (bool iselse) |
void | setLabel (QString label) |
void | setNormZLevels (const QMap< int, int > &zLevelsToNormLevels) |
assign normalized z-levels [0..N-1] for this rule's symbol for quick access during rendering | |
void | setRuleKey (const QString &key) |
Override the assigned rule key (should be used just internally by rule-based renderer) | |
void | setScaleMaxDenom (int scaleMaxDenom) |
void | setScaleMinDenom (int scaleMinDenom) |
void | setSymbol (QgsSymbolV2 *sym) |
set a new symbol (or NULL). Deletes old symbol. | |
bool | startRender (QgsRenderContext &context, const QgsFields &fields) |
prepare the rule for rendering and its children (build active children array) | |
void | stopRender (QgsRenderContext &context) |
QgsSymbolV2 * | symbol () |
QgsSymbolV2List | symbols () |
QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) |
tell which symbols will be used to render the feature | |
void | takeChild (Rule *rule) |
take child rule out, set parent as null | |
Rule * | takeChildAt (int i) |
take child rule out, set parent as null | |
void | toSld (QDomDocument &doc, QDomElement &element, QgsStringMap props) |
void | updateElseRules () |
QSet< QString > | usedAttributes () |
bool | willRenderFeature (QgsFeature &feat) |
only tell whether a feature will be rendered without actually rendering it |
Static Public Member Functions | |
static Rule * | create (QDomElement &ruleElem, QgsSymbolV2Map &symbolMap) |
static Rule * | createFromSld (QDomElement &element, QGis::GeometryType geomType) |
Protected Member Functions | |
void | initFilter () |
Protected Attributes | |
RuleList | mActiveChildren |
bool | mCheckState |
RuleList | mChildren |
QString | mDescription |
bool | mElseRule |
RuleList | mElseRules |
QgsExpression * | mFilter |
QString | mFilterExp |
QString | mLabel |
Rule * | mParent |
QString | mRuleKey |
int | mScaleMaxDenom |
int | mScaleMinDenom |
QgsSymbolV2 * | mSymbol |
QList< int > | mSymbolNormZLevels |
This class keeps data about a rules for rule-based renderer.
A rule consists of a symbol, filter expression and range of scales. If filter is empty, it matches all features. If scale range has both values zero, it matches all scales. If one of the min/max scale denominators is zero, there is no lower/upper bound for scales. A rule matches if both filter and scale range match.
Definition at line 84 of file qgsrulebasedrendererv2.h.
QgsRuleBasedRendererV2::Rule::Rule | ( | QgsSymbolV2 * | symbol, |
int | scaleMinDenom = 0 , |
||
int | scaleMaxDenom = 0 , |
||
QString | filterExp = QString() , |
||
QString | label = QString() , |
||
QString | description = QString() , |
||
bool | elseRule = false |
||
) |
Constructor takes ownership of the symbol.
Definition at line 35 of file qgsrulebasedrendererv2.cpp.
QgsRuleBasedRendererV2::Rule::~Rule | ( | ) |
Definition at line 47 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::appendChild | ( | Rule * | rule | ) |
add child rule, take ownership, sets this as parent
Definition at line 73 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 110 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 160 of file qgsrulebasedrendererv2.h.
QgsRuleBasedRendererV2::Rule * QgsRuleBasedRendererV2::Rule::clone | ( | ) | const |
clone this rule, return new instance
Definition at line 256 of file qgsrulebasedrendererv2.cpp.
QSet< int > QgsRuleBasedRendererV2::Rule::collectZLevels | ( | ) |
get all used z-levels from this rule and children
Definition at line 421 of file qgsrulebasedrendererv2.cpp.
|
static |
Definition at line 575 of file qgsrulebasedrendererv2.cpp.
|
static |
Definition at line 622 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 103 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 161 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 108 of file qgsrulebasedrendererv2.h.
QString QgsRuleBasedRendererV2::Rule::dump | ( | int | offset = 0 | ) | const |
Definition at line 144 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 106 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 107 of file qgsrulebasedrendererv2.h.
QgsRuleBasedRendererV2::Rule * QgsRuleBasedRendererV2::Rule::findRuleByKey | ( | QString | key | ) |
Try to find a rule given its unique key.
Definition at line 117 of file qgsrulebasedrendererv2.cpp.
|
protected |
Definition at line 55 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::insertChild | ( | int | i, |
Rule * | rule | ||
) |
add child rule, take ownership, sets this as parent
Definition at line 80 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 184 of file qgsrulebasedrendererv2.h.
bool QgsRuleBasedRendererV2::Rule::isFilterOK | ( | QgsFeature & | f | ) | const |
Definition at line 234 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::isScaleOK | ( | double | scale | ) | const |
Definition at line 243 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 102 of file qgsrulebasedrendererv2.h.
QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems | ( | double | scaleDenominator = -1 , |
QString | rule = "" |
||
) |
Definition at line 200 of file qgsrulebasedrendererv2.cpp.
QgsLegendSymbolListV2 QgsRuleBasedRendererV2::Rule::legendSymbolItemsV2 | ( | int | currentLevel = -1 | ) | const |
Definition at line 217 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 162 of file qgsrulebasedrendererv2.h.
void QgsRuleBasedRendererV2::Rule::removeChild | ( | Rule * | rule | ) |
delete child rule
Definition at line 87 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::removeChildAt | ( | int | i | ) |
delete child rule
Definition at line 94 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::renderFeature | ( | QgsRuleBasedRendererV2::FeatureToRender & | featToRender, |
QgsRenderContext & | context, | ||
QgsRuleBasedRendererV2::RenderQueue & | renderQueue | ||
) |
Definition at line 465 of file qgsrulebasedrendererv2.cpp.
|
inline |
Unique rule identifier (for identification of rule within renderer)
Definition at line 114 of file qgsrulebasedrendererv2.h.
QgsRuleBasedRendererV2::RuleList QgsRuleBasedRendererV2::Rule::rulesForFeature | ( | QgsFeature & | feat | ) |
tell which rules will be used to render the feature
Definition at line 543 of file qgsrulebasedrendererv2.cpp.
QDomElement QgsRuleBasedRendererV2::Rule::save | ( | QDomDocument & | doc, |
QgsSymbolV2Map & | symbolMap | ||
) |
Definition at line 267 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 105 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 104 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 127 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 125 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 124 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 183 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 121 of file qgsrulebasedrendererv2.h.
void QgsRuleBasedRendererV2::Rule::setNormZLevels | ( | const QMap< int, int > & | zLevelsToNormLevels | ) |
assign normalized z-levels [0..N-1] for this rule's symbol for quick access during rendering
Definition at line 445 of file qgsrulebasedrendererv2.cpp.
|
inline |
Override the assigned rule key (should be used just internally by rule-based renderer)
Definition at line 117 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 123 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 122 of file qgsrulebasedrendererv2.h.
void QgsRuleBasedRendererV2::Rule::setSymbol | ( | QgsSymbolV2 * | sym | ) |
set a new symbol (or NULL). Deletes old symbol.
Definition at line 194 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::startRender | ( | QgsRenderContext & | context, |
const QgsFields & | fields | ||
) |
prepare the rule for rendering and its children (build active children array)
Definition at line 390 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::stopRender | ( | QgsRenderContext & | context | ) |
Definition at line 560 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 101 of file qgsrulebasedrendererv2.h.
QgsSymbolV2List QgsRuleBasedRendererV2::Rule::symbols | ( | ) |
Definition at line 180 of file qgsrulebasedrendererv2.cpp.
QgsSymbolV2List QgsRuleBasedRendererV2::Rule::symbolsForFeature | ( | QgsFeature & | feat | ) |
tell which symbols will be used to render the feature
Definition at line 527 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::takeChild | ( | Rule * | rule | ) |
take child rule out, set parent as null
Definition at line 102 of file qgsrulebasedrendererv2.cpp.
QgsRuleBasedRendererV2::Rule * QgsRuleBasedRendererV2::Rule::takeChildAt | ( | int | i | ) |
take child rule out, set parent as null
Definition at line 109 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::toSld | ( | QDomDocument & | doc, |
QDomElement & | element, | ||
QgsStringMap | props | ||
) |
Definition at line 299 of file qgsrulebasedrendererv2.cpp.
void QgsRuleBasedRendererV2::Rule::updateElseRules | ( | ) |
Definition at line 133 of file qgsrulebasedrendererv2.cpp.
QSet< QString > QgsRuleBasedRendererV2::Rule::usedAttributes | ( | ) |
Definition at line 162 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::willRenderFeature | ( | QgsFeature & | feat | ) |
only tell whether a feature will be rendered without actually rendering it
Definition at line 511 of file qgsrulebasedrendererv2.cpp.
|
protected |
Definition at line 204 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 196 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 194 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 192 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 193 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 195 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 201 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 192 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 192 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 189 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 198 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 191 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 191 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 190 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 203 of file qgsrulebasedrendererv2.h.