QGIS API Documentation
2.2.0-Valmiera
|
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>
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< RenderLevel > | RenderQueue |
typedef QList< Rule * > | RuleList |
Public Types inherited from QgsFeatureRendererV2 | |
enum | Capabilities { SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 } |
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 QgsSymbolV2 * | symbolForFeature (QgsFeature &feature) |
return symbol for current feature. Should not be used individually: there could be more symbols for a feature | |
virtual bool | 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 QgsFeatureRendererV2 * | clone () |
virtual void | toSld (QDomDocument &doc, QDomElement &element) const |
used from subclasses to create SLD Rule elements following SLD v1.1 specs | |
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 (double scaleDenominator=-1, QString rule="") |
return a list of item text / symbol | |
virtual QString | dump () const |
for debugging | |
virtual bool | willRenderFeature (QgsFeature &feat) |
return whether the renderer will render a feature or not. | |
virtual QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) |
return list of symbols used for rendering the feature. | |
virtual int | capabilities () |
returns bitwise OR-ed capabilities of the renderer | |
Rule * | rootRule () |
Public Member Functions inherited from QgsFeatureRendererV2 | |
QString | type () const |
virtual | ~QgsFeatureRendererV2 () |
bool | usingSymbolLevels () const |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
virtual QDomElement | writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const |
create the SLD UserStyle element following the SLD v1.1 specs | |
void | setVertexMarkerAppearance (int type, int size) |
set type and size of editing vertex markers for subsequent rendering | |
virtual QString | rotationField () const |
return rotation field name (or empty string if not set or not supported by renderer) | |
virtual void | setRotationField (QString fieldName) |
sets rotation field of renderer (if supported by the renderer) |
Static Public Member Functions | |
static QgsFeatureRendererV2 * | create (QDomElement &element) |
static QgsFeatureRendererV2 * | createFromSld (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 | |
Static Public Member Functions inherited from QgsFeatureRendererV2 | |
static QgsFeatureRendererV2 * | defaultRenderer (QGis::GeometryType geomType) |
return a new renderer - used by default in vector layers | |
static QgsFeatureRendererV2 * | load (QDomElement &symbologyElem) |
create a renderer from XML element | |
static QgsFeatureRendererV2 * | loadSld (const QDomNode &node, QGis::GeometryType geomType, QString &errorMessage) |
create a new renderer according to the information contained in the UserStyle element of a SLD style document |
Protected Attributes | |
Rule * | mRootRule |
the root node with hierarchical list of rules | |
RenderQueue | mRenderQueue |
QList< FeatureToRender > | mCurrentFeatures |
Protected Attributes inherited from QgsFeatureRendererV2 | |
QString | mType |
bool | mUsingSymbolLevels |
int | mCurrentVertexMarkerType |
The current type of editing marker. | |
int | mCurrentVertexMarkerSize |
The current size of editing marker. |
Additional Inherited Members | |
Protected Member Functions inherited from QgsFeatureRendererV2 | |
QgsFeatureRendererV2 (QString type) | |
void | renderFeatureWithSymbol (QgsFeature &feature, QgsSymbolV2 *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker) |
void | renderVertexMarker (QPointF &pt, QgsRenderContext &context) |
render editing vertex marker at specified point | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline | |
void | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon | |
void | setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod) |
Static Protected Member Functions inherited from QgsFeatureRendererV2 | |
static const unsigned char * | _getPoint (QPointF &pt, QgsRenderContext &context, const unsigned char *wkb) |
static const unsigned char * | _getLineString (QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb) |
static const unsigned char * | _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, const unsigned char *wkb) |
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.
typedef QList<RenderLevel> QgsRuleBasedRendererV2::RenderQueue |
Definition at line 71 of file qgsrulebasedrendererv2.h.
typedef QList<Rule*> QgsRuleBasedRendererV2::RuleList |
Definition at line 73 of file qgsrulebasedrendererv2.h.
Definition at line 41 of file qgsrulebasedrendererv2.h.
QgsRuleBasedRendererV2::QgsRuleBasedRendererV2 | ( | QgsRuleBasedRendererV2::Rule * | root | ) |
Constructs the renderer from given tree of rules (takes ownership)
Definition at line 689 of file qgsrulebasedrendererv2.cpp.
Referenced by clone(), create(), and createFromSld().
QgsRuleBasedRendererV2::QgsRuleBasedRendererV2 | ( | QgsSymbolV2 * | defaultSymbol | ) |
Constructor for convenience. Creates a root rule and adds a default rule with symbol (takes ownership)
Definition at line 694 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::appendChild(), and mRootRule.
QgsRuleBasedRendererV2::~QgsRuleBasedRendererV2 | ( | ) |
Definition at line 701 of file qgsrulebasedrendererv2.cpp.
References mRootRule.
|
inlinevirtual |
returns bitwise OR-ed capabilities of the renderer
Reimplemented from QgsFeatureRendererV2.
Definition at line 247 of file qgsrulebasedrendererv2.h.
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 799 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::clone(), mRootRule, QgsRuleBasedRendererV2(), QgsFeatureRendererV2::setUsingSymbolLevels(), and QgsFeatureRendererV2::usingSymbolLevels().
|
static |
Definition at line 856 of file qgsrulebasedrendererv2.cpp.
References QgsSymbolLayerV2Utils::clearSymbolMap(), QgsRuleBasedRendererV2::Rule::create(), QgsSymbolLayerV2Utils::loadSymbols(), and QgsRuleBasedRendererV2().
Referenced by QgsRuleBasedRendererV2::Rule::create(), and QgsRendererV2Registry::QgsRendererV2Registry().
|
static |
Definition at line 879 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::appendChild(), QgsRuleBasedRendererV2::Rule::createFromSld(), and QgsRuleBasedRendererV2().
Referenced by QgsRendererV2Registry::QgsRendererV2Registry().
|
virtual |
for debugging
Reimplemented from QgsFeatureRendererV2.
Definition at line 968 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::dump(), and mRootRule.
|
virtual |
return a list of item text / symbol
Reimplemented from QgsFeatureRendererV2.
Definition at line 850 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::legendSymbolItems(), and mRootRule.
Referenced by legendSymbologyItems().
|
virtual |
return a list of symbology items for the legend
Reimplemented from QgsFeatureRendererV2.
Definition at line 837 of file qgsrulebasedrendererv2.cpp.
References legendSymbolItems(), and QgsSymbolLayerV2Utils::symbolPreviewPixmap().
|
static |
take a rule and create a list of new rules based on the categories from categorized symbol renderer
Definition at line 913 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::appendChild(), QgsCategorizedSymbolRendererV2::categories(), QgsCategorizedSymbolRendererV2::classAttribute(), QgsSymbolV2::clone(), QgsExpression::quotedColumnRef(), QgsExpression::quotedString(), QgsRendererCategoryV2::symbol(), and QgsRendererCategoryV2::value().
|
static |
take a rule and create a list of new rules based on the ranges from graduated symbol renderer
Definition at line 934 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::appendChild(), QgsGraduatedSymbolRendererV2::classAttribute(), QgsSymbolV2::clone(), QgsRendererRangeV2::lowerValue(), QgsExpression::quotedColumnRef(), QgsGraduatedSymbolRendererV2::ranges(), QgsRendererRangeV2::symbol(), and QgsRendererRangeV2::upperValue().
|
static |
take a rule and create a list of new rules with intervals of scales given by the passed scale denominators
Definition at line 949 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::appendChild(), QgsSymbolV2::clone(), QgsRuleBasedRendererV2::Rule::scaleMaxDenom(), QgsRuleBasedRendererV2::Rule::scaleMinDenom(), and QgsRuleBasedRendererV2::Rule::symbol().
|
virtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 713 of file qgsrulebasedrendererv2.cpp.
References FeatDrawMarkers, FeatIsSelected, mCurrentFeatures, mRenderQueue, mRootRule, and QgsRuleBasedRendererV2::Rule::renderFeature().
|
inline |
Definition at line 251 of file qgsrulebasedrendererv2.h.
|
virtual |
store renderer info to XML element
Reimplemented from QgsFeatureRendererV2.
Definition at line 819 of file qgsrulebasedrendererv2.cpp.
References mRootRule, QgsFeatureRendererV2::mUsingSymbolLevels, RENDERER_TAG_NAME, QgsRuleBasedRendererV2::Rule::save(), QgsSymbolLayerV2Utils::saveSymbols(), and symbols().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 729 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::Rule::collectZLevels(), mRenderQueue, mRootRule, QgsDebugMsg, QgsRuleBasedRendererV2::Rule::setNormZLevels(), and QgsRuleBasedRendererV2::Rule::startRender().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 752 of file qgsrulebasedrendererv2.cpp.
References QgsRuleBasedRendererV2::FeatureToRender::feat, FeatDrawMarkers, FeatIsSelected, QgsRuleBasedRendererV2::FeatureToRender::flags, QgsRuleBasedRendererV2::RenderJob::ftr, QgsRuleBasedRendererV2::RenderLevel::jobs, mCurrentFeatures, mRenderQueue, mRootRule, QgsFeatureRendererV2::renderFeatureWithSymbol(), QgsSymbolLayerV2::renderingPass(), QgsRuleBasedRendererV2::Rule::stopRender(), QgsRuleBasedRendererV2::RenderJob::symbol, QgsSymbolV2::symbolLayer(), QgsSymbolV2::symbolLayerCount(), and QgsRuleBasedRendererV2::RenderLevel::zIndex.
|
virtual |
return symbol for current feature. Should not be used individually: there could be more symbols for a feature
Implements QgsFeatureRendererV2.
Definition at line 707 of file qgsrulebasedrendererv2.cpp.
|
virtual |
for symbol levels
Implements QgsFeatureRendererV2.
Definition at line 814 of file qgsrulebasedrendererv2.cpp.
References mRootRule, and QgsRuleBasedRendererV2::Rule::symbols().
Referenced by save(), and QgsRuleBasedRendererV2::Rule::toSld().
|
virtual |
return list of symbols used for rendering the feature.
For renderers that do not support MoreSymbolsPerFeature it is more efficient to use symbolForFeature()
Reimplemented from QgsFeatureRendererV2.
Definition at line 980 of file qgsrulebasedrendererv2.cpp.
References mRootRule, and QgsRuleBasedRendererV2::Rule::symbolsForFeature().
|
virtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented from QgsFeatureRendererV2.
Definition at line 808 of file qgsrulebasedrendererv2.cpp.
References mRootRule, and QgsRuleBasedRendererV2::Rule::toSld().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 793 of file qgsrulebasedrendererv2.cpp.
References mRootRule, and QgsRuleBasedRendererV2::Rule::usedAttributes().
|
virtual |
return whether the renderer will render a feature or not.
Must be called between startRender() and stopRender() calls.
Reimplemented from QgsFeatureRendererV2.
Definition at line 975 of file qgsrulebasedrendererv2.cpp.
References mRootRule, and QgsRuleBasedRendererV2::Rule::willRenderFeature().
|
protected |
Definition at line 268 of file qgsrulebasedrendererv2.h.
Referenced by renderFeature(), and stopRender().
|
protected |
Definition at line 267 of file qgsrulebasedrendererv2.h.
Referenced by renderFeature(), startRender(), and stopRender().
|
protected |
the root node with hierarchical list of rules
Definition at line 264 of file qgsrulebasedrendererv2.h.
Referenced by clone(), dump(), legendSymbolItems(), QgsRuleBasedRendererV2(), renderFeature(), save(), startRender(), stopRender(), symbols(), symbolsForFeature(), toSld(), usedAttributes(), willRenderFeature(), and ~QgsRuleBasedRendererV2().