QGIS API Documentation
2.2.0-Valmiera
|
#include <qgscategorizedsymbolrendererv2.h>
Public Member Functions | |
QgsCategorizedSymbolRendererV2 (QString attrName=QString(), QgsCategoryList categories=QgsCategoryList()) | |
virtual | ~QgsCategorizedSymbolRendererV2 () |
virtual QgsSymbolV2 * | symbolForFeature (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 QgsFeatureRendererV2 * | clone () |
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 QgsCategoryList & | categories () |
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 (double scaleDenominator=-1, QString rule=QString()) |
return a list of item text / symbol | |
QgsSymbolV2 * | sourceSymbol () |
void | setSourceSymbol (QgsSymbolV2 *sym) |
QgsVectorColorRampV2 * | sourceColorRamp () |
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 |
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 QgsFeatureRendererV2 * | create (QDomElement &element) |
create renderer from XML element | |
Static Public Member Functions inherited from QgsFeatureRendererV2 | |
static QgsFeatureRendererV2 * | defaultRenderer (QGis::GeometryType geomType) |
return a new renderer - used by default in vector layers | |
static QgsFeatureRendererV2 * | load (QDomElement &symbologyElem) |
create a renderer from XML element | |
static QgsFeatureRendererV2 * | loadSld (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 () |
QgsSymbolV2 * | symbolForValue (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 |
QScopedPointer< QgsSymbolV2 > | mSourceSymbol |
QScopedPointer < QgsVectorColorRampV2 > | mSourceColorRamp |
bool | mInvertedColorRamp |
QScopedPointer< QgsExpression > | mRotation |
QScopedPointer< QgsExpression > | mSizeScale |
QgsSymbolV2::ScaleMethod | mScaleMethod |
QScopedPointer< QgsExpression > | mExpression |
int | mAttrNum |
attribute index (derived from attribute name in startRender) | |
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) |
Definition at line 65 of file qgscategorizedsymbolrendererv2.h.
QgsCategorizedSymbolRendererV2::QgsCategorizedSymbolRendererV2 | ( | QString | attrName = QString() , |
QgsCategoryList | categories = QgsCategoryList() |
||
) |
Definition at line 130 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, QgsDebugMsg, and QgsRendererCategoryV2::symbol().
|
virtual |
Definition at line 149 of file qgscategorizedsymbolrendererv2.cpp.
void QgsCategorizedSymbolRendererV2::addCategory | ( | const QgsRendererCategoryV2 & | category | ) |
Definition at line 267 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, QgsDebugMsg, and QgsRendererCategoryV2::symbol().
|
inlinevirtual |
returns bitwise OR-ed capabilities of the renderer
Reimplemented from QgsFeatureRendererV2.
Definition at line 89 of file qgscategorizedsymbolrendererv2.h.
References QgsFeatureRendererV2::Filter.
|
inline |
Definition at line 95 of file qgscategorizedsymbolrendererv2.h.
Referenced by QgsAttributeEditor::createAttributeEditor(), legendSymbologyItems(), and QgsRuleBasedRendererV2::refineRuleCategories().
int QgsCategorizedSymbolRendererV2::categoryIndexForValue | ( | QVariant | val | ) |
return index of category with specified value (-1 if not found)
Definition at line 233 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
|
inline |
Definition at line 114 of file qgscategorizedsymbolrendererv2.h.
Referenced by legendSymbolItems(), legendSymbologyItems(), and QgsRuleBasedRendererV2::refineRuleCategories().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 422 of file qgscategorizedsymbolrendererv2.cpp.
References mAttrName, mCategories, mInvertedColorRamp, mSourceColorRamp, mSourceSymbol, QgsCategorizedSymbolRendererV2(), rotationField(), scaleMethod(), setInvertedColorRamp(), setRotationField(), setScaleMethod(), setSizeScaleField(), setSourceColorRamp(), setSourceSymbol(), QgsFeatureRendererV2::setUsingSymbolLevels(), sizeScaleField(), and QgsFeatureRendererV2::usingSymbolLevels().
|
static |
create renderer from XML element
Definition at line 464 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::clearSymbolMap(), QgsSymbolLayerV2Utils::decodeScaleMethod(), QgsSymbolLayerV2Utils::loadColorRamp(), QgsSymbolLayerV2Utils::loadSymbols(), QgsCategorizedSymbolRendererV2(), setInvertedColorRamp(), setRotationField(), setScaleMethod(), setSizeScaleField(), setSourceColorRamp(), and setSourceSymbol().
Referenced by QgsRendererV2Registry::QgsRendererV2Registry().
void QgsCategorizedSymbolRendererV2::deleteAllCategories | ( | ) |
Definition at line 288 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
bool QgsCategorizedSymbolRendererV2::deleteCategory | ( | int | catIndex | ) |
Definition at line 279 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
|
virtual |
for debugging
Reimplemented from QgsFeatureRendererV2.
Definition at line 414 of file qgscategorizedsymbolrendererv2.cpp.
References mAttrName, and mCategories.
|
inline |
Definition at line 138 of file qgscategorizedsymbolrendererv2.h.
|
virtual |
return a list of item text / symbol
Reimplemented from QgsFeatureRendererV2.
Definition at line 624 of file qgscategorizedsymbolrendererv2.cpp.
References classAttribute(), QgsRendererCategoryV2::label(), mCategories, and QgsRendererCategoryV2::symbol().
|
virtual |
return a list of symbology items for the legend
Reimplemented from QgsFeatureRendererV2.
Definition at line 603 of file qgscategorizedsymbolrendererv2.cpp.
References categories(), classAttribute(), QgsRendererCategoryV2::label(), QgsRendererCategoryV2::symbol(), and QgsSymbolLayerV2Utils::symbolPreviewPixmap().
void QgsCategorizedSymbolRendererV2::moveCategory | ( | int | from, |
int | to | ||
) |
Moves the category at index position from to index position to.
Definition at line 293 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
|
protected |
Definition at line 153 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, mSymbolHash, QgsRendererCategoryV2::symbol(), and QgsRendererCategoryV2::value().
Referenced by startRender().
|
virtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 670 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression(), and mRotation.
Referenced by clone().
|
virtual |
store renderer info to XML element
Reimplemented from QgsFeatureRendererV2.
Definition at line 538 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::encodeScaleMethod(), QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression(), QgsRendererCategoryV2::label(), mAttrName, mCategories, mInvertedColorRamp, mRotation, mScaleMethod, mSizeScale, mSourceColorRamp, mSourceSymbol, QgsFeatureRendererV2::mUsingSymbolLevels, RENDERER_TAG_NAME, QgsSymbolLayerV2Utils::saveColorRamp(), QgsSymbolLayerV2Utils::saveSymbols(), QgsRendererCategoryV2::symbol(), symbols(), and QgsRendererCategoryV2::value().
|
inline |
Definition at line 154 of file qgscategorizedsymbolrendererv2.h.
Referenced by clone(), and setScaleMethod().
|
inline |
Definition at line 115 of file qgscategorizedsymbolrendererv2.h.
|
inline |
Definition at line 139 of file qgscategorizedsymbolrendererv2.h.
|
virtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 665 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::fieldOrExpressionToExpression(), and mRotation.
void QgsCategorizedSymbolRendererV2::setScaleMethod | ( | QgsSymbolV2::ScaleMethod | scaleMethod | ) |
Definition at line 697 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, mScaleMethod, scaleMethod(), and QgsFeatureRendererV2::setScaleMethodToSymbol().
void QgsCategorizedSymbolRendererV2::setSizeScaleField | ( | QString | fieldOrExpression | ) |
Definition at line 675 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::fieldOrExpressionToExpression(), and mSizeScale.
void QgsCategorizedSymbolRendererV2::setSourceColorRamp | ( | QgsVectorColorRampV2 * | ramp | ) |
Definition at line 660 of file qgscategorizedsymbolrendererv2.cpp.
References mSourceColorRamp.
void QgsCategorizedSymbolRendererV2::setSourceSymbol | ( | QgsSymbolV2 * | sym | ) |
Definition at line 651 of file qgscategorizedsymbolrendererv2.cpp.
References mSourceSymbol.
QString QgsCategorizedSymbolRendererV2::sizeScaleField | ( | ) | const |
Definition at line 680 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression(), and mSizeScale.
Referenced by clone().
void QgsCategorizedSymbolRendererV2::sortByLabel | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 330 of file qgscategorizedsymbolrendererv2.cpp.
References labelGreaterThan(), labelLessThan(), and mCategories.
void QgsCategorizedSymbolRendererV2::sortByValue | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 308 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, valueGreaterThan(), and valueLessThan().
QgsVectorColorRampV2 * QgsCategorizedSymbolRendererV2::sourceColorRamp | ( | ) |
Definition at line 656 of file qgscategorizedsymbolrendererv2.cpp.
References mSourceColorRamp.
QgsSymbolV2 * QgsCategorizedSymbolRendererV2::sourceSymbol | ( | ) |
Definition at line 647 of file qgscategorizedsymbolrendererv2.cpp.
References mSourceSymbol.
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 342 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), QgsSymbolV2::DataDefinedRotation, QgsSymbolV2::DataDefinedSizeScale, QgsVectorLayer::fieldNameIndex(), mAttrName, mAttrNum, mCategories, mExpression, mRotation, mSizeScale, mTempSymbols, QgsVectorLayer::pendingFields(), rebuildHash(), QgsSymbolV2::setRenderHints(), and QgsSymbolV2::startRender().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 372 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories, mExpression, and mTempSymbols.
|
virtual |
to be overridden
feature | feature |
Implements QgsFeatureRendererV2.
Definition at line 184 of file qgscategorizedsymbolrendererv2.cpp.
References QgsFeature::attributes(), QgsSymbolV2::Line, QgsSymbolV2::Marker, mAttrNum, mExpression, mRotation, mScaleMethod, mSizeScale, mTempSymbols, QgsMarkerSymbolV2::setAngle(), QgsMarkerSymbolV2::setScaleMethod(), QgsMarkerSymbolV2::setSize(), QgsLineSymbolV2::setWidth(), size, symbolForValue(), and QgsSymbolV2::type().
|
protected |
Definition at line 164 of file qgscategorizedsymbolrendererv2.cpp.
References mSymbolHash, QgsDebugMsg, and QgsDebugMsgLevel.
Referenced by symbolForFeature().
|
virtual |
for symbol levels
Implements QgsFeatureRendererV2.
Definition at line 456 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
Referenced by save().
|
virtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented from QgsFeatureRendererV2.
Definition at line 439 of file qgscategorizedsymbolrendererv2.cpp.
References mAttrName, mCategories, mRotation, and mSizeScale.
bool QgsCategorizedSymbolRendererV2::updateCategoryLabel | ( | int | catIndex, |
QString | label | ||
) |
Definition at line 259 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
bool QgsCategorizedSymbolRendererV2::updateCategorySymbol | ( | int | catIndex, |
QgsSymbolV2 * | symbol | ||
) |
Definition at line 251 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
Referenced by updateSymbols().
bool QgsCategorizedSymbolRendererV2::updateCategoryValue | ( | int | catIndex, |
const QVariant & | value | ||
) |
Definition at line 243 of file qgscategorizedsymbolrendererv2.cpp.
References mCategories.
void QgsCategorizedSymbolRendererV2::updateSymbols | ( | QgsSymbolV2 * | sym | ) |
Definition at line 685 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), QgsSymbolV2::color(), mCategories, QgsSymbolV2::setColor(), QgsRendererCategoryV2::symbol(), and updateCategorySymbol().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 389 of file qgscategorizedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::fieldOrExpressionToExpression(), mAttrName, mCategories, mRotation, mSizeScale, and QgsSymbolV2::usedAttributes().
|
protected |
Definition at line 157 of file qgscategorizedsymbolrendererv2.h.
Referenced by clone(), dump(), save(), startRender(), toSld(), and usedAttributes().
|
protected |
attribute index (derived from attribute name in startRender)
Definition at line 168 of file qgscategorizedsymbolrendererv2.h.
Referenced by startRender(), and symbolForFeature().
|
protected |
Definition at line 158 of file qgscategorizedsymbolrendererv2.h.
Referenced by addCategory(), categoryIndexForValue(), clone(), deleteAllCategories(), deleteCategory(), dump(), legendSymbolItems(), moveCategory(), QgsCategorizedSymbolRendererV2(), rebuildHash(), save(), setScaleMethod(), sortByLabel(), sortByValue(), startRender(), stopRender(), symbols(), toSld(), updateCategoryLabel(), updateCategorySymbol(), updateCategoryValue(), updateSymbols(), and usedAttributes().
|
protected |
Definition at line 165 of file qgscategorizedsymbolrendererv2.h.
Referenced by startRender(), stopRender(), and symbolForFeature().
|
protected |
Definition at line 161 of file qgscategorizedsymbolrendererv2.h.
|
protected |
Definition at line 162 of file qgscategorizedsymbolrendererv2.h.
Referenced by rotationField(), save(), setRotationField(), startRender(), symbolForFeature(), toSld(), and usedAttributes().
|
protected |
Definition at line 164 of file qgscategorizedsymbolrendererv2.h.
Referenced by save(), setScaleMethod(), and symbolForFeature().
|
protected |
Definition at line 163 of file qgscategorizedsymbolrendererv2.h.
Referenced by save(), setSizeScaleField(), sizeScaleField(), startRender(), symbolForFeature(), toSld(), and usedAttributes().
|
protected |
Definition at line 160 of file qgscategorizedsymbolrendererv2.h.
Referenced by clone(), save(), setSourceColorRamp(), and sourceColorRamp().
|
protected |
Definition at line 159 of file qgscategorizedsymbolrendererv2.h.
Referenced by clone(), save(), setSourceSymbol(), and sourceSymbol().
|
protected |
hashtable for faster access to symbols
Definition at line 171 of file qgscategorizedsymbolrendererv2.h.
Referenced by rebuildHash(), and symbolForValue().
|
protected |
temporary symbols, used for data-defined rotation and scaling
Definition at line 174 of file qgscategorizedsymbolrendererv2.h.
Referenced by startRender(), stopRender(), and symbolForFeature().