QGIS API Documentation
2.0.1-Dufour
|
#include <qgsgraduatedsymbolrendererv2.h>
Public Types | |
enum | Mode { EqualInterval, Quantile, Jenks, StdDev, Pretty, Custom } |
Public Types inherited from QgsFeatureRendererV2 | |
enum | Capabilities { SymbolLevels = 1, RotationField = 1 << 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 } |
Public Member Functions | |
QgsGraduatedSymbolRendererV2 (QString attrName=QString(), QgsRangeList ranges=QgsRangeList()) | |
virtual | ~QgsGraduatedSymbolRendererV2 () |
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 | |
QString | classAttribute () const |
void | setClassAttribute (QString attr) |
const QgsRangeList & | ranges () |
bool | updateRangeSymbol (int rangeIndex, QgsSymbolV2 *symbol) |
bool | updateRangeLabel (int rangeIndex, QString label) |
bool | updateRangeUpperValue (int rangeIndex, double value) |
bool | updateRangeLowerValue (int rangeIndex, double value) |
void | addClass (QgsSymbolV2 *symbol) |
void | deleteClass (int idx) |
void | deleteAllClasses () |
void | moveClass (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) |
Mode | mode () const |
void | setMode (Mode mode) |
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 | |
QgsSymbolV2 * | sourceSymbol () |
void | setSourceSymbol (QgsSymbolV2 *sym) |
QgsVectorColorRampV2 * | sourceColorRamp () |
void | setSourceColorRamp (QgsVectorColorRampV2 *ramp) |
void | updateColorRamp (QgsVectorColorRampV2 *ramp) |
Update the color ramp used. | |
void | updateSymbols (QgsSymbolV2 *sym) |
Update the all symbols but leave breaks and colors. | |
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 QgsGraduatedSymbolRendererV2 * | createRenderer (QgsVectorLayer *vlayer, QString attrName, int classes, Mode mode, QgsSymbolV2 *symbol, QgsVectorColorRampV2 *ramp) |
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 | |
QgsSymbolV2 * | symbolForValue (double 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 |
QgsRangeList | mRanges |
Mode | mMode |
QgsSymbolV2 * | mSourceSymbol |
QgsVectorColorRampV2 * | mSourceColorRamp |
QString | mRotationField |
QString | mSizeScaleField |
QgsSymbolV2::ScaleMethod | mScaleMethod |
int | mAttrNum |
attribute index (derived from attribute name in startRender) | |
int | mRotationFieldIdx |
int | mSizeScaleFieldIdx |
QMap< QgsSymbolV2 *, 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 | |
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 59 of file qgsgraduatedsymbolrendererv2.h.
Definition at line 106 of file qgsgraduatedsymbolrendererv2.h.
QgsGraduatedSymbolRendererV2::QgsGraduatedSymbolRendererV2 | ( | QString | attrName = QString() , |
QgsRangeList | ranges = QgsRangeList() |
||
) |
Definition at line 152 of file qgsgraduatedsymbolrendererv2.cpp.
Referenced by clone(), create(), and createRenderer().
|
virtual |
Definition at line 166 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges, mSourceColorRamp, and mSourceSymbol.
void QgsGraduatedSymbolRendererV2::addClass | ( | QgsSymbolV2 * | symbol | ) |
Definition at line 1149 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), and mRanges.
|
inlinevirtual |
returns bitwise OR-ed capabilities of the renderer
Reimplemented from QgsFeatureRendererV2.
Definition at line 82 of file qgsgraduatedsymbolrendererv2.h.
References QgsFeatureRendererV2::Filter.
|
inline |
Definition at line 86 of file qgsgraduatedsymbolrendererv2.h.
Referenced by legendSymbolItems(), legendSymbologyItems(), and QgsRuleBasedRendererV2::refineRuleRanges().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 345 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsVectorColorRampV2::clone(), QgsSymbolV2::clone(), mAttrName, mMode, mRanges, mSourceColorRamp, mSourceSymbol, QgsGraduatedSymbolRendererV2(), rotationField(), scaleMethod(), setMode(), setRotationField(), setScaleMethod(), setSizeScaleField(), setSourceColorRamp(), setSourceSymbol(), QgsFeatureRendererV2::setUsingSymbolLevels(), sizeScaleField(), and QgsFeatureRendererV2::usingSymbolLevels().
|
static |
create renderer from XML element
Definition at line 876 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::clearSymbolMap(), QgsSymbolLayerV2Utils::decodeScaleMethod(), EqualInterval, Jenks, QgsSymbolLayerV2Utils::loadColorRamp(), QgsSymbolLayerV2Utils::loadSymbols(), Pretty, QgsGraduatedSymbolRendererV2(), Quantile, ranges(), setMode(), setRotationField(), setScaleMethod(), setSizeScaleField(), setSourceColorRamp(), setSourceSymbol(), and StdDev.
Referenced by QgsRendererV2Registry::QgsRendererV2Registry().
|
static |
Definition at line 771 of file qgsgraduatedsymbolrendererv2.cpp.
References _calcEqualIntervalBreaks(), _calcJenksBreaks(), _calcPrettyBreaks(), _calcQuantileBreaks(), _calcStdDevBreaks(), QgsFeature::attribute(), QgsVectorColorRampV2::clone(), QgsSymbolV2::clone(), QgsVectorColorRampV2::color(), EqualInterval, QgsVectorLayer::fieldNameIndex(), QgsVectorLayer::getFeatures(), Jenks, MathUtils::lower(), QgsVectorLayer::maximumValue(), QgsVectorLayer::minimumValue(), QgsFeatureIterator::nextFeature(), QgsFeatureRequest::NoGeometry, Pretty, QgsDebugMsg, QgsGraduatedSymbolRendererV2(), Quantile, ranges(), QgsSymbolV2::setColor(), setMode(), setSourceColorRamp(), setSourceSymbol(), and StdDev.
void QgsGraduatedSymbolRendererV2::deleteAllClasses | ( | ) |
Definition at line 1162 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
void QgsGraduatedSymbolRendererV2::deleteClass | ( | int | idx | ) |
Definition at line 1157 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
|
virtual |
for debugging
Reimplemented from QgsFeatureRendererV2.
Definition at line 337 of file qgsgraduatedsymbolrendererv2.cpp.
|
virtual |
return a list of item text / symbol
Reimplemented from QgsFeatureRendererV2.
Definition at line 1066 of file qgsgraduatedsymbolrendererv2.cpp.
References classAttribute(), QgsRendererRangeV2::label(), mRanges, mRotationFieldIdx, mSizeScaleFieldIdx, mTempSymbols, and QgsRendererRangeV2::symbol().
|
virtual |
return a list of symbology items for the legend
Reimplemented from QgsFeatureRendererV2.
Definition at line 1045 of file qgsgraduatedsymbolrendererv2.cpp.
References classAttribute(), QgsRendererRangeV2::label(), ranges(), QgsRendererRangeV2::symbol(), and QgsSymbolLayerV2Utils::symbolPreviewPixmap().
|
inline |
Definition at line 116 of file qgsgraduatedsymbolrendererv2.h.
void QgsGraduatedSymbolRendererV2::moveClass | ( | int | from, |
int | to | ||
) |
Moves the category at index position from to index position to.
Definition at line 1167 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
|
inline |
Definition at line 89 of file qgsgraduatedsymbolrendererv2.h.
Referenced by create(), createRenderer(), legendSymbologyItems(), and QgsRuleBasedRendererV2::refineRuleRanges().
|
inlinevirtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 158 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone().
|
virtual |
store renderer info to XML element
Reimplemented from QgsFeatureRendererV2.
Definition at line 965 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolLayerV2Utils::encodeScaleMethod(), EqualInterval, Jenks, QgsRendererRangeV2::label(), QgsRendererRangeV2::lowerValue(), mAttrName, mMode, mRanges, mRotationField, mScaleMethod, mSizeScaleField, mSourceColorRamp, mSourceSymbol, QgsFeatureRendererV2::mUsingSymbolLevels, Pretty, Quantile, RENDERER_TAG_NAME, QgsSymbolLayerV2Utils::saveColorRamp(), QgsSymbolLayerV2Utils::saveSymbols(), StdDev, QgsRendererRangeV2::symbol(), symbols(), and QgsRendererRangeV2::upperValue().
|
inline |
Definition at line 168 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone(), and setScaleMethod().
|
inline |
Definition at line 87 of file qgsgraduatedsymbolrendererv2.h.
|
inline |
Definition at line 117 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone(), create(), createRenderer(), and readOldGraduatedSymbolRenderer().
|
inlinevirtual |
Reimplemented from QgsFeatureRendererV2.
Definition at line 156 of file qgsgraduatedsymbolrendererv2.h.
void QgsGraduatedSymbolRendererV2::setScaleMethod | ( | QgsSymbolV2::ScaleMethod | scaleMethod | ) |
Definition at line 1140 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges, mScaleMethod, scaleMethod(), QgsFeatureRendererV2::setScaleMethodToSymbol(), and QgsRendererRangeV2::symbol().
|
inline |
Definition at line 161 of file qgsgraduatedsymbolrendererv2.h.
void QgsGraduatedSymbolRendererV2::setSourceColorRamp | ( | QgsVectorColorRampV2 * | ramp | ) |
Definition at line 1107 of file qgsgraduatedsymbolrendererv2.cpp.
References mSourceColorRamp.
Referenced by clone(), create(), createRenderer(), and updateColorRamp().
void QgsGraduatedSymbolRendererV2::setSourceSymbol | ( | QgsSymbolV2 * | sym | ) |
Definition at line 1097 of file qgsgraduatedsymbolrendererv2.cpp.
References mSourceSymbol.
Referenced by clone(), create(), createRenderer(), and updateSymbols().
|
inline |
Definition at line 163 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone().
void QgsGraduatedSymbolRendererV2::sortByLabel | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 1206 of file qgsgraduatedsymbolrendererv2.cpp.
References labelGreaterThan(), labelLessThan(), and mRanges.
void QgsGraduatedSymbolRendererV2::sortByValue | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 1183 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges, QgsDebugMsg, valueGreaterThan(), and valueLessThan().
QgsVectorColorRampV2 * QgsGraduatedSymbolRendererV2::sourceColorRamp | ( | ) |
Definition at line 1103 of file qgsgraduatedsymbolrendererv2.cpp.
References mSourceColorRamp.
QgsSymbolV2 * QgsGraduatedSymbolRendererV2::sourceSymbol | ( | ) |
Definition at line 1093 of file qgsgraduatedsymbolrendererv2.cpp.
References mSourceSymbol.
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 235 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), QgsSymbolV2::DataDefinedRotation, QgsSymbolV2::DataDefinedSizeScale, QgsVectorLayer::fieldNameIndex(), mAttrName, mAttrNum, mRanges, mRotationField, mRotationFieldIdx, mSizeScaleField, mSizeScaleFieldIdx, mTempSymbols, QgsSymbolV2::setRenderHints(), and QgsSymbolV2::startRender().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 259 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges, and mTempSymbols.
|
virtual |
to be overridden
feature | feature |
Implements QgsFeatureRendererV2.
Definition at line 184 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsFeature::attributes(), isNull(), QgsSymbolV2::Line, QgsSymbolV2::Marker, mAttrName, mAttrNum, mRotationFieldIdx, mScaleMethod, mSizeScaleFieldIdx, mTempSymbols, QgsDebugMsg, QgsMarkerSymbolV2::setAngle(), QgsMarkerSymbolV2::setScaleMethod(), QgsMarkerSymbolV2::setSize(), QgsLineSymbolV2::setWidth(), size, symbolForValue(), and QgsSymbolV2::type().
|
protected |
Definition at line 173 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
Referenced by symbolForFeature().
|
virtual |
for symbol levels
Implements QgsFeatureRendererV2.
Definition at line 377 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
Referenced by save().
|
virtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented from QgsFeatureRendererV2.
Definition at line 360 of file qgsgraduatedsymbolrendererv2.cpp.
References mAttrName, mRanges, mRotationField, and mSizeScaleField.
void QgsGraduatedSymbolRendererV2::updateColorRamp | ( | QgsVectorColorRampV2 * | ramp | ) |
Update the color ramp used.
Also updates all symbols colors. Doesn't alter current breaks.
Definition at line 1113 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), QgsVectorColorRampV2::color(), mRanges, QgsSymbolV2::setColor(), setSourceColorRamp(), QgsRendererRangeV2::symbol(), and updateRangeSymbol().
bool QgsGraduatedSymbolRendererV2::updateRangeLabel | ( | int | rangeIndex, |
QString | label | ||
) |
Definition at line 313 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
bool QgsGraduatedSymbolRendererV2::updateRangeLowerValue | ( | int | rangeIndex, |
double | value | ||
) |
Definition at line 329 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
bool QgsGraduatedSymbolRendererV2::updateRangeSymbol | ( | int | rangeIndex, |
QgsSymbolV2 * | symbol | ||
) |
Definition at line 305 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
Referenced by updateColorRamp(), and updateSymbols().
bool QgsGraduatedSymbolRendererV2::updateRangeUpperValue | ( | int | rangeIndex, |
double | value | ||
) |
Definition at line 321 of file qgsgraduatedsymbolrendererv2.cpp.
References mRanges.
void QgsGraduatedSymbolRendererV2::updateSymbols | ( | QgsSymbolV2 * | sym | ) |
Update the all symbols but leave breaks and colors.
Definition at line 1127 of file qgsgraduatedsymbolrendererv2.cpp.
References QgsSymbolV2::clone(), QgsSymbolV2::color(), mRanges, QgsSymbolV2::setColor(), setSourceSymbol(), QgsRendererRangeV2::symbol(), and updateRangeSymbol().
|
virtual |
Implements QgsFeatureRendererV2.
Definition at line 279 of file qgsgraduatedsymbolrendererv2.cpp.
References mAttrName, mRanges, mRotationField, mSizeScaleField, and QgsSymbolV2::usedAttributes().
|
protected |
Definition at line 172 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone(), dump(), save(), startRender(), symbolForFeature(), toSld(), and usedAttributes().
|
protected |
attribute index (derived from attribute name in startRender)
Definition at line 182 of file qgsgraduatedsymbolrendererv2.h.
Referenced by startRender(), and symbolForFeature().
|
protected |
Definition at line 174 of file qgsgraduatedsymbolrendererv2.h.
|
protected |
Definition at line 173 of file qgsgraduatedsymbolrendererv2.h.
Referenced by addClass(), clone(), deleteAllClasses(), deleteClass(), dump(), legendSymbolItems(), moveClass(), save(), setScaleMethod(), sortByLabel(), sortByValue(), startRender(), stopRender(), symbolForValue(), symbols(), toSld(), updateColorRamp(), updateRangeLabel(), updateRangeLowerValue(), updateRangeSymbol(), updateRangeUpperValue(), updateSymbols(), usedAttributes(), and ~QgsGraduatedSymbolRendererV2().
|
protected |
Definition at line 177 of file qgsgraduatedsymbolrendererv2.h.
Referenced by save(), startRender(), toSld(), and usedAttributes().
|
protected |
Definition at line 183 of file qgsgraduatedsymbolrendererv2.h.
Referenced by legendSymbolItems(), startRender(), and symbolForFeature().
|
protected |
Definition at line 179 of file qgsgraduatedsymbolrendererv2.h.
Referenced by save(), setScaleMethod(), and symbolForFeature().
|
protected |
Definition at line 178 of file qgsgraduatedsymbolrendererv2.h.
Referenced by save(), startRender(), toSld(), and usedAttributes().
|
protected |
Definition at line 183 of file qgsgraduatedsymbolrendererv2.h.
Referenced by legendSymbolItems(), startRender(), and symbolForFeature().
|
protected |
Definition at line 176 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone(), save(), setSourceColorRamp(), sourceColorRamp(), and ~QgsGraduatedSymbolRendererV2().
|
protected |
Definition at line 175 of file qgsgraduatedsymbolrendererv2.h.
Referenced by clone(), save(), setSourceSymbol(), sourceSymbol(), and ~QgsGraduatedSymbolRendererV2().
|
protected |
temporary symbols, used for data-defined rotation and scaling
Definition at line 187 of file qgsgraduatedsymbolrendererv2.h.
Referenced by legendSymbolItems(), startRender(), stopRender(), and symbolForFeature().