QGIS API Documentation
2.0.1-Dufour
|
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()) | |
Constructor takes ownership of the symbol. | |
~Rule () | |
QString | dump (int offset=0) const |
QSet< QString > | usedAttributes () |
QgsSymbolV2List | symbols () |
QgsLegendSymbolList | legendSymbolItems () |
bool | isFilterOK (QgsFeature &f) const |
bool | isScaleOK (double scale) const |
QgsSymbolV2 * | symbol () |
QString | label () const |
bool | dependsOnScale () const |
int | scaleMinDenom () const |
int | scaleMaxDenom () const |
QgsExpression * | filter () const |
QString | filterExpression () const |
QString | description () const |
void | setSymbol (QgsSymbolV2 *sym) |
set a new symbol (or NULL). Deletes old symbol. | |
void | setLabel (QString label) |
void | setScaleMinDenom (int scaleMinDenom) |
void | setScaleMaxDenom (int scaleMaxDenom) |
void | setFilterExpression (QString filterExp) |
void | setDescription (QString description) |
Rule * | clone () const |
clone this rule, return new instance | |
void | toSld (QDomDocument &doc, QDomElement &element, QgsStringMap props) |
QDomElement | save (QDomDocument &doc, QgsSymbolV2Map &symbolMap) |
bool | startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer) |
prepare the rule for rendering and its children (build active children array) | |
QSet< int > | collectZLevels () |
get all used z-levels from this rule and children | |
void | setNormZLevels (const QMap< int, int > &zLevelsToNormLevels) |
assign normalized z-levels [0..N-1] for this rule's symbol for quick access during rendering | |
bool | renderFeature (FeatureToRender &featToRender, QgsRenderContext &context, RenderQueue &renderQueue) |
bool | willRenderFeature (QgsFeature &feat) |
only tell whether a feature will be rendered without actually rendering it | |
QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) |
tell which symbols will be used to render the feature | |
RuleList | rulesForFeature (QgsFeature &feat) |
tell which rules will be used to render the feature | |
void | stopRender (QgsRenderContext &context) |
RuleList & | children () |
RuleList | descendants () const |
Rule * | parent () |
void | appendChild (Rule *rule) |
add child rule, take ownership, sets this as parent | |
void | insertChild (int i, Rule *rule) |
add child rule, take ownership, sets this as parent | |
void | removeChild (Rule *rule) |
delete child rule | |
void | removeChildAt (int i) |
delete child rule | |
void | takeChild (Rule *rule) |
take child rule out, set parent as null | |
Rule * | takeChildAt (int i) |
take child rule out, set parent as null |
Static Public Member Functions | |
static Rule * | createFromSld (QDomElement &element, QGis::GeometryType geomType) |
static Rule * | create (QDomElement &ruleElem, QgsSymbolV2Map &symbolMap) |
Protected Member Functions | |
void | initFilter () |
Protected Attributes | |
Rule * | mParent |
QgsSymbolV2 * | mSymbol |
int | mScaleMinDenom |
int | mScaleMaxDenom |
QString | mFilterExp |
QString | mLabel |
QString | mDescription |
bool | mElseRule |
RuleList | mChildren |
QgsExpression * | mFilter |
QList< int > | mSymbolNormZLevels |
RuleList | mActiveChildren |
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() |
||
) |
Constructor takes ownership of the symbol.
Definition at line 32 of file qgsrulebasedrendererv2.cpp.
References initFilter().
QgsRuleBasedRendererV2::Rule::~Rule | ( | ) |
Definition at line 41 of file qgsrulebasedrendererv2.cpp.
|
inline |
add child rule, take ownership, sets this as parent
Definition at line 155 of file qgsrulebasedrendererv2.h.
References mParent.
Referenced by clone(), create(), QgsRuleBasedRendererV2::createFromSld(), QgsRuleBasedRendererV2::QgsRuleBasedRendererV2(), QgsRuleBasedRendererV2::refineRuleCategories(), QgsRuleBasedRendererV2::refineRuleRanges(), QgsRuleBasedRendererV2::refineRuleScales(), and save().
|
inline |
Definition at line 150 of file qgsrulebasedrendererv2.h.
Referenced by descendants().
QgsRuleBasedRendererV2::Rule * QgsRuleBasedRendererV2::Rule::clone | ( | ) | const |
clone this rule, return new instance
Definition at line 155 of file qgsrulebasedrendererv2.cpp.
References appendChild(), QgsSymbolV2::clone(), and clone().
Referenced by clone(), and QgsRuleBasedRendererV2::clone().
QSet< int > QgsRuleBasedRendererV2::Rule::collectZLevels | ( | ) |
get all used z-levels from this rule and children
Definition at line 313 of file qgsrulebasedrendererv2.cpp.
References collectZLevels().
Referenced by collectZLevels(), and QgsRuleBasedRendererV2::startRender().
|
static |
Definition at line 449 of file qgsrulebasedrendererv2.cpp.
References appendChild(), QgsRuleBasedRendererV2::create(), and QgsDebugMsg.
Referenced by QgsRuleBasedRendererV2::create().
|
static |
Definition at line 490 of file qgsrulebasedrendererv2.cpp.
References QgsSymbolLayerV2Utils::createSymbolLayerV2ListFromSld(), QgsExpression::dump(), QgsOgcUtils::expressionFromOgcFilter(), QgsExpression::hasParserError(), QGis::Line, QgsExpression::parserErrorString(), QGis::Point, QGis::Polygon, and QgsDebugMsg.
Referenced by QgsRuleBasedRendererV2::createFromSld().
|
inline |
Definition at line 102 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 151 of file qgsrulebasedrendererv2.h.
References children().
|
inline |
Definition at line 107 of file qgsrulebasedrendererv2.h.
QString QgsRuleBasedRendererV2::Rule::dump | ( | int | offset = 0 | ) | const |
Definition at line 62 of file qgsrulebasedrendererv2.cpp.
References dump().
Referenced by dump(), and QgsRuleBasedRendererV2::dump().
|
inline |
Definition at line 105 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 106 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 49 of file qgsrulebasedrendererv2.cpp.
Referenced by Rule().
|
inline |
add child rule, take ownership, sets this as parent
Definition at line 157 of file qgsrulebasedrendererv2.h.
References mParent.
bool QgsRuleBasedRendererV2::Rule::isFilterOK | ( | QgsFeature & | f | ) | const |
Definition at line 133 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::isScaleOK | ( | double | scale | ) | const |
Definition at line 142 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 101 of file qgsrulebasedrendererv2.h.
QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems | ( | ) |
Definition at line 118 of file qgsrulebasedrendererv2.cpp.
References legendSymbolItems().
Referenced by legendSymbolItems(), and QgsRuleBasedRendererV2::legendSymbolItems().
|
inline |
Definition at line 152 of file qgsrulebasedrendererv2.h.
|
inline |
delete child rule
Definition at line 159 of file qgsrulebasedrendererv2.h.
|
inline |
delete child rule
Definition at line 161 of file qgsrulebasedrendererv2.h.
bool QgsRuleBasedRendererV2::Rule::renderFeature | ( | QgsRuleBasedRendererV2::FeatureToRender & | featToRender, |
QgsRenderContext & | context, | ||
QgsRuleBasedRendererV2::RenderQueue & | renderQueue | ||
) |
Definition at line 357 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::FeatureToRender::feat, and renderFeature().
Referenced by renderFeature(), and QgsRuleBasedRendererV2::renderFeature().
QgsRuleBasedRendererV2::RuleList QgsRuleBasedRendererV2::Rule::rulesForFeature | ( | QgsFeature & | feat | ) |
tell which rules will be used to render the feature
Definition at line 417 of file qgsrulebasedrendererv2.cpp.
References rulesForFeature().
Referenced by rulesForFeature().
QDomElement QgsRuleBasedRendererV2::Rule::save | ( | QDomDocument & | doc, |
QgsSymbolV2Map & | symbolMap | ||
) |
Definition at line 165 of file qgsrulebasedrendererv2.cpp.
References appendChild(), and save().
Referenced by save(), and QgsRuleBasedRendererV2::save().
|
inline |
Definition at line 104 of file qgsrulebasedrendererv2.h.
Referenced by QgsRuleBasedRendererV2::refineRuleScales().
|
inline |
Definition at line 103 of file qgsrulebasedrendererv2.h.
Referenced by QgsRuleBasedRendererV2::refineRuleScales().
|
inline |
Definition at line 115 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 114 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 111 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 337 of file qgsrulebasedrendererv2.cpp.
References setNormZLevels().
Referenced by setNormZLevels(), and QgsRuleBasedRendererV2::startRender().
|
inline |
Definition at line 113 of file qgsrulebasedrendererv2.h.
|
inline |
Definition at line 112 of file qgsrulebasedrendererv2.h.
void QgsRuleBasedRendererV2::Rule::setSymbol | ( | QgsSymbolV2 * | sym | ) |
set a new symbol (or NULL). Deletes old symbol.
Definition at line 112 of file qgsrulebasedrendererv2.cpp.
bool QgsRuleBasedRendererV2::Rule::startRender | ( | QgsRenderContext & | context, |
const QgsVectorLayer * | vlayer | ||
) |
prepare the rule for rendering and its children (build active children array)
Definition at line 285 of file qgsrulebasedrendererv2.cpp.
References QgsVectorLayer::pendingFields(), QgsRenderContext::rendererScale(), and startRender().
Referenced by startRender(), and QgsRuleBasedRendererV2::startRender().
void QgsRuleBasedRendererV2::Rule::stopRender | ( | QgsRenderContext & | context | ) |
Definition at line 434 of file qgsrulebasedrendererv2.cpp.
References stopRender().
Referenced by stopRender(), and QgsRuleBasedRendererV2::stopRender().
|
inline |
Definition at line 100 of file qgsrulebasedrendererv2.h.
Referenced by QgsRuleBasedRendererV2::refineRuleScales().
QgsSymbolV2List QgsRuleBasedRendererV2::Rule::symbols | ( | ) |
Definition at line 98 of file qgsrulebasedrendererv2.cpp.
References symbols().
Referenced by symbols(), and QgsRuleBasedRendererV2::symbols().
QgsSymbolV2List QgsRuleBasedRendererV2::Rule::symbolsForFeature | ( | QgsFeature & | feat | ) |
tell which symbols will be used to render the feature
Definition at line 401 of file qgsrulebasedrendererv2.cpp.
References symbolsForFeature().
Referenced by symbolsForFeature(), and QgsRuleBasedRendererV2::symbolsForFeature().
|
inline |
take child rule out, set parent as null
Definition at line 163 of file qgsrulebasedrendererv2.h.
References mParent.
|
inline |
take child rule out, set parent as null
Definition at line 165 of file qgsrulebasedrendererv2.h.
References mParent.
void QgsRuleBasedRendererV2::Rule::toSld | ( | QDomDocument & | doc, |
QDomElement & | element, | ||
QgsStringMap | props | ||
) |
Definition at line 194 of file qgsrulebasedrendererv2.cpp.
References QgsSymbolLayerV2Utils::createFunctionElement(), and QgsRuleBasedRendererV2::symbols().
Referenced by QgsRuleBasedRendererV2::toSld().
QSet< QString > QgsRuleBasedRendererV2::Rule::usedAttributes | ( | ) |
Definition at line 80 of file qgsrulebasedrendererv2.cpp.
References usedAttributes().
Referenced by usedAttributes(), and QgsRuleBasedRendererV2::usedAttributes().
bool QgsRuleBasedRendererV2::Rule::willRenderFeature | ( | QgsFeature & | feat | ) |
only tell whether a feature will be rendered without actually rendering it
Definition at line 385 of file qgsrulebasedrendererv2.cpp.
References willRenderFeature().
Referenced by willRenderFeature(), and QgsRuleBasedRendererV2::willRenderFeature().
|
protected |
Definition at line 181 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 175 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 173 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 174 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 178 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 173 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 173 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 170 of file qgsrulebasedrendererv2.h.
Referenced by appendChild(), insertChild(), takeChild(), and takeChildAt().
|
protected |
Definition at line 172 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 172 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 171 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 180 of file qgsrulebasedrendererv2.h.