Quantum GIS API Documentation  1.7.4
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes
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:
Inheritance graph
[legend]
Collaboration diagram for QgsRuleBasedRendererV2:
Collaboration graph
[legend]

List of all members.

Classes

class  Rule
 This class keeps data about a rules for rule-based renderer. More...

Public Member Functions

 QgsRuleBasedRendererV2 (QgsSymbolV2 *defaultSymbol)
 Constructor. Takes ownership of the default symbol.
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature)
 return symbol for current feature. Should not be used individually: there could be more symbols for a feature
virtual void renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
virtual void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
virtual void stopRender (QgsRenderContext &context)
virtual QList< QString > usedAttributes ()
virtual QgsFeatureRendererV2clone ()
virtual QgsSymbolV2List symbols ()
 for symbol levels
virtual QDomElement save (QDomDocument &doc)
 store renderer info to XML element
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend
virtual QgsLegendSymbolList legendSymbolItems ()
 return a list of item text / symbol
int ruleCount ()
 return the total number of rules
RuleruleAt (int index)
 get reference to rule at index (valid indexes: 0...count-1)
void addRule (const Rule &rule)
 add rule to the end of the list of rules
void insertRule (int index, const Rule &rule)
 insert rule to a specific position of the list of rules
void updateRuleAt (int index, const Rule &rule)
 modify the rule at a specific position of the list of rules
void removeRuleAt (int index)
 remove the rule at the specified index
void swapRules (int index1, int index2)
 swap the two rules specified by the indices

Static Public Member Functions

static QgsFeatureRendererV2create (QDomElement &element)
static QList< RulerefineRuleCategories (Rule &initialRule, QgsCategorizedSymbolRendererV2 *r)
 take a rule and create a list of new rules based on the categories from categorized symbol renderer
static QList< RulerefineRuleRanges (Rule &initialRule, QgsGraduatedSymbolRendererV2 *r)
 take a rule and create a list of new rules based on the ranges from graduated symbol renderer
static QList< RulerefineRuleScales (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< RulemRules
 the list of rules
QgsSymbolV2mDefaultSymbol
 the default symbol, used for the first rule with no filter
QList< Rule * > mCurrentRules
QgsFieldMap mCurrentFields
QgsSymbolV2mCurrentSymbol

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 31 of file qgsrulebasedrendererv2.h.


Constructor & Destructor Documentation

Constructor. Takes ownership of the default symbol.

Definition at line 119 of file qgsrulebasedrendererv2.cpp.

References QgsSymbolV2::clone(), and mRules.

Referenced by clone(), and create().


Member Function Documentation

void QgsRuleBasedRendererV2::addRule ( const Rule rule)

add rule to the end of the list of rules

Definition at line 346 of file qgsrulebasedrendererv2.cpp.

References mRules.

QgsFeatureRendererV2 * QgsRuleBasedRendererV2::create ( QDomElement &  element) [static]
void QgsRuleBasedRendererV2::insertRule ( int  index,
const Rule rule 
)

insert rule to a specific position of the list of rules

Definition at line 351 of file qgsrulebasedrendererv2.cpp.

References mRules.

return a list of item text / symbol

Note:
: this method was added in version 1.5

Reimplemented from QgsFeatureRendererV2.

Definition at line 279 of file qgsrulebasedrendererv2.cpp.

References mRules.

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 268 of file qgsrulebasedrendererv2.cpp.

References mRules, and QgsSymbolLayerV2Utils::symbolPreviewPixmap().

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

remove the rule at the specified index

Definition at line 361 of file qgsrulebasedrendererv2.cpp.

References mRules.

void QgsRuleBasedRendererV2::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
) [virtual]

get reference to rule at index (valid indexes: 0...count-1)

Definition at line 341 of file qgsrulebasedrendererv2.cpp.

References mRules.

return the total number of rules

Definition at line 336 of file qgsrulebasedrendererv2.cpp.

References mRules.

QDomElement QgsRuleBasedRendererV2::save ( QDomDocument &  doc) [virtual]
void QgsRuleBasedRendererV2::startRender ( QgsRenderContext context,
const QgsVectorLayer vlayer 
) [virtual]
void QgsRuleBasedRendererV2::swapRules ( int  index1,
int  index2 
)

swap the two rules specified by the indices

Definition at line 366 of file qgsrulebasedrendererv2.cpp.

References mRules.

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

Implements QgsFeatureRendererV2.

Definition at line 127 of file qgsrulebasedrendererv2.cpp.

References QgsRuleBasedRendererV2::Rule::isFilterOK(), mCurrentFields, mCurrentRules, mCurrentSymbol, QgsRuleBasedRendererV2::Rule::symbol(), and QgsFeatureRendererV2::usingFirstRule().

for symbol levels

Implements QgsFeatureRendererV2.

Definition at line 221 of file qgsrulebasedrendererv2.cpp.

References mRules, and QgsRuleBasedRendererV2::Rule::symbol().

Referenced by save().

void QgsRuleBasedRendererV2::updateRuleAt ( int  index,
const Rule rule 
)

modify the rule at a specific position of the list of rules

Definition at line 356 of file qgsrulebasedrendererv2.cpp.

References mRules.

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

Member Data Documentation

Definition at line 151 of file qgsrulebasedrendererv2.h.

Referenced by renderFeature(), startRender(), stopRender(), and symbolForFeature().

Definition at line 150 of file qgsrulebasedrendererv2.h.

Referenced by renderFeature(), startRender(), stopRender(), and symbolForFeature().

Definition at line 152 of file qgsrulebasedrendererv2.h.

Referenced by renderFeature(), and symbolForFeature().

the default symbol, used for the first rule with no filter

Definition at line 147 of file qgsrulebasedrendererv2.h.

Referenced by clone(), and save().


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