QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
QgsCategorizedSymbolRendererV2 Class Reference

#include <qgscategorizedsymbolrendererv2.h>

Inheritance diagram for QgsCategorizedSymbolRendererV2:
Inheritance graph
[legend]

Public Member Functions

 QgsCategorizedSymbolRendererV2 (QString attrName=QString(), QgsCategoryList categories=QgsCategoryList())
virtual ~QgsCategorizedSymbolRendererV2 ()
void addCategory (const QgsRendererCategoryV2 &category)
virtual int capabilities () override
 returns bitwise OR-ed capabilities of the renderer
const QgsCategoryListcategories () const
int categoryIndexForLabel (QString val)
 return index of category with specified label (-1 if not found or not unique)
int categoryIndexForValue (QVariant val)
 return index of category with specified value (-1 if not found)
virtual void checkLegendSymbolItem (QString key, bool state=true) override
 item in symbology was checked
QString classAttribute () const
virtual QgsFeatureRendererV2clone () const override
void deleteAllCategories ()
bool deleteCategory (int catIndex)
virtual QString dump () const override
 for debugging
bool invertedColorRamp ()
virtual QString legendClassificationAttribute () const override
 If supported by the renderer, return classification attribute for the use in legend.
virtual bool legendSymbolItemChecked (QString key) override
 item in symbology was checked
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, QString rule=QString()) override
 return a list of item text / symbol
virtual bool legendSymbolItemsCheckable () const override
 items of symbology items in legend should be checkable
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize) override
 return a list of symbology items for the legend
void moveCategory (int from, int to)
 Moves the category at index position from to index position to.
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature) override
 Return symbol for feature.
QString rotationField () const override
 return rotation field name (or empty string if not set or not supported by renderer)
virtual QDomElement save (QDomDocument &doc) override
 store renderer info to XML element
QgsSymbolV2::ScaleMethod scaleMethod () const
void setClassAttribute (QString attr)
void setInvertedColorRamp (bool inverted)
void setRotationField (QString fieldOrExpression) override
 sets rotation field of renderer (if supported by the renderer)
void setScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
void setSizeScaleField (QString fieldOrExpression)
void setSourceColorRamp (QgsVectorColorRampV2 *ramp)
void setSourceSymbol (QgsSymbolV2 *sym)
QString sizeScaleField () const
void sortByLabel (Qt::SortOrder order=Qt::AscendingOrder)
void sortByValue (Qt::SortOrder order=Qt::AscendingOrder)
QgsVectorColorRampV2sourceColorRamp ()
QgsSymbolV2sourceSymbol ()
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
virtual void stopRender (QgsRenderContext &context) override
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature) override
 to be overridden
virtual QgsSymbolV2List symbols () override
 for symbol levels
virtual void toSld (QDomDocument &doc, QDomElement &element) const override
 used from subclasses to create SLD Rule elements following SLD v1.1 specs
bool updateCategoryLabel (int catIndex, QString label)
bool updateCategoryRenderState (int catIndex, bool render)
bool updateCategorySymbol (int catIndex, QgsSymbolV2 *symbol)
bool updateCategoryValue (int catIndex, const QVariant &value)
void updateColorRamp (QgsVectorColorRampV2 *ramp, bool inverted=false)
void updateSymbols (QgsSymbolV2 *sym)
virtual QList< QString > usedAttributes () override
- Public Member Functions inherited from QgsFeatureRendererV2
virtual ~QgsFeatureRendererV2 ()
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend.
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering.
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 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)
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)
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 return list of symbols used for rendering the feature.
QString type () const
bool usingSymbolLevels () const
virtual bool willRenderFeature (QgsFeature &feat)
 return whether the renderer will render a feature or not.
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
QgsCategorizedSymbolRendererV2
convertFromRenderer (const QgsFeatureRendererV2 *renderer)
 creates a QgsCategorizedSymbolRendererV2 from an existing renderer.
static QgsFeatureRendererV2create (QDomElement &element)
 create renderer from XML element
- Static Public Member Functions inherited from QgsFeatureRendererV2
static QgsFeatureRendererV2defaultRenderer (QGis::GeometryType geomType)
 return a new renderer - used by default in vector layers
static QgsFeatureRendererV2load (QDomElement &symbologyElem)
 create a renderer from XML element
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

Protected Member Functions

void rebuildHash ()
QgsSymbolV2symbolForValue (QVariant value)
- 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)

Protected Attributes

QString mAttrName
int mAttrNum
 attribute index (derived from attribute name in startRender)
QgsCategoryList mCategories
bool mCounting
QScopedPointer< QgsExpressionmExpression
bool mInvertedColorRamp
QScopedPointer< QgsExpressionmRotation
QgsSymbolV2::ScaleMethod mScaleMethod
QScopedPointer< QgsExpressionmSizeScale
QScopedPointer
< QgsVectorColorRampV2
mSourceColorRamp
QScopedPointer< QgsSymbolV2mSourceSymbol
QHash< QString, QgsSymbolV2 * > mSymbolHash
 hashtable for faster access to symbols
QHash< QgsSymbolV2
*, QgsSymbolV2 * > 
mTempSymbols
 temporary symbols, used for data-defined rotation and scaling
- 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

Static Protected Attributes

static QgsMarkerSymbolV2 sSkipRender

Additional Inherited Members

- Public Types inherited from QgsFeatureRendererV2
enum  Capabilities {
  SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3,
  ScaleDependent = 1 << 4
}
- 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)

Detailed Description

Definition at line 70 of file qgscategorizedsymbolrendererv2.h.

Constructor & Destructor Documentation

QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2 ( QString  attrName = QString(),
QgsCategoryList  categories = QgsCategoryList() 
)

Definition at line 145 of file qgscategorizedsymbolrendererv2.cpp.

QgsCategorizedSymbolRendererV2::~QgsCategorizedSymbolRendererV2 ( )
virtual

Definition at line 166 of file qgscategorizedsymbolrendererv2.cpp.

Member Function Documentation

void QgsCategorizedSymbolRendererV2::addCategory ( const QgsRendererCategoryV2 category)

Definition at line 322 of file qgscategorizedsymbolrendererv2.cpp.

virtual int QgsCategorizedSymbolRendererV2::capabilities ( )
inlineoverridevirtual

returns bitwise OR-ed capabilities of the renderer

Reimplemented from QgsFeatureRendererV2.

Definition at line 95 of file qgscategorizedsymbolrendererv2.h.

const QgsCategoryList& QgsCategorizedSymbolRendererV2::categories ( ) const
inline

Definition at line 100 of file qgscategorizedsymbolrendererv2.h.

int QgsCategorizedSymbolRendererV2::categoryIndexForLabel ( QString  val)

return index of category with specified label (-1 if not found or not unique)

Note
added in 2.5

Definition at line 274 of file qgscategorizedsymbolrendererv2.cpp.

int QgsCategorizedSymbolRendererV2::categoryIndexForValue ( QVariant  val)

return index of category with specified value (-1 if not found)

Definition at line 264 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::checkLegendSymbolItem ( QString  key,
bool  state = true 
)
overridevirtual

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

Definition at line 793 of file qgscategorizedsymbolrendererv2.cpp.

QString QgsCategorizedSymbolRendererV2::classAttribute ( ) const
inline

Definition at line 126 of file qgscategorizedsymbolrendererv2.h.

QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::clone ( ) const
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 481 of file qgscategorizedsymbolrendererv2.cpp.

QgsCategorizedSymbolRendererV2 * QgsCategorizedSymbolRendererV2::convertFromRenderer ( const QgsFeatureRendererV2 renderer)
static

creates a QgsCategorizedSymbolRendererV2 from an existing renderer.

Note
added in 2.5
Returns
a new renderer if the conversion was possible, otherwise 0.

Definition at line 803 of file qgscategorizedsymbolrendererv2.cpp.

QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::create ( QDomElement &  element)
static

create renderer from XML element

Definition at line 523 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::deleteAllCategories ( )

Definition at line 342 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::deleteCategory ( int  catIndex)

Definition at line 333 of file qgscategorizedsymbolrendererv2.cpp.

QString QgsCategorizedSymbolRendererV2::dump ( ) const
overridevirtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 473 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::invertedColorRamp ( )
inline
Note
added in 2.1

Definition at line 149 of file qgscategorizedsymbolrendererv2.h.

virtual QString QgsCategorizedSymbolRendererV2::legendClassificationAttribute ( ) const
inlineoverridevirtual

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

Note
added in 2.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 179 of file qgscategorizedsymbolrendererv2.h.

bool QgsCategorizedSymbolRendererV2::legendSymbolItemChecked ( QString  key)
overridevirtual

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

Definition at line 783 of file qgscategorizedsymbolrendererv2.cpp.

QgsLegendSymbolList QgsCategorizedSymbolRendererV2::legendSymbolItems ( double  scaleDenominator = -1,
QString  rule = QString() 
)
overridevirtual

return a list of item text / symbol

Note
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 677 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::legendSymbolItemsCheckable ( ) const
overridevirtual

items of symbology items in legend should be checkable

Note
added in 2.5

Reimplemented from QgsFeatureRendererV2.

Definition at line 778 of file qgscategorizedsymbolrendererv2.cpp.

QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
overridevirtual

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 664 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::moveCategory ( int  from,
int  to 
)

Moves the category at index position from to index position to.

Definition at line 347 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::originalSymbolForFeature ( QgsFeature feature)
overridevirtual

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 from QgsFeatureRendererV2.

Definition at line 235 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::rebuildHash ( )
protected

Definition at line 170 of file qgscategorizedsymbolrendererv2.cpp.

QString QgsCategorizedSymbolRendererV2::rotationField ( ) const
overridevirtual

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

Reimplemented from QgsFeatureRendererV2.

Definition at line 741 of file qgscategorizedsymbolrendererv2.cpp.

QDomElement QgsCategorizedSymbolRendererV2::save ( QDomDocument &  doc)
overridevirtual

store renderer info to XML element

Reimplemented from QgsFeatureRendererV2.

Definition at line 598 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::scaleMethod ( ) const
inline

Definition at line 163 of file qgscategorizedsymbolrendererv2.h.

void QgsCategorizedSymbolRendererV2::setClassAttribute ( QString  attr)
inline

Definition at line 127 of file qgscategorizedsymbolrendererv2.h.

void QgsCategorizedSymbolRendererV2::setInvertedColorRamp ( bool  inverted)
inline

Definition at line 150 of file qgscategorizedsymbolrendererv2.h.

void QgsCategorizedSymbolRendererV2::setRotationField ( QString  fieldName)
overridevirtual

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

Reimplemented from QgsFeatureRendererV2.

Definition at line 736 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::setScaleMethod ( QgsSymbolV2::ScaleMethod  scaleMethod)

Definition at line 768 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::setSizeScaleField ( QString  fieldOrExpression)

Definition at line 746 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::setSourceColorRamp ( QgsVectorColorRampV2 ramp)

Definition at line 707 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::setSourceSymbol ( QgsSymbolV2 sym)

Definition at line 697 of file qgscategorizedsymbolrendererv2.cpp.

QString QgsCategorizedSymbolRendererV2::sizeScaleField ( ) const

Definition at line 751 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::sortByLabel ( Qt::SortOrder  order = Qt::AscendingOrder)

Definition at line 384 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::sortByValue ( Qt::SortOrder  order = Qt::AscendingOrder)

Definition at line 362 of file qgscategorizedsymbolrendererv2.cpp.

QgsVectorColorRampV2 * QgsCategorizedSymbolRendererV2::sourceColorRamp ( )

Definition at line 702 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::sourceSymbol ( )

Definition at line 693 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::startRender ( QgsRenderContext context,
const QgsFields fields 
)
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 396 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::stopRender ( QgsRenderContext context)
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 427 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForFeature ( QgsFeature feature)
overridevirtual

to be overridden

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

Implements QgsFeatureRendererV2.

Definition at line 201 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForValue ( QVariant  value)
protected

Definition at line 181 of file qgscategorizedsymbolrendererv2.cpp.

QgsSymbolV2List QgsCategorizedSymbolRendererV2::symbols ( )
overridevirtual

for symbol levels

Implements QgsFeatureRendererV2.

Definition at line 515 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::toSld ( QDomDocument &  doc,
QDomElement &  element 
) const
overridevirtual

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

Reimplemented from QgsFeatureRendererV2.

Definition at line 498 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::updateCategoryLabel ( int  catIndex,
QString  label 
)

Definition at line 306 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::updateCategoryRenderState ( int  catIndex,
bool  render 
)
Note
added in 2.5

Definition at line 314 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::updateCategorySymbol ( int  catIndex,
QgsSymbolV2 symbol 
)

Definition at line 298 of file qgscategorizedsymbolrendererv2.cpp.

bool QgsCategorizedSymbolRendererV2::updateCategoryValue ( int  catIndex,
const QVariant &  value 
)

Definition at line 290 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::updateColorRamp ( QgsVectorColorRampV2 ramp,
bool  inverted = false 
)
Note
added in 2.5

Definition at line 712 of file qgscategorizedsymbolrendererv2.cpp.

void QgsCategorizedSymbolRendererV2::updateSymbols ( QgsSymbolV2 sym)

Definition at line 756 of file qgscategorizedsymbolrendererv2.cpp.

QList< QString > QgsCategorizedSymbolRendererV2::usedAttributes ( )
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 444 of file qgscategorizedsymbolrendererv2.cpp.

Member Data Documentation

QString QgsCategorizedSymbolRendererV2::mAttrName
protected

Definition at line 187 of file qgscategorizedsymbolrendererv2.h.

int QgsCategorizedSymbolRendererV2::mAttrNum
protected

attribute index (derived from attribute name in startRender)

Definition at line 198 of file qgscategorizedsymbolrendererv2.h.

QgsCategoryList QgsCategorizedSymbolRendererV2::mCategories
protected

Definition at line 188 of file qgscategorizedsymbolrendererv2.h.

bool QgsCategorizedSymbolRendererV2::mCounting
protected

Definition at line 202 of file qgscategorizedsymbolrendererv2.h.

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mExpression
protected

Definition at line 195 of file qgscategorizedsymbolrendererv2.h.

bool QgsCategorizedSymbolRendererV2::mInvertedColorRamp
protected

Definition at line 191 of file qgscategorizedsymbolrendererv2.h.

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mRotation
protected

Definition at line 192 of file qgscategorizedsymbolrendererv2.h.

QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::mScaleMethod
protected

Definition at line 194 of file qgscategorizedsymbolrendererv2.h.

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mSizeScale
protected

Definition at line 193 of file qgscategorizedsymbolrendererv2.h.

QScopedPointer<QgsVectorColorRampV2> QgsCategorizedSymbolRendererV2::mSourceColorRamp
protected

Definition at line 190 of file qgscategorizedsymbolrendererv2.h.

QScopedPointer<QgsSymbolV2> QgsCategorizedSymbolRendererV2::mSourceSymbol
protected

Definition at line 189 of file qgscategorizedsymbolrendererv2.h.

QHash<QString, QgsSymbolV2*> QgsCategorizedSymbolRendererV2::mSymbolHash
protected

hashtable for faster access to symbols

Definition at line 201 of file qgscategorizedsymbolrendererv2.h.

QHash<QgsSymbolV2*, QgsSymbolV2*> QgsCategorizedSymbolRendererV2::mTempSymbols
protected

temporary symbols, used for data-defined rotation and scaling

Definition at line 205 of file qgscategorizedsymbolrendererv2.h.

QgsMarkerSymbolV2 QgsCategorizedSymbolRendererV2::sSkipRender
staticprotected

Definition at line 211 of file qgscategorizedsymbolrendererv2.h.


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