QGIS API Documentation  2.0.1-Dufour
 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 | List of all members
QgsCategorizedSymbolRendererV2 Class Reference

#include <qgscategorizedsymbolrendererv2.h>

Inheritance diagram for QgsCategorizedSymbolRendererV2:
Inheritance graph
[legend]
Collaboration diagram for QgsCategorizedSymbolRendererV2:
Collaboration graph
[legend]

Public Member Functions

 QgsCategorizedSymbolRendererV2 (QString attrName=QString(), QgsCategoryList categories=QgsCategoryList())
virtual ~QgsCategorizedSymbolRendererV2 ()
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature)
 to be overridden
virtual void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
virtual void stopRender (QgsRenderContext &context)
virtual QList< QString > usedAttributes ()
virtual QString dump () const
 for debugging
virtual QgsFeatureRendererV2clone ()
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer
virtual QgsSymbolV2List symbols ()
 for symbol levels
void updateSymbols (QgsSymbolV2 *sym)
const QgsCategoryListcategories ()
int categoryIndexForValue (QVariant val)
 return index of category with specified value (-1 if not found)
bool updateCategoryValue (int catIndex, const QVariant &value)
bool updateCategorySymbol (int catIndex, QgsSymbolV2 *symbol)
bool updateCategoryLabel (int catIndex, QString label)
void addCategory (const QgsRendererCategoryV2 &category)
bool deleteCategory (int catIndex)
void deleteAllCategories ()
void moveCategory (int from, int to)
 Moves the category at index position from to index position to.
void sortByValue (Qt::SortOrder order=Qt::AscendingOrder)
void sortByLabel (Qt::SortOrder order=Qt::AscendingOrder)
QString classAttribute () const
void setClassAttribute (QString attr)
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
QgsSymbolV2sourceSymbol ()
void setSourceSymbol (QgsSymbolV2 *sym)
QgsVectorColorRampV2sourceColorRamp ()
void setSourceColorRamp (QgsVectorColorRampV2 *ramp)
void setRotationField (QString fieldName)
QString rotationField () const
void setSizeScaleField (QString fieldName)
QString sizeScaleField () const
void setScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
QgsSymbolV2::ScaleMethod scaleMethod () const
- Public Member Functions inherited from QgsFeatureRendererV2
QString type () const
virtual ~QgsFeatureRendererV2 ()
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
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 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.

Static Public Member Functions

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 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)

Protected Attributes

QString mAttrName
QgsCategoryList mCategories
QgsSymbolV2mSourceSymbol
QgsVectorColorRampV2mSourceColorRamp
QString mRotationField
QString mSizeScaleField
QgsSymbolV2::ScaleMethod mScaleMethod
int mAttrNum
 attribute index (derived from attribute name in startRender)
int mRotationFieldIdx
int mSizeScaleFieldIdx
QHash< QString, QgsSymbolV2 * > mSymbolHash
 hashtable for faster access to symbols
QHash< QString, QgsSymbolV2 * > mTempSymbols
 temporary symbols, used for data-defined rotation and scaling
- 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

- 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 * _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)

Detailed Description

Definition at line 63 of file qgscategorizedsymbolrendererv2.h.

Constructor & Destructor Documentation

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

Definition at line 137 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories, QgsDebugMsg, and QgsRendererCategoryV2::symbol().

Referenced by clone(), and create().

QgsCategorizedSymbolRendererV2::~QgsCategorizedSymbolRendererV2 ( )
virtual

Definition at line 159 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories, mSourceColorRamp, and mSourceSymbol.

Member Function Documentation

void QgsCategorizedSymbolRendererV2::addCategory ( const QgsRendererCategoryV2 category)
virtual int QgsCategorizedSymbolRendererV2::capabilities ( )
inlinevirtual

returns bitwise OR-ed capabilities of the renderer

Note
added in 2.0

Reimplemented from QgsFeatureRendererV2.

Definition at line 87 of file qgscategorizedsymbolrendererv2.h.

References QgsFeatureRendererV2::Filter.

const QgsCategoryList& QgsCategorizedSymbolRendererV2::categories ( )
inline
int QgsCategorizedSymbolRendererV2::categoryIndexForValue ( QVariant  val)

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

Definition at line 248 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

QString QgsCategorizedSymbolRendererV2::classAttribute ( ) const
inline
QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::clone ( )
virtual
QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::create ( QDomElement &  element)
static
void QgsCategorizedSymbolRendererV2::deleteAllCategories ( )

Definition at line 303 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

bool QgsCategorizedSymbolRendererV2::deleteCategory ( int  catIndex)

Definition at line 294 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

QString QgsCategorizedSymbolRendererV2::dump ( ) const
virtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 426 of file qgscategorizedsymbolrendererv2.cpp.

References mAttrName, and mCategories.

QgsLegendSymbolList QgsCategorizedSymbolRendererV2::legendSymbolItems ( )
virtual

return a list of item text / symbol

Note
: this method was added in version 1.5
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 625 of file qgscategorizedsymbolrendererv2.cpp.

References classAttribute(), QgsRendererCategoryV2::label(), mCategories, and QgsRendererCategoryV2::symbol().

QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
virtual
void QgsCategorizedSymbolRendererV2::moveCategory ( int  from,
int  to 
)

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

Definition at line 308 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

void QgsCategorizedSymbolRendererV2::rebuildHash ( )
protected
QString QgsCategorizedSymbolRendererV2::rotationField ( ) const
inlinevirtual
Note
added in 1.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 138 of file qgscategorizedsymbolrendererv2.h.

Referenced by clone().

QDomElement QgsCategorizedSymbolRendererV2::save ( QDomDocument &  doc)
virtual
QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::scaleMethod ( ) const
inline
Note
added in 2.0

Definition at line 148 of file qgscategorizedsymbolrendererv2.h.

Referenced by clone(), and setScaleMethod().

void QgsCategorizedSymbolRendererV2::setClassAttribute ( QString  attr)
inline

Definition at line 113 of file qgscategorizedsymbolrendererv2.h.

void QgsCategorizedSymbolRendererV2::setRotationField ( QString  fieldName)
inlinevirtual
Note
added in 1.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 136 of file qgscategorizedsymbolrendererv2.h.

Referenced by clone(), and create().

void QgsCategorizedSymbolRendererV2::setScaleMethod ( QgsSymbolV2::ScaleMethod  scaleMethod)
Note
added in 2.0

Definition at line 676 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories, mScaleMethod, scaleMethod(), and QgsFeatureRendererV2::setScaleMethodToSymbol().

Referenced by clone(), and create().

void QgsCategorizedSymbolRendererV2::setSizeScaleField ( QString  fieldName)
inline
Note
added in 1.6

Definition at line 141 of file qgscategorizedsymbolrendererv2.h.

Referenced by clone(), and create().

void QgsCategorizedSymbolRendererV2::setSourceColorRamp ( QgsVectorColorRampV2 ramp)

Definition at line 658 of file qgscategorizedsymbolrendererv2.cpp.

References mSourceColorRamp.

Referenced by clone(), and create().

void QgsCategorizedSymbolRendererV2::setSourceSymbol ( QgsSymbolV2 sym)

Definition at line 648 of file qgscategorizedsymbolrendererv2.cpp.

References mSourceSymbol.

Referenced by clone(), and create().

QString QgsCategorizedSymbolRendererV2::sizeScaleField ( ) const
inline
Note
added in 1.6

Definition at line 143 of file qgscategorizedsymbolrendererv2.h.

Referenced by clone().

void QgsCategorizedSymbolRendererV2::sortByLabel ( Qt::SortOrder  order = Qt::AscendingOrder)
void QgsCategorizedSymbolRendererV2::sortByValue ( Qt::SortOrder  order = Qt::AscendingOrder)
QgsVectorColorRampV2 * QgsCategorizedSymbolRendererV2::sourceColorRamp ( )

Definition at line 654 of file qgscategorizedsymbolrendererv2.cpp.

References mSourceColorRamp.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::sourceSymbol ( )

Definition at line 644 of file qgscategorizedsymbolrendererv2.cpp.

References mSourceSymbol.

void QgsCategorizedSymbolRendererV2::startRender ( QgsRenderContext context,
const QgsVectorLayer vlayer 
)
virtual
void QgsCategorizedSymbolRendererV2::stopRender ( QgsRenderContext context)
virtual

Implements QgsFeatureRendererV2.

Definition at line 385 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories, and mTempSymbols.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForFeature ( QgsFeature feature)
virtual
QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForValue ( QVariant  value)
protected

Definition at line 177 of file qgscategorizedsymbolrendererv2.cpp.

References mSymbolHash, QgsDebugMsg, and QgsDebugMsgLevel.

Referenced by symbolForFeature().

QgsSymbolV2List QgsCategorizedSymbolRendererV2::symbols ( )
virtual

for symbol levels

Implements QgsFeatureRendererV2.

Definition at line 465 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

Referenced by save().

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

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

Note
added in 1.9

Reimplemented from QgsFeatureRendererV2.

Definition at line 448 of file qgscategorizedsymbolrendererv2.cpp.

References mAttrName, mCategories, mRotationField, and mSizeScaleField.

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

Definition at line 274 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

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

Definition at line 266 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

Referenced by updateSymbols().

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

Definition at line 258 of file qgscategorizedsymbolrendererv2.cpp.

References mCategories.

void QgsCategorizedSymbolRendererV2::updateSymbols ( QgsSymbolV2 sym)
QList< QString > QgsCategorizedSymbolRendererV2::usedAttributes ( )
virtual

Member Data Documentation

QString QgsCategorizedSymbolRendererV2::mAttrName
protected
int QgsCategorizedSymbolRendererV2::mAttrNum
protected

attribute index (derived from attribute name in startRender)

Definition at line 160 of file qgscategorizedsymbolrendererv2.h.

Referenced by startRender(), and symbolForFeature().

QgsCategoryList QgsCategorizedSymbolRendererV2::mCategories
protected
QString QgsCategorizedSymbolRendererV2::mRotationField
protected

Definition at line 155 of file qgscategorizedsymbolrendererv2.h.

Referenced by save(), startRender(), toSld(), and usedAttributes().

int QgsCategorizedSymbolRendererV2::mRotationFieldIdx
protected

Definition at line 161 of file qgscategorizedsymbolrendererv2.h.

Referenced by startRender(), and symbolForFeature().

QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::mScaleMethod
protected

Definition at line 157 of file qgscategorizedsymbolrendererv2.h.

Referenced by save(), setScaleMethod(), and symbolForFeature().

QString QgsCategorizedSymbolRendererV2::mSizeScaleField
protected

Definition at line 156 of file qgscategorizedsymbolrendererv2.h.

Referenced by save(), startRender(), toSld(), and usedAttributes().

int QgsCategorizedSymbolRendererV2::mSizeScaleFieldIdx
protected

Definition at line 161 of file qgscategorizedsymbolrendererv2.h.

Referenced by startRender(), and symbolForFeature().

QgsVectorColorRampV2* QgsCategorizedSymbolRendererV2::mSourceColorRamp
protected
QgsSymbolV2* QgsCategorizedSymbolRendererV2::mSourceSymbol
protected
QHash<QString, QgsSymbolV2*> QgsCategorizedSymbolRendererV2::mSymbolHash
protected

hashtable for faster access to symbols

Definition at line 164 of file qgscategorizedsymbolrendererv2.h.

Referenced by rebuildHash(), and symbolForValue().

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

temporary symbols, used for data-defined rotation and scaling

Definition at line 167 of file qgscategorizedsymbolrendererv2.h.

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


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