QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 ()
 
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature)
 to be overridden More...
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields)
 
virtual void stopRender (QgsRenderContext &context)
 
virtual QList< QString > usedAttributes ()
 
virtual QString dump () const
 for debugging More...
 
virtual QgsFeatureRendererV2clone () const
 
virtual void toSld (QDomDocument &doc, QDomElement &element) const
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
virtual int capabilities ()
 returns bitwise OR-ed capabilities of the renderer More...
 
virtual QgsSymbolV2List symbols ()
 for symbol levels More...
 
void updateSymbols (QgsSymbolV2 *sym)
 
const QgsCategoryListcategories () const
 
int categoryIndexForValue (QVariant val)
 return index of category with specified value (-1 if not found) More...
 
int categoryIndexForLabel (QString val)
 return index of category with specified label (-1 if not found or not unique) More...
 
bool updateCategoryValue (int catIndex, const QVariant &value)
 
bool updateCategorySymbol (int catIndex, QgsSymbolV2 *symbol)
 
bool updateCategoryLabel (int catIndex, QString label)
 
bool updateCategoryRenderState (int catIndex, bool render)
 
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. More...
 
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 More...
 
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize)
 return a list of symbology items for the legend More...
 
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, QString rule=QString())
 return a list of item text / symbol More...
 
QgsSymbolV2sourceSymbol ()
 
void setSourceSymbol (QgsSymbolV2 *sym)
 
QgsVectorColorRampV2sourceColorRamp ()
 
void setSourceColorRamp (QgsVectorColorRampV2 *ramp)
 
bool invertedColorRamp ()
 
void setInvertedColorRamp (bool inverted)
 
void setRotationField (QString fieldOrExpression)
 
QString rotationField () const
 
void setSizeScaleField (QString fieldOrExpression)
 
QString sizeScaleField () const
 
void setScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
 
QgsSymbolV2::ScaleMethod scaleMethod () const
 
virtual bool legendSymbolItemsCheckable () const
 items of symbology items in legend should be checkable More...
 
virtual bool legendSymbolItemChecked (QString key)
 item in symbology was checked More...
 
virtual void checkLegendSymbolItem (QString key, bool state=true)
 item in symbology was checked More...
 
virtual QString legendClassificationAttribute () const
 If supported by the renderer, return classification attribute for the use in legend. More...
 
- Public Member Functions inherited from QgsFeatureRendererV2
QString type () const
 
virtual Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
 
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 More...
 
virtual QgsLegendSymbolListV2 legendSymbolItemsV2 () const
 Return a list of symbology items for the legend. More...
 
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering More...
 
virtual bool willRenderFeature (QgsFeature &feat)
 return whether the renderer will render a feature or not. More...
 
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 return list of symbols used for rendering the feature. More...
 

Static Public Member Functions

static QgsFeatureRendererV2create (QDomElement &element)
 create renderer from XML element More...
 
static
QgsCategorizedSymbolRendererV2
convertFromRenderer (const QgsFeatureRendererV2 *renderer)
 creates a QgsCategorizedSymbolRendererV2 from an existing renderer. More...
 
- Static Public Member Functions inherited from QgsFeatureRendererV2
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

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

Protected Attributes

QString mAttrName
 
QgsCategoryList mCategories
 
QScopedPointer< QgsSymbolV2mSourceSymbol
 
QScopedPointer
< QgsVectorColorRampV2
mSourceColorRamp
 
bool mInvertedColorRamp
 
QScopedPointer< QgsExpressionmRotation
 
QScopedPointer< QgsExpressionmSizeScale
 
QgsSymbolV2::ScaleMethod mScaleMethod
 
QScopedPointer< QgsExpressionmExpression
 
int mAttrNum
 attribute index (derived from attribute name in startRender) More...
 
QHash< QString, QgsSymbolV2 * > mSymbolHash
 hashtable for faster access to symbols More...
 
bool mCounting
 
QHash< QString, QgsSymbolV2 * > mTempSymbols
 temporary symbols, used for data-defined rotation and scaling More...
 
- Protected Attributes inherited from QgsFeatureRendererV2
QString mType
 
bool mUsingSymbolLevels
 
int mCurrentVertexMarkerType
 The current type of editing marker. More...
 
int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 

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

Constructor & Destructor Documentation

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

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.

const QgsCategoryList& QgsCategorizedSymbolRendererV2::categories ( ) const
inline
int QgsCategorizedSymbolRendererV2::categoryIndexForLabel ( QString  val)

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

Note
added in 2.5
int QgsCategorizedSymbolRendererV2::categoryIndexForValue ( QVariant  val)

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

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

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

QString QgsCategorizedSymbolRendererV2::classAttribute ( ) const
inline
QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::clone ( ) const
virtual

Implements QgsFeatureRendererV2.

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.
QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::create ( QDomElement &  element)
static

create renderer from XML element

void QgsCategorizedSymbolRendererV2::deleteAllCategories ( )
bool QgsCategorizedSymbolRendererV2::deleteCategory ( int  catIndex)
QString QgsCategorizedSymbolRendererV2::dump ( ) const
virtual

for debugging

Reimplemented from QgsFeatureRendererV2.

bool QgsCategorizedSymbolRendererV2::invertedColorRamp ( )
inline
Note
added in 2.1
virtual QString QgsCategorizedSymbolRendererV2::legendClassificationAttribute ( ) const
inlinevirtual

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

Note
added in 2.6

Reimplemented from QgsFeatureRendererV2.

bool QgsCategorizedSymbolRendererV2::legendSymbolItemChecked ( QString  key)
virtual

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

QgsLegendSymbolList QgsCategorizedSymbolRendererV2::legendSymbolItems ( double  scaleDenominator = -1,
QString  rule = QString() 
)
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.

bool QgsCategorizedSymbolRendererV2::legendSymbolItemsCheckable ( ) const
virtual

items of symbology items in legend should be checkable

Note
added in 2.5

Reimplemented from QgsFeatureRendererV2.

QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
virtual

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

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

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

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

Reimplemented from QgsFeatureRendererV2.

QDomElement QgsCategorizedSymbolRendererV2::save ( QDomDocument &  doc)
virtual

store renderer info to XML element

Reimplemented from QgsFeatureRendererV2.

QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::scaleMethod ( ) const
inline
Note
added in 2.0
void QgsCategorizedSymbolRendererV2::setClassAttribute ( QString  attr)
inline
void QgsCategorizedSymbolRendererV2::setInvertedColorRamp ( bool  inverted)
inline
void QgsCategorizedSymbolRendererV2::setRotationField ( QString  fieldOrExpression)
virtual
Note
added in 1.6

Reimplemented from QgsFeatureRendererV2.

void QgsCategorizedSymbolRendererV2::setScaleMethod ( QgsSymbolV2::ScaleMethod  scaleMethod)
Note
added in 2.0
void QgsCategorizedSymbolRendererV2::setSizeScaleField ( QString  fieldOrExpression)
Note
added in 1.6
void QgsCategorizedSymbolRendererV2::setSourceColorRamp ( QgsVectorColorRampV2 ramp)
void QgsCategorizedSymbolRendererV2::setSourceSymbol ( QgsSymbolV2 sym)
QString QgsCategorizedSymbolRendererV2::sizeScaleField ( ) const
Note
added in 1.6
void QgsCategorizedSymbolRendererV2::sortByLabel ( Qt::SortOrder  order = Qt::AscendingOrder)
void QgsCategorizedSymbolRendererV2::sortByValue ( Qt::SortOrder  order = Qt::AscendingOrder)
QgsVectorColorRampV2 * QgsCategorizedSymbolRendererV2::sourceColorRamp ( )
QgsSymbolV2 * QgsCategorizedSymbolRendererV2::sourceSymbol ( )
void QgsCategorizedSymbolRendererV2::startRender ( QgsRenderContext context,
const QgsFields fields 
)
virtual

Implements QgsFeatureRendererV2.

void QgsCategorizedSymbolRendererV2::stopRender ( QgsRenderContext context)
virtual

Implements QgsFeatureRendererV2.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForFeature ( QgsFeature feature)
virtual

to be overridden

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

Implements QgsFeatureRendererV2.

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForValue ( QVariant  value)
protected
QgsSymbolV2List QgsCategorizedSymbolRendererV2::symbols ( )
virtual

for symbol levels

Implements QgsFeatureRendererV2.

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.

bool QgsCategorizedSymbolRendererV2::updateCategoryLabel ( int  catIndex,
QString  label 
)
bool QgsCategorizedSymbolRendererV2::updateCategoryRenderState ( int  catIndex,
bool  render 
)
Note
added in 2.5
bool QgsCategorizedSymbolRendererV2::updateCategorySymbol ( int  catIndex,
QgsSymbolV2 symbol 
)
bool QgsCategorizedSymbolRendererV2::updateCategoryValue ( int  catIndex,
const QVariant &  value 
)
void QgsCategorizedSymbolRendererV2::updateSymbols ( QgsSymbolV2 sym)
Note
added in 2.0
QList< QString > QgsCategorizedSymbolRendererV2::usedAttributes ( )
virtual

Implements QgsFeatureRendererV2.

Member Data Documentation

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

attribute index (derived from attribute name in startRender)

QgsCategoryList QgsCategorizedSymbolRendererV2::mCategories
protected
bool QgsCategorizedSymbolRendererV2::mCounting
protected
QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mExpression
protected
bool QgsCategorizedSymbolRendererV2::mInvertedColorRamp
protected
QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mRotation
protected
QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::mScaleMethod
protected
QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mSizeScale
protected
QScopedPointer<QgsVectorColorRampV2> QgsCategorizedSymbolRendererV2::mSourceColorRamp
protected
QScopedPointer<QgsSymbolV2> QgsCategorizedSymbolRendererV2::mSourceSymbol
protected
QHash<QString, QgsSymbolV2*> QgsCategorizedSymbolRendererV2::mSymbolHash
protected

hashtable for faster access to symbols

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

temporary symbols, used for data-defined rotation and scaling

QgsMarkerSymbolV2 QgsCategorizedSymbolRendererV2::sSkipRender
staticprotected

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