QGIS API Documentation
2.8.2-Wien
|
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 int | capabilities () override |
returns bitwise OR-ed capabilities of the renderer | |
virtual void | checkLegendSymbolItem (QString key, bool state=true) override |
item in symbology was checked | |
virtual QgsFeatureRendererV2 * | clone () const override |
virtual QString | dump () const override |
for debugging | |
virtual bool | legendSymbolItemChecked (QString key) override |
items of symbology items in legend is checked | |
virtual QgsLegendSymbolList | legendSymbolItems (double scaleDenominator=-1, QString rule="") override |
return a list of item text / symbol | |
virtual bool | legendSymbolItemsCheckable () const override |
items of symbology items in legend should be checkable | |
virtual QgsLegendSymbolListV2 | legendSymbolItemsV2 () const override |
Return a list of symbology items for the legend. | |
virtual QgsLegendSymbologyList | legendSymbologyItems (QSize iconSize) override |
return a list of symbology items for the legend | |
virtual QgsSymbolV2List | originalSymbolsForFeature (QgsFeature &feat) override |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() | |
virtual bool | renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) override |
Rule * | rootRule () |
virtual QDomElement | save (QDomDocument &doc) override |
store renderer info to XML element | |
virtual void | startRender (QgsRenderContext &context, const QgsFields &fields) override |
virtual void | stopRender (QgsRenderContext &context) override |
virtual QgsSymbolV2 * | symbolForFeature (QgsFeature &feature) override |
return symbol for current feature. Should not be used individually: there could be more symbols for a feature | |
virtual QgsSymbolV2List | symbols () override |
for symbol levels | |
virtual QgsSymbolV2List | symbolsForFeature (QgsFeature &feat) override |
return list of symbols used for rendering the feature. | |
virtual void | toSld (QDomDocument &doc, QDomElement &element) const override |
used from subclasses to create SLD Rule elements following SLD v1.1 specs | |
virtual QList< QString > | usedAttributes () override |
virtual bool | willRenderFeature (QgsFeature &feat) override |
return whether the renderer will render a feature or not. | |
Public Member Functions inherited from QgsFeatureRendererV2 | |
virtual | ~QgsFeatureRendererV2 () |
virtual QString | legendClassificationAttribute () const |
If supported by the renderer, return classification attribute for the use in legend. | |
virtual void | modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context) |
Allows for a renderer to modify the extent of a feature request prior to rendering. | |
virtual QgsSymbolV2 * | originalSymbolForFeature (QgsFeature &feature) |
Return symbol for feature. | |
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) | |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
void | setVertexMarkerAppearance (int type, int size) |
set type and size of editing vertex markers for subsequent rendering | |
virtual Q_DECL_DEPRECATED void | startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer) |
QString | type () const |
bool | usingSymbolLevels () const |
virtual Q_DECL_DEPRECATED QDomElement | writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const |
create the SLD UserStyle element following the SLD v1.1 specs | |
virtual QDomElement | writeSld (QDomDocument &doc, const QString &styleName) const |
create the SLD UserStyle element following the SLD v1.1 specs with the given name |
Static Public Member Functions | |
static QgsRuleBasedRendererV2 * | convertFromRenderer (const QgsFeatureRendererV2 *renderer) |
creates a QgsRuleBasedRendererV2 from an existing renderer. | |
static void | convertToDataDefinedSymbology (QgsSymbolV2 *symbol, QString sizeScaleField, QString rotationField) |
helper function to convert the size scale and rotation fields present in some other renderers to data defined symbology | |
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 | |
QList< FeatureToRender > | mCurrentFeatures |
RenderQueue | mRenderQueue |
Rule * | mRootRule |
the root node with hierarchical list of rules | |
Protected Attributes inherited from QgsFeatureRendererV2 | |
int | mCurrentVertexMarkerSize |
The current size of editing marker. | |
int | mCurrentVertexMarkerType |
The current type of editing marker. | |
QString | mType |
bool | mUsingSymbolLevels |
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 | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline | |
void | setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod) |
Static Protected Member Functions inherited from QgsFeatureRendererV2 | |
static const unsigned char * | _getLineString (QPolygonF &pts, QgsRenderContext &context, const unsigned char *wkb) |
static const unsigned char * | _getPoint (QPointF &pt, 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 740 of file qgsrulebasedrendererv2.cpp.
QgsRuleBasedRendererV2::QgsRuleBasedRendererV2 | ( | QgsSymbolV2 * | defaultSymbol | ) |
Constructor for convenience. Creates a root rule and adds a default rule with symbol (takes ownership)
Definition at line 745 of file qgsrulebasedrendererv2.cpp.
QgsRuleBasedRendererV2::~QgsRuleBasedRendererV2 | ( | ) |
Definition at line 752 of file qgsrulebasedrendererv2.cpp.
|
inlineoverridevirtual |
returns bitwise OR-ed capabilities of the renderer
Reimplemented from QgsFeatureRendererV2.
Definition at line 279 of file qgsrulebasedrendererv2.h.
|
overridevirtual |
item in symbology was checked
Reimplemented from QgsFeatureRendererV2.
Definition at line 922 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Implements QgsFeatureRendererV2.
Definition at line 850 of file qgsrulebasedrendererv2.cpp.
|
static |
creates a QgsRuleBasedRendererV2 from an existing renderer.
Definition at line 1074 of file qgsrulebasedrendererv2.cpp.
|
static |
helper function to convert the size scale and rotation fields present in some other renderers to data defined symbology
Definition at line 1205 of file qgsrulebasedrendererv2.cpp.
|
static |
Definition at line 940 of file qgsrulebasedrendererv2.cpp.
|
static |
Definition at line 963 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
for debugging
Reimplemented from QgsFeatureRendererV2.
Definition at line 1052 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
items of symbology items in legend is checked
Reimplemented from QgsFeatureRendererV2.
Definition at line 916 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
return a list of item text / symbol
Reimplemented from QgsFeatureRendererV2.
Definition at line 929 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
items of symbology items in legend should be checkable
Reimplemented from QgsFeatureRendererV2.
Definition at line 911 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Return a list of symbology items for the legend.
Better choice than legendSymbolItems(). Default fallback implementation just uses legendSymbolItems() implementation
Reimplemented from QgsFeatureRendererV2.
Definition at line 934 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
return a list of symbology items for the legend
Reimplemented from QgsFeatureRendererV2.
Definition at line 898 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
Reimplemented from QgsFeatureRendererV2.
Definition at line 1069 of file qgsrulebasedrendererv2.cpp.
|
static |
take a rule and create a list of new rules based on the categories from categorized symbol renderer
Definition at line 997 of file qgsrulebasedrendererv2.cpp.
|
static |
take a rule and create a list of new rules based on the ranges from graduated symbol renderer
Definition at line 1018 of file qgsrulebasedrendererv2.cpp.
|
static |
take a rule and create a list of new rules with intervals of scales given by the passed scale denominators
Definition at line 1033 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 764 of file qgsrulebasedrendererv2.cpp.
|
inline |
Definition at line 283 of file qgsrulebasedrendererv2.h.
|
overridevirtual |
store renderer info to XML element
Reimplemented from QgsFeatureRendererV2.
Definition at line 880 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Implements QgsFeatureRendererV2.
Definition at line 780 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Implements QgsFeatureRendererV2.
Definition at line 803 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
return symbol for current feature. Should not be used individually: there could be more symbols for a feature
Implements QgsFeatureRendererV2.
Definition at line 758 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
for symbol levels
Implements QgsFeatureRendererV2.
Definition at line 875 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
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 1064 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented from QgsFeatureRendererV2.
Definition at line 869 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
Implements QgsFeatureRendererV2.
Definition at line 844 of file qgsrulebasedrendererv2.cpp.
|
overridevirtual |
return whether the renderer will render a feature or not.
Must be called between startRender() and stopRender() calls.
Reimplemented from QgsFeatureRendererV2.
Definition at line 1059 of file qgsrulebasedrendererv2.cpp.
|
protected |
Definition at line 308 of file qgsrulebasedrendererv2.h.
|
protected |
Definition at line 307 of file qgsrulebasedrendererv2.h.
|
protected |
the root node with hierarchical list of rules
Definition at line 304 of file qgsrulebasedrendererv2.h.