QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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]

Public Member Functions

 QgsCategorizedSymbolRendererV2 (const QString &attrName=QString(), const QgsCategoryList &categories=QgsCategoryList())
 
virtual ~QgsCategorizedSymbolRendererV2 ()
 
void addCategory (const QgsRendererCategoryV2 &category)
 
virtual int capabilities () override
 returns bitwise OR-ed capabilities of the renderer More...
 
const QgsCategoryListcategories () const
 
int categoryIndexForLabel (const QString &val)
 return index of category with specified label (-1 if not found or not unique) More...
 
int categoryIndexForValue (const QVariant &val)
 return index of category with specified value (-1 if not found) More...
 
virtual void checkLegendSymbolItem (const QString &key, bool state=true) override
 item in symbology was checked More...
 
QString classAttribute () const
 
virtual QgsCategorizedSymbolRendererV2clone () const override
 
void deleteAllCategories ()
 
bool deleteCategory (int catIndex)
 
virtual QString dump () const override
 for debugging More...
 
virtual QString filter (const QgsFields &fields=QgsFields()) override
 If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More...
 
bool invertedColorRamp ()
 
virtual QString legendClassificationAttribute () const override
 If supported by the renderer, return classification attribute for the use in legend. More...
 
virtual QSet< QStringlegendKeysForFeature (QgsFeature &feature, QgsRenderContext &context) override
 Return legend keys matching a specified feature. More...
 
virtual bool legendSymbolItemChecked (const QString &key) override
 item in symbology was checked More...
 
virtual QgsLegendSymbolList legendSymbolItems (double scaleDenominator=-1, const QString &rule=QString()) override
 return a list of item text / symbol More...
 
virtual bool legendSymbolItemsCheckable () const override
 items of symbology items in legend should be checkable More...
 
QgsLegendSymbolListV2 legendSymbolItemsV2 () const override
 
virtual QgsLegendSymbologyList legendSymbologyItems (QSize iconSize) override
 return a list of symbology items for the legend More...
 
void moveCategory (int from, int to)
 Moves the category at index position from to index position to. More...
 
virtual QgsSymbolV2originalSymbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 
Q_DECL_DEPRECATED QString rotationField () const override
 return rotation field name (or empty string if not set or not supported by renderer) More...
 
virtual QDomElement save (QDomDocument &doc) override
 store renderer info to XML element More...
 
QgsSymbolV2::ScaleMethod scaleMethod () const
 
void setClassAttribute (const QString &attr)
 
void setInvertedColorRamp (bool inverted)
 
virtual void setLegendSymbolItem (const QString &key, QgsSymbolV2 *symbol) override
 Sets the symbol to be used for a legend symbol item. More...
 
Q_DECL_DEPRECATED void setRotationField (const QString &fieldOrExpression) override
 sets rotation field of renderer (if supported by the renderer) More...
 
void setScaleMethod (QgsSymbolV2::ScaleMethod scaleMethod)
 
void setSizeScaleField (const QString &fieldOrExpression)
 
void setSourceColorRamp (QgsVectorColorRampV2 *ramp)
 Sets the source color ramp. More...
 
void setSourceSymbol (QgsSymbolV2 *sym)
 Sets the source symbol for the renderer, which is the base symbol used for the each categories' symbol before applying the categories' color. More...
 
QString sizeScaleField () const
 
void sortByLabel (Qt::SortOrder order=Qt::AscendingOrder)
 
void sortByValue (Qt::SortOrder order=Qt::AscendingOrder)
 
QgsVectorColorRampV2sourceColorRamp ()
 Returns the source color ramp, from which each categories' color is derived. More...
 
QgsSymbolV2sourceSymbol ()
 Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying the categories' color. More...
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
 Needs to be called when a new render cycle is started. More...
 
virtual void stopRender (QgsRenderContext &context) override
 Needs to be called when a render cycle has finished to clean up. More...
 
virtual QgsSymbolV2symbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 
virtual QgsSymbolV2List symbols (QgsRenderContext &context) override
 
virtual void toSld (QDomDocument &doc, QDomElement &element) const override
 Writes the SLD element following the SLD v1.1 specs. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element, const QgsStringMap &props) const override
 Writes the SLD element following the SLD v1.1 specs. More...
 
bool updateCategoryLabel (int catIndex, const 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)
 Update the color ramp used and all symbols colors. More...
 
void updateSymbols (QgsSymbolV2 *sym)
 Update all the symbols but leave categories and colors. More...
 
virtual QList< QStringusedAttributes () override
 Returns a set of attributes required for this renderer. More...
 
- Public Member Functions inherited from QgsFeatureRendererV2
virtual ~QgsFeatureRendererV2 ()
 
virtual const QgsFeatureRendererV2embeddedRenderer () const
 Returns the current embedded renderer (subrenderer) for this feature renderer. More...
 
virtual bool filterNeedsGeometry () const
 Returns true if this renderer requires the geometry to apply the filter. More...
 
bool forceRasterRender () const
 Returns whether the renderer must render as a raster. More...
 
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering. More...
 
QgsFeatureRequest::OrderBy orderBy () const
 Get the order in which features shall be processed by this renderer. More...
 
bool orderByEnabled () const
 Returns whether custom ordering will be applied before features are processed by this renderer. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2originalSymbolForFeature (QgsFeature &feature)
 Return symbol for feature. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
virtual QgsSymbolV2List originalSymbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the renderer. More...
 
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
 Render a feature using this renderer in the given context. More...
 
virtual void setEmbeddedRenderer (QgsFeatureRendererV2 *subRenderer)
 Sets an embedded renderer (subrenderer) for this feature renderer. More...
 
void setForceRasterRender (bool forceRaster)
 Sets whether the renderer should be rendered to a raster destination. More...
 
void setOrderBy (const QgsFeatureRequest::OrderBy &orderBy)
 Define the order in which features shall be processed by this renderer. More...
 
void setOrderByEnabled (bool enabled)
 Sets whether custom ordering should be applied before features are processed by this renderer. More...
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for 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 Q_DECL_DEPRECATED void startRender (QgsRenderContext &context, const QgsVectorLayer *vlayer)
 
virtual Q_DECL_DEPRECATED QgsSymbolV2symbolForFeature (QgsFeature &feature)
 To be overridden. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols ()
 For symbol levels. More...
 
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbolsForFeature (QgsFeature &feat)
 Returns list of symbols used for rendering the feature. More...
 
virtual QgsSymbolV2List symbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns list of symbols used for rendering the feature. More...
 
QString type () const
 
bool usingSymbolLevels () const
 
virtual Q_DECL_DEPRECATED bool willRenderFeature (QgsFeature &feat)
 Returns whether the renderer will render a feature or not. More...
 
virtual bool willRenderFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns whether the renderer will render a feature or not. More...
 
virtual Q_DECL_DEPRECATED QDomElement writeSld (QDomDocument &doc, const QgsVectorLayer &layer) const
 create the SLD UserStyle element following the SLD v1.1 specs More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName, const QgsStringMap &props) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 

Static Public Member Functions

static QgsCategorizedSymbolRendererV2convertFromRenderer (const QgsFeatureRendererV2 *renderer)
 creates a QgsCategorizedSymbolRendererV2 from an existing renderer. More...
 
static QgsFeatureRendererV2create (QDomElement &element)
 create renderer from XML element 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 ()
 
QgsSymbolV2skipRender ()
 
QgsSymbolV2symbolForValue (const QVariant &value)
 
- Protected Member Functions inherited from QgsFeatureRendererV2
 QgsFeatureRendererV2 (const QString &type)
 
Q_DECL_DEPRECATED void copyPaintEffect (QgsFeatureRendererV2 *destRenderer) const
 Copies paint effect of this renderer to another renderer. More...
 
void copyRendererData (QgsFeatureRendererV2 *destRenderer) const
 Clones generic renderer data to another renderer. More...
 
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)
 

Protected Attributes

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

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 QgsConstWkbPtr _getLineString (QPolygonF &pts, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
 Creates a line string in screen coordinates from a wkb string in map coordinates. More...
 
static QgsConstWkbPtr _getPoint (QPointF &pt, QgsRenderContext &context, QgsConstWkbPtr &wkb)
 Creates a point in screen coordinates from a wkb string in map coordinates. More...
 
static QgsConstWkbPtr _getPolygon (QPolygonF &pts, QList< QPolygonF > &holes, QgsRenderContext &context, QgsConstWkbPtr &wkb, bool clipToExtent=true)
 Creates a polygon in screen coordinates from a wkb string in map coordinates. More...
 
static void convertSymbolRotation (QgsSymbolV2 *symbol, const QString &field)
 
static void convertSymbolSizeScale (QgsSymbolV2 *symbol, QgsSymbolV2::ScaleMethod method, const QString &field)
 

Detailed Description

Definition at line 83 of file qgscategorizedsymbolrendererv2.h.

Constructor & Destructor Documentation

◆ QgsCategorizedSymbolRendererV2()

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

Definition at line 152 of file qgscategorizedsymbolrendererv2.cpp.

◆ ~QgsCategorizedSymbolRendererV2()

QgsCategorizedSymbolRendererV2::~QgsCategorizedSymbolRendererV2 ( )
virtual

Definition at line 173 of file qgscategorizedsymbolrendererv2.cpp.

Member Function Documentation

◆ addCategory()

void QgsCategorizedSymbolRendererV2::addCategory ( const QgsRendererCategoryV2 category)

Definition at line 346 of file qgscategorizedsymbolrendererv2.cpp.

◆ capabilities()

virtual int QgsCategorizedSymbolRendererV2::capabilities ( )
inlineoverridevirtual

returns bitwise OR-ed capabilities of the renderer

Reimplemented from QgsFeatureRendererV2.

Definition at line 113 of file qgscategorizedsymbolrendererv2.h.

◆ categories()

const QgsCategoryList& QgsCategorizedSymbolRendererV2::categories ( ) const
inline

Definition at line 127 of file qgscategorizedsymbolrendererv2.h.

◆ categoryIndexForLabel()

int QgsCategorizedSymbolRendererV2::categoryIndexForLabel ( const QString val)

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

Note
added in 2.5

Definition at line 298 of file qgscategorizedsymbolrendererv2.cpp.

◆ categoryIndexForValue()

int QgsCategorizedSymbolRendererV2::categoryIndexForValue ( const QVariant val)

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

Definition at line 288 of file qgscategorizedsymbolrendererv2.cpp.

◆ checkLegendSymbolItem()

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

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

Definition at line 1024 of file qgscategorizedsymbolrendererv2.cpp.

◆ classAttribute()

QString QgsCategorizedSymbolRendererV2::classAttribute ( ) const
inline

Definition at line 153 of file qgscategorizedsymbolrendererv2.h.

◆ clone()

QgsCategorizedSymbolRendererV2 * QgsCategorizedSymbolRendererV2::clone ( ) const
overridevirtual

Implements QgsFeatureRendererV2.

Definition at line 506 of file qgscategorizedsymbolrendererv2.cpp.

◆ convertFromRenderer()

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 1032 of file qgscategorizedsymbolrendererv2.cpp.

◆ create()

QgsFeatureRendererV2 * QgsCategorizedSymbolRendererV2::create ( QDomElement element)
static

create renderer from XML element

Definition at line 628 of file qgscategorizedsymbolrendererv2.cpp.

◆ deleteAllCategories()

void QgsCategorizedSymbolRendererV2::deleteAllCategories ( )

Definition at line 366 of file qgscategorizedsymbolrendererv2.cpp.

◆ deleteCategory()

bool QgsCategorizedSymbolRendererV2::deleteCategory ( int  catIndex)

Definition at line 357 of file qgscategorizedsymbolrendererv2.cpp.

◆ dump()

QString QgsCategorizedSymbolRendererV2::dump ( ) const
overridevirtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 498 of file qgscategorizedsymbolrendererv2.cpp.

◆ filter()

QString QgsCategorizedSymbolRendererV2::filter ( const QgsFields fields = QgsFields())
overridevirtual

If a renderer does not require all the features this method may be overridden and return an expression used as where clause.

This will be called once after startRender() and before the first call to renderFeature(). By default this returns a null string and all features will be requested. You do not need to specify the extent in here, this is taken care of separately and will be combined with a filter returned from this method.

Returns
An expression used as where clause

Reimplemented from QgsFeatureRendererV2.

Definition at line 545 of file qgscategorizedsymbolrendererv2.cpp.

◆ invertedColorRamp()

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

Definition at line 203 of file qgscategorizedsymbolrendererv2.h.

◆ legendClassificationAttribute()

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 238 of file qgscategorizedsymbolrendererv2.h.

◆ legendKeysForFeature()

QSet< QString > QgsCategorizedSymbolRendererV2::legendKeysForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual

Return legend keys matching a specified feature.

Note
added in 2.14

Reimplemented from QgsFeatureRendererV2.

Definition at line 882 of file qgscategorizedsymbolrendererv2.cpp.

◆ legendSymbolItemChecked()

bool QgsCategorizedSymbolRendererV2::legendSymbolItemChecked ( const QString key)
overridevirtual

item in symbology was checked

Reimplemented from QgsFeatureRendererV2.

Definition at line 1004 of file qgscategorizedsymbolrendererv2.cpp.

◆ legendSymbolItems()

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

return a list of item text / symbol

Note
not available in python bindings

Reimplemented from QgsFeatureRendererV2.

Definition at line 817 of file qgscategorizedsymbolrendererv2.cpp.

◆ legendSymbolItemsCheckable()

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 999 of file qgscategorizedsymbolrendererv2.cpp.

◆ legendSymbolItemsV2()

QgsLegendSymbolListV2 QgsCategorizedSymbolRendererV2::legendSymbolItemsV2 ( ) const
overridevirtual
Note
added in 2.10

Reimplemented from QgsFeatureRendererV2.

Definition at line 832 of file qgscategorizedsymbolrendererv2.cpp.

◆ legendSymbologyItems()

QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
overridevirtual

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 803 of file qgscategorizedsymbolrendererv2.cpp.

◆ moveCategory()

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

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

Definition at line 371 of file qgscategorizedsymbolrendererv2.cpp.

◆ originalSymbolForFeature()

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::originalSymbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual
Note
available in python as originalSymbolForFeature2

Reimplemented from QgsFeatureRendererV2.

Definition at line 269 of file qgscategorizedsymbolrendererv2.cpp.

◆ rebuildHash()

void QgsCategorizedSymbolRendererV2::rebuildHash ( )
protected

Definition at line 177 of file qgscategorizedsymbolrendererv2.cpp.

◆ rotationField()

QString QgsCategorizedSymbolRendererV2::rotationField ( ) const
overridevirtual

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

Deprecated:
use the symbol's methods instead

Reimplemented from QgsFeatureRendererV2.

Definition at line 954 of file qgscategorizedsymbolrendererv2.cpp.

◆ save()

QDomElement QgsCategorizedSymbolRendererV2::save ( QDomDocument doc)
overridevirtual

store renderer info to XML element

Reimplemented from QgsFeatureRendererV2.

Definition at line 722 of file qgscategorizedsymbolrendererv2.cpp.

◆ scaleMethod()

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

Definition at line 220 of file qgscategorizedsymbolrendererv2.h.

◆ setClassAttribute()

void QgsCategorizedSymbolRendererV2::setClassAttribute ( const QString attr)
inline

Definition at line 154 of file qgscategorizedsymbolrendererv2.h.

◆ setInvertedColorRamp()

void QgsCategorizedSymbolRendererV2::setInvertedColorRamp ( bool  inverted)
inline

Definition at line 204 of file qgscategorizedsymbolrendererv2.h.

◆ setLegendSymbolItem()

void QgsCategorizedSymbolRendererV2::setLegendSymbolItem ( const QString key,
QgsSymbolV2 symbol 
)
overridevirtual

Sets the symbol to be used for a legend symbol item.

Parameters
keyrule key for legend symbol
symbolnew symbol for legend item. Ownership is transferred to renderer.
Note
added in QGIS 2.14

Reimplemented from QgsFeatureRendererV2.

Definition at line 1014 of file qgscategorizedsymbolrendererv2.cpp.

◆ setRotationField()

void QgsCategorizedSymbolRendererV2::setRotationField ( const QString fieldName)
overridevirtual

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

Deprecated:
use the symbol's methods instead

Reimplemented from QgsFeatureRendererV2.

Definition at line 945 of file qgscategorizedsymbolrendererv2.cpp.

◆ setScaleMethod()

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

Definition at line 989 of file qgscategorizedsymbolrendererv2.cpp.

◆ setSizeScaleField()

void QgsCategorizedSymbolRendererV2::setSizeScaleField ( const QString fieldOrExpression)

Definition at line 966 of file qgscategorizedsymbolrendererv2.cpp.

◆ setSourceColorRamp()

void QgsCategorizedSymbolRendererV2::setSourceColorRamp ( QgsVectorColorRampV2 ramp)

Sets the source color ramp.

Parameters
rampcolor ramp. Ownership is transferred to the renderer
See also
sourceColorRamp()
setSourceSymbol()

Definition at line 916 of file qgscategorizedsymbolrendererv2.cpp.

◆ setSourceSymbol()

void QgsCategorizedSymbolRendererV2::setSourceSymbol ( QgsSymbolV2 sym)

Sets the source symbol for the renderer, which is the base symbol used for the each categories' symbol before applying the categories' color.

Parameters
symsource symbol, ownership is transferred to the renderer
See also
sourceSymbol()
setSourceColorRamp()

Definition at line 906 of file qgscategorizedsymbolrendererv2.cpp.

◆ sizeScaleField()

QString QgsCategorizedSymbolRendererV2::sizeScaleField ( ) const

Definition at line 971 of file qgscategorizedsymbolrendererv2.cpp.

◆ skipRender()

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::skipRender ( )
protected

Definition at line 188 of file qgscategorizedsymbolrendererv2.cpp.

◆ sortByLabel()

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

Definition at line 408 of file qgscategorizedsymbolrendererv2.cpp.

◆ sortByValue()

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

Definition at line 386 of file qgscategorizedsymbolrendererv2.cpp.

◆ sourceColorRamp()

QgsVectorColorRampV2 * QgsCategorizedSymbolRendererV2::sourceColorRamp ( )

Returns the source color ramp, from which each categories' color is derived.

See also
setSourceColorRamp()
sourceSymbol()

Definition at line 911 of file qgscategorizedsymbolrendererv2.cpp.

◆ sourceSymbol()

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::sourceSymbol ( )

Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying the categories' color.

See also
setSourceSymbol()
sourceColorRamp()

Definition at line 902 of file qgscategorizedsymbolrendererv2.cpp.

◆ startRender()

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

Needs to be called when a new render cycle is started.

Parameters
contextAdditional information passed to the renderer about the job which will be rendered
fieldsThe fields available for rendering
Returns
Information passed back from the renderer that can e.g. be used to reduce the amount of requested features

Implements QgsFeatureRendererV2.

Definition at line 420 of file qgscategorizedsymbolrendererv2.cpp.

◆ stopRender()

void QgsCategorizedSymbolRendererV2::stopRender ( QgsRenderContext context)
overridevirtual

Needs to be called when a render cycle has finished to clean up.

Implements QgsFeatureRendererV2.

Definition at line 451 of file qgscategorizedsymbolrendererv2.cpp.

◆ symbolForFeature()

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual
Note
available in python as symbolForFeature2

Reimplemented from QgsFeatureRendererV2.

Definition at line 217 of file qgscategorizedsymbolrendererv2.cpp.

◆ symbolForValue()

QgsSymbolV2 * QgsCategorizedSymbolRendererV2::symbolForValue ( const QVariant value)
protected

Definition at line 197 of file qgscategorizedsymbolrendererv2.cpp.

◆ symbols()

QgsSymbolV2List QgsCategorizedSymbolRendererV2::symbols ( QgsRenderContext context)
overridevirtual
Note
available in python as symbols2

Reimplemented from QgsFeatureRendererV2.

Definition at line 616 of file qgscategorizedsymbolrendererv2.cpp.

◆ toSld() [1/2]

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

Writes the SLD element following the SLD v1.1 specs.

Reimplemented from QgsFeatureRendererV2.

Definition at line 523 of file qgscategorizedsymbolrendererv2.cpp.

◆ toSld() [2/2]

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

Writes the SLD element following the SLD v1.1 specs.

Reimplemented from QgsFeatureRendererV2.

Definition at line 528 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateCategoryLabel()

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

Definition at line 330 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateCategoryRenderState()

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

Definition at line 338 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateCategorySymbol()

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

Definition at line 322 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateCategoryValue()

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

Definition at line 314 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateColorRamp()

void QgsCategorizedSymbolRendererV2::updateColorRamp ( QgsVectorColorRampV2 ramp,
bool  inverted = false 
)

Update the color ramp used and all symbols colors.

Parameters
rampcolor ramp. Ownership is transferred to the renderer
invertedset to true to invert ramp colors
Note
added in 2.5

Definition at line 921 of file qgscategorizedsymbolrendererv2.cpp.

◆ updateSymbols()

void QgsCategorizedSymbolRendererV2::updateSymbols ( QgsSymbolV2 sym)

Update all the symbols but leave categories and colors.

This method also sets the source symbol for the renderer.

Parameters
symsource symbol to use for categories. Ownership is not transferred.
See also
setSourceSymbol()

Definition at line 976 of file qgscategorizedsymbolrendererv2.cpp.

◆ usedAttributes()

QList< QString > QgsCategorizedSymbolRendererV2::usedAttributes ( )
overridevirtual

Returns a set of attributes required for this renderer.

TODO QGIS3: Change QList to QSet

Implements QgsFeatureRendererV2.

Definition at line 469 of file qgscategorizedsymbolrendererv2.cpp.

Member Data Documentation

◆ mAttrName

QString QgsCategorizedSymbolRendererV2::mAttrName
protected

Definition at line 246 of file qgscategorizedsymbolrendererv2.h.

◆ mAttrNum

int QgsCategorizedSymbolRendererV2::mAttrNum
protected

attribute index (derived from attribute name in startRender)

Definition at line 257 of file qgscategorizedsymbolrendererv2.h.

◆ mCategories

QgsCategoryList QgsCategorizedSymbolRendererV2::mCategories
protected

Definition at line 247 of file qgscategorizedsymbolrendererv2.h.

◆ mCounting

bool QgsCategorizedSymbolRendererV2::mCounting
protected

Definition at line 261 of file qgscategorizedsymbolrendererv2.h.

◆ mExpression

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mExpression
protected

Definition at line 254 of file qgscategorizedsymbolrendererv2.h.

◆ mInvertedColorRamp

bool QgsCategorizedSymbolRendererV2::mInvertedColorRamp
protected

Definition at line 250 of file qgscategorizedsymbolrendererv2.h.

◆ mRotation

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mRotation
protected

Definition at line 251 of file qgscategorizedsymbolrendererv2.h.

◆ mScaleMethod

QgsSymbolV2::ScaleMethod QgsCategorizedSymbolRendererV2::mScaleMethod
protected

Definition at line 253 of file qgscategorizedsymbolrendererv2.h.

◆ mSizeScale

QScopedPointer<QgsExpression> QgsCategorizedSymbolRendererV2::mSizeScale
protected

Definition at line 252 of file qgscategorizedsymbolrendererv2.h.

◆ mSourceColorRamp

QScopedPointer<QgsVectorColorRampV2> QgsCategorizedSymbolRendererV2::mSourceColorRamp
protected

Definition at line 249 of file qgscategorizedsymbolrendererv2.h.

◆ mSourceSymbol

QScopedPointer<QgsSymbolV2> QgsCategorizedSymbolRendererV2::mSourceSymbol
protected

Definition at line 248 of file qgscategorizedsymbolrendererv2.h.

◆ mSymbolHash

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

hashtable for faster access to symbols

Definition at line 260 of file qgscategorizedsymbolrendererv2.h.

◆ mTempSymbols

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

temporary symbols, used for data-defined rotation and scaling

Definition at line 264 of file qgscategorizedsymbolrendererv2.h.


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