QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsFeatureRendererV2 Class Referenceabstract

#include <qgsrendererv2.h>

Inheritance diagram for QgsFeatureRendererV2:
Inheritance graph
[legend]

Public Types

enum  Capabilities {
  SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3,
  ScaleDependent = 1 << 4
}
 

Public Member Functions

virtual ~QgsFeatureRendererV2 ()
 
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer More...
 
virtual void checkLegendSymbolItem (QString key, bool state=true)
 item in symbology was checked More...
 
virtual QgsFeatureRendererV2clone () const =0
 
virtual QString dump () const
 for debugging More...
 
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend. More...
 
virtual bool legendSymbolItemChecked (QString key)
 items of symbology items in legend is checked More...
 
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, QString rule="")
 return a list of item text / symbol More...
 
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable More...
 
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend. More...
 
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend More...
 
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature)
 Return symbol for feature. More...
 
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
 
virtual QString rotationField () const
 return rotation field name (or empty string if not set or not supported by renderer) More...
 
virtual QDomElement save (QDomDocument &doc)
 store renderer info to XML element More...
 
virtual void setRotationField (QString fieldName)
 sets rotation field of renderer (if supported by the renderer) More...
 
void setUsingSymbolLevels (bool usingSymbolLevels)
 
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering More...
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields)=0
 
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
 
virtual void stopRender (QgsRenderContext &context)=0
 
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature)=0
 to be overridden More...
 
virtual QgsSymbolV2List symbols ()=0
 for symbol levels More...
 
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 return list of symbols used for rendering the feature. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
QString type () const
 
virtual QList< QString > usedAttributes ()=0
 
bool usingSymbolLevels () const
 
virtual bool willRenderFeature (QgsFeature &feat)
 return whether the renderer will render a feature or not. More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs More...
 

Static Public Member Functions

static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers More...
 
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element More...
 
static QgsFeatureRendererV2loadSld (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 More...
 

Protected Member Functions

 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 More...
 
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon More...
 
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline More...
 
void setScaleMethodToSymbol (QgsSymbolV2 *symbol, int scaleMethod)
 

Static Protected Member Functions

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)
 

Protected Attributes

int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 
int mCurrentVertexMarkerType
 The current type of editing marker. More...
 
QString mType
 
bool mUsingSymbolLevels
 

Detailed Description

Definition at line 72 of file qgsrendererv2.h.

Member Enumeration Documentation

Enumerator
SymbolLevels 
RotationField 
MoreSymbolsPerFeature 
Filter 
ScaleDependent 

Definition at line 114 of file qgsrendererv2.h.

Constructor & Destructor Documentation

virtual QgsFeatureRendererV2::~QgsFeatureRendererV2 ( )
inlinevirtual

Definition at line 105 of file qgsrendererv2.h.

QgsFeatureRendererV2::QgsFeatureRendererV2 ( QString  type)
protected

Definition at line 196 of file qgsrendererv2.cpp.

Member Function Documentation

const unsigned char * QgsFeatureRendererV2::_getLineString ( QPolygonF &  pts,
QgsRenderContext context,
const unsigned char *  wkb 
)
staticprotected

Definition at line 62 of file qgsrendererv2.cpp.

const unsigned char * QgsFeatureRendererV2::_getPoint ( QPointF &  pt,
QgsRenderContext context,
const unsigned char *  wkb 
)
staticprotected

Definition at line 38 of file qgsrendererv2.cpp.

const unsigned char * QgsFeatureRendererV2::_getPolygon ( QPolygonF &  pts,
QList< QPolygonF > &  holes,
QgsRenderContext context,
const unsigned char *  wkb 
)
staticprotected

Definition at line 112 of file qgsrendererv2.cpp.

virtual int QgsFeatureRendererV2::capabilities ( )
inlinevirtual
void QgsFeatureRendererV2::checkLegendSymbolItem ( QString  key,
bool  state = true 
)
virtual

item in symbology was checked

Note
added in 2.5

Reimplemented in QgsGraduatedSymbolRendererV2, QgsRuleBasedRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 523 of file qgsrendererv2.cpp.

virtual QgsFeatureRendererV2* QgsFeatureRendererV2::clone ( ) const
pure virtual
QgsFeatureRendererV2 * QgsFeatureRendererV2::defaultRenderer ( QGis::GeometryType  geomType)
static

return a new renderer - used by default in vector layers

Definition at line 203 of file qgsrendererv2.cpp.

QString QgsFeatureRendererV2::dump ( ) const
virtual
virtual QString QgsFeatureRendererV2::legendClassificationAttribute ( ) const
inlinevirtual

If supported by the renderer, return classification attribute for the use in legend.

Note
added in 2.6

Reimplemented in QgsGraduatedSymbolRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 183 of file qgsrendererv2.h.

bool QgsFeatureRendererV2::legendSymbolItemChecked ( QString  key)
virtual

items of symbology items in legend is checked

Note
added in 2.5

Reimplemented in QgsGraduatedSymbolRendererV2, QgsRuleBasedRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 517 of file qgsrendererv2.cpp.

QgsLegendSymbolList QgsFeatureRendererV2::legendSymbolItems ( double  scaleDenominator = -1,
QString  rule = "" 
)
virtual

return a list of item text / symbol

Note
not available in python bindings

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.

Definition at line 529 of file qgsrendererv2.cpp.

bool QgsFeatureRendererV2::legendSymbolItemsCheckable ( ) const
virtual

items of symbology items in legend should be checkable

Note
added in 2.5

Reimplemented in QgsGraduatedSymbolRendererV2, QgsRuleBasedRendererV2, and QgsCategorizedSymbolRendererV2.

Definition at line 512 of file qgsrendererv2.cpp.

QgsLegendSymbolListV2 QgsFeatureRendererV2::legendSymbolItemsV2 ( ) const
virtual

Return a list of symbology items for the legend.

Better choice than legendSymbolItems(). Default fallback implementation just uses legendSymbolItems() implementation

Note
added in 2.6

Reimplemented in QgsRuleBasedRendererV2, and QgsSingleSymbolRendererV2.

Definition at line 536 of file qgsrendererv2.cpp.

QgsLegendSymbologyList QgsFeatureRendererV2::legendSymbologyItems ( QSize  iconSize)
virtual
QgsFeatureRendererV2 * QgsFeatureRendererV2::load ( QDomElement &  symbologyElem)
static

create a renderer from XML element

Definition at line 373 of file qgsrendererv2.cpp.

QgsFeatureRendererV2 * QgsFeatureRendererV2::loadSld ( const QDomNode &  node,
QGis::GeometryType  geomType,
QString &  errorMessage 
)
static

create a new renderer according to the information contained in the UserStyle element of a SLD style document

Parameters
nodethe node in the SLD document whose the UserStyle element is a child
geomTypethe geometry type of the features, used to convert Symbolizer elements
errorMessageit will contain the error message if something went wrong
Returns
the renderer

Definition at line 401 of file qgsrendererv2.cpp.

virtual QgsSymbolV2* QgsFeatureRendererV2::originalSymbolForFeature ( QgsFeature feature)
inlinevirtual

Return symbol for feature.

The difference compared to symbolForFeature() is that it returns original symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement of a symbol for use in rendering.

Note
added in 2.6

Reimplemented in QgsGraduatedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsCategorizedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.

Definition at line 94 of file qgsrendererv2.h.

QgsSymbolV2List QgsFeatureRendererV2::originalSymbolsForFeature ( QgsFeature feat)
virtual

Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()

Note
added in 2.6

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 590 of file qgsrendererv2.cpp.

bool QgsFeatureRendererV2::renderFeature ( QgsFeature feature,
QgsRenderContext context,
int  layer = -1,
bool  selected = false,
bool  drawVertexMarker = false 
)
virtual
void QgsFeatureRendererV2::renderFeatureWithSymbol ( QgsFeature feature,
QgsSymbolV2 symbol,
QgsRenderContext context,
int  layer,
bool  selected,
bool  drawVertexMarker 
)
protected

Definition at line 224 of file qgsrendererv2.cpp.

void QgsFeatureRendererV2::renderVertexMarker ( QPointF &  pt,
QgsRenderContext context 
)
protected

render editing vertex marker at specified point

Definition at line 554 of file qgsrendererv2.cpp.

void QgsFeatureRendererV2::renderVertexMarkerPolygon ( QPolygonF &  pts,
QList< QPolygonF > *  rings,
QgsRenderContext context 
)
protected

render editing vertex marker for a polygon

Definition at line 567 of file qgsrendererv2.cpp.

void QgsFeatureRendererV2::renderVertexMarkerPolyline ( QPolygonF &  pts,
QgsRenderContext context 
)
protected

render editing vertex marker for a polyline

Definition at line 561 of file qgsrendererv2.cpp.

virtual QString QgsFeatureRendererV2::rotationField ( ) const
inlinevirtual

return rotation field name (or empty string if not set or not supported by renderer)

Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.

Definition at line 189 of file qgsrendererv2.h.

QDomElement QgsFeatureRendererV2::save ( QDomDocument &  doc)
virtual
virtual void QgsFeatureRendererV2::setRotationField ( QString  fieldName)
inlinevirtual

sets rotation field of renderer (if supported by the renderer)

Reimplemented in QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, and QgsSingleSymbolRendererV2.

Definition at line 191 of file qgsrendererv2.h.

void QgsFeatureRendererV2::setScaleMethodToSymbol ( QgsSymbolV2 symbol,
int  scaleMethod 
)
protected

Definition at line 180 of file qgsrendererv2.cpp.

void QgsFeatureRendererV2::setUsingSymbolLevels ( bool  usingSymbolLevels)
inline

Definition at line 130 of file qgsrendererv2.h.

void QgsFeatureRendererV2::setVertexMarkerAppearance ( int  type,
int  size 
)

set type and size of editing vertex markers for subsequent rendering

Definition at line 548 of file qgsrendererv2.cpp.

virtual void QgsFeatureRendererV2::startRender ( QgsRenderContext context,
const QgsFields fields 
)
pure virtual
void QgsFeatureRendererV2::startRender ( QgsRenderContext context,
const QgsVectorLayer vlayer 
)
virtual
Deprecated:
since 2.4 - not using QgsVectorLayer directly anymore

Definition at line 208 of file qgsrendererv2.cpp.

virtual void QgsFeatureRendererV2::stopRender ( QgsRenderContext context)
pure virtual
virtual QgsSymbolV2* QgsFeatureRendererV2::symbolForFeature ( QgsFeature feature)
pure virtual

to be overridden

Parameters
featurefeature
Returns
returns pointer to symbol or 0 if symbol was not found

Implemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsInvertedPolygonRenderer, QgsCategorizedSymbolRendererV2, QgsPointDisplacementRenderer, and QgsSingleSymbolRendererV2.

virtual QgsSymbolV2List QgsFeatureRendererV2::symbols ( )
pure virtual
QgsSymbolV2List QgsFeatureRendererV2::symbolsForFeature ( QgsFeature feat)
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 in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 582 of file qgsrendererv2.cpp.

virtual void QgsFeatureRendererV2::toSld ( QDomDocument &  doc,
QDomElement &  element 
) const
inlinevirtual

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

Reimplemented in QgsRuleBasedRendererV2, QgsGraduatedSymbolRendererV2, QgsCategorizedSymbolRendererV2, QgsSingleSymbolRendererV2, and QgsPointDisplacementRenderer.

Definition at line 154 of file qgsrendererv2.h.

QString QgsFeatureRendererV2::type ( ) const
inline

Definition at line 80 of file qgsrendererv2.h.

virtual QList<QString> QgsFeatureRendererV2::usedAttributes ( )
pure virtual
bool QgsFeatureRendererV2::usingSymbolLevels ( ) const
inline

Definition at line 129 of file qgsrendererv2.h.

virtual bool QgsFeatureRendererV2::willRenderFeature ( QgsFeature feat)
inlinevirtual

return whether the renderer will render a feature or not.

Must be called between startRender() and stopRender() calls. Default implementation uses symbolForFeature().

Reimplemented in QgsRuleBasedRendererV2, QgsInvertedPolygonRenderer, and QgsPointDisplacementRenderer.

Definition at line 196 of file qgsrendererv2.h.

QDomElement QgsFeatureRendererV2::writeSld ( QDomDocument &  doc,
const QgsVectorLayer layer 
) const
virtual

create the SLD UserStyle element following the SLD v1.1 specs

Definition at line 490 of file qgsrendererv2.cpp.

Member Data Documentation

int QgsFeatureRendererV2::mCurrentVertexMarkerSize
protected

The current size of editing marker.

Definition at line 238 of file qgsrendererv2.h.

int QgsFeatureRendererV2::mCurrentVertexMarkerType
protected

The current type of editing marker.

Definition at line 236 of file qgsrendererv2.h.

QString QgsFeatureRendererV2::mType
protected

Definition at line 231 of file qgsrendererv2.h.

bool QgsFeatureRendererV2::mUsingSymbolLevels
protected

Definition at line 233 of file qgsrendererv2.h.


The documentation for this class was generated from the following files: