QGIS API Documentation  master-3f58142
QgsRuleBasedRendererV2 Class Reference

When drawing a vector layer with rule-based renderer, it goes through the rules and draws features with symbols from rules that match. More...

#include <qgsrulebasedrendererv2.h>

+ Inheritance diagram for QgsRuleBasedRendererV2:
+ Collaboration diagram for QgsRuleBasedRendererV2:

List of all members.

Classes

struct  FeatureToRender
struct  RenderJob
struct  RenderLevel
class  Rule
 This class keeps data about a rules for rule-based renderer. More...

Public Types

enum  FeatureFlags { FeatIsSelected = 1, FeatDrawMarkers = 2 }
typedef QList< RenderLevelRenderQueue
typedef QList< Rule * > RuleList

Public Member Functions

 QgsRuleBasedRendererV2 (QgsRuleBasedRendererV2::Rule *root)
 Constructs the renderer from given tree of rules (takes ownership)
 QgsRuleBasedRendererV2 (QgsSymbolV2 *defaultSymbol)
 Constructor for convenience. Creates a root rule and adds a default rule with symbol (takes ownership)
 ~QgsRuleBasedRendererV2 ()
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer
virtual QgsFeatureRendererV2clone ()
virtual QString dump ()
 for debugging
virtual QgsLegendSymbolList legendSymbolItems ()
 return a list of item text / symbol
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
RulerootRule ()
virtual QDomElement save (QDomDocument &doc)
 store renderer info to XML element
virtual void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
virtual void stopRender (QgsRenderContext &context)
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature)
 return symbol for current feature. Should not be used individually: there could be more symbols for a feature
virtual QgsSymbolV2List symbols ()
 for symbol levels
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 return list of symbols used for rendering the feature.
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs
virtual QList< QString > usedAttributes ()
virtual bool willRenderFeature (QgsFeature &feat)
 return whether the renderer will render a feature or not.

Static Public Member Functions

static QgsFeatureRendererV2create (QDomElement &element)
static QgsFeatureRendererV2createFromSld (QDomElement &element, QGis::GeometryType geomType)
static void refineRuleCategories (Rule *initialRule, QgsCategorizedSymbolRendererV2 *r)
 take a rule and create a list of new rules based on the categories from categorized symbol renderer
static void refineRuleRanges (Rule *initialRule, QgsGraduatedSymbolRendererV2 *r)
 take a rule and create a list of new rules based on the ranges from graduated symbol renderer
static void refineRuleScales (Rule *initialRule, QList< int > scales)
 take a rule and create a list of new rules with intervals of scales given by the passed scale denominators

Protected Attributes

QList< FeatureToRendermCurrentFeatures
RenderQueue mRenderQueue
RulemRootRule
 the root node with hierarchical list of rules

Detailed Description

When drawing a vector layer with rule-based renderer, it goes through the rules and draws features with symbols from rules that match.

Definition at line 34 of file qgsrulebasedrendererv2.h.


Member Typedef Documentation

Definition at line 71 of file qgsrulebasedrendererv2.h.

Definition at line 73 of file qgsrulebasedrendererv2.h.


Member Enumeration Documentation

Enumerator:
FeatIsSelected 
FeatDrawMarkers 

Definition at line 41 of file qgsrulebasedrendererv2.h.


Constructor & Destructor Documentation

Constructs the renderer from given tree of rules (takes ownership)

Definition at line 610 of file qgsrulebasedrendererv2.cpp.

Referenced by clone(), create(), and createFromSld().

Constructor for convenience. Creates a root rule and adds a default rule with symbol (takes ownership)

Definition at line 615 of file qgsrulebasedrendererv2.cpp.

References QgsRuleBasedRendererV2::Rule::appendChild(), and mRootRule.


Member Function Documentation

virtual int QgsRuleBasedRendererV2::capabilities ( ) [inline, virtual]

returns bitwise OR-ed capabilities of the renderer

Note:
added in 2.0

Reimplemented from QgsFeatureRendererV2.

Definition at line 241 of file qgsrulebasedrendererv2.h.

QString QgsRuleBasedRendererV2::dump ( ) [virtual]

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 889 of file qgsrulebasedrendererv2.cpp.

References QgsRuleBasedRendererV2::Rule::dump(), and mRootRule.

return a list of item text / symbol

Note:
: this method was added in version 1.5
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 771 of file qgsrulebasedrendererv2.cpp.

References QgsRuleBasedRendererV2::Rule::legendSymbolItems(), and mRootRule.

Referenced by legendSymbologyItems(), and QgsRuleBasedRendererV2Widget::setRenderingOrder().

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 758 of file qgsrulebasedrendererv2.cpp.

References legendSymbolItems(), and QgsSymbolLayerV2Utils::symbolPreviewPixmap().

void QgsRuleBasedRendererV2::refineRuleScales ( QgsRuleBasedRendererV2::Rule initialRule,
QList< int >  scales 
) [static]

take a rule and create a list of new rules with intervals of scales given by the passed scale denominators

Definition at line 870 of file qgsrulebasedrendererv2.cpp.

References QgsRuleBasedRendererV2::Rule::appendChild(), QgsSymbolV2::clone(), QgsRuleBasedRendererV2::Rule::scaleMaxDenom(), QgsRuleBasedRendererV2::Rule::scaleMinDenom(), and QgsRuleBasedRendererV2::Rule::symbol().

bool QgsRuleBasedRendererV2::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
) [virtual]
QDomElement QgsRuleBasedRendererV2::save ( QDomDocument &  doc) [virtual]

return symbol for current feature. Should not be used individually: there could be more symbols for a feature

Implements QgsFeatureRendererV2.

Definition at line 628 of file qgsrulebasedrendererv2.cpp.

return list of symbols used for rendering the feature.

For renderers that do not support MoreSymbolsPerFeature it is more efficient to use symbolForFeature()

Note:
added in 1.9

Reimplemented from QgsFeatureRendererV2.

Definition at line 901 of file qgsrulebasedrendererv2.cpp.

References mRootRule, and QgsRuleBasedRendererV2::Rule::symbolsForFeature().

void QgsRuleBasedRendererV2::toSld ( QDomDocument &  doc,
QDomElement &  element 
) const [virtual]

used from subclasses to create SLD Rule elements following SLD v1.1 specs

Note:
added in 1.9

Reimplemented from QgsFeatureRendererV2.

Definition at line 729 of file qgsrulebasedrendererv2.cpp.

References mRootRule, and QgsRuleBasedRendererV2::Rule::toSld().

QList< QString > QgsRuleBasedRendererV2::usedAttributes ( ) [virtual]

return whether the renderer will render a feature or not.

Must be called between startRender() and stopRender() calls.

Note:
added in 1.9

Reimplemented from QgsFeatureRendererV2.

Definition at line 896 of file qgsrulebasedrendererv2.cpp.

References mRootRule, and QgsRuleBasedRendererV2::Rule::willRenderFeature().


Member Data Documentation

Definition at line 262 of file qgsrulebasedrendererv2.h.

Referenced by renderFeature(), and stopRender().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines