QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsGraduatedSymbolRendererV2 Class Reference

#include <qgsgraduatedsymbolrendererv2.h>

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

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())
 
 QgsGraduatedSymbolRendererV2 (const QgsGraduatedSymbolRendererV2 &other)
 
virtual ~QgsGraduatedSymbolRendererV2 ()
 
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 ()
 
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...
 
QString classAttribute () const
 
void setClassAttribute (QString attr)
 
const QgsRangeListranges ()
 
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 addClass (QgsRendererRangeV2 range)
 
void deleteClass (int idx)
 
void deleteAllClasses ()
 
void moveClass (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)
 
Mode mode () const
 
void setMode (Mode mode)
 
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 updateColorRamp (QgsVectorColorRampV2 *ramp, bool inverted=false)
 Update the color ramp used. More...
 
void updateSymbols (QgsSymbolV2 *sym)
 Update the all symbols but leave breaks and colors. More...
 
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 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...
 
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
QgsGraduatedSymbolRendererV2
createRenderer (QgsVectorLayer *vlayer, QString attrName, int classes, Mode mode, QgsSymbolV2 *symbol, QgsVectorColorRampV2 *ramp, bool inverted=false)
 
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

QgsSymbolV2symbolForValue (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 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
 
QgsRangeList mRanges
 
Mode mMode
 
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< QgsSymbolV2
*, 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...
 

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)
 

Detailed Description

Definition at line 64 of file qgsgraduatedsymbolrendererv2.h.

Member Enumeration Documentation

Enumerator
EqualInterval 
Quantile 
Jenks 
StdDev 
Pretty 
Custom 

Definition at line 114 of file qgsgraduatedsymbolrendererv2.h.

Constructor & Destructor Documentation

QgsGraduatedSymbolRendererV2::QgsGraduatedSymbolRendererV2 ( QString  attrName = QString(),
QgsRangeList  ranges = QgsRangeList() 
)

Definition at line 146 of file qgsgraduatedsymbolrendererv2.cpp.

Referenced by clone(), create(), and createRenderer().

QgsGraduatedSymbolRendererV2::QgsGraduatedSymbolRendererV2 ( const QgsGraduatedSymbolRendererV2 other)
QgsGraduatedSymbolRendererV2::~QgsGraduatedSymbolRendererV2 ( )
virtual

Definition at line 157 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

Member Function Documentation

void QgsGraduatedSymbolRendererV2::addClass ( QgsSymbolV2 symbol)

Definition at line 1208 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolV2::clone(), and mRanges.

void QgsGraduatedSymbolRendererV2::addClass ( QgsRendererRangeV2  range)
Note
available in python bindings as addClassRange

Definition at line 1216 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

virtual int QgsGraduatedSymbolRendererV2::capabilities ( )
inlinevirtual

returns bitwise OR-ed capabilities of the renderer

Note
added in 2.0

Reimplemented from QgsFeatureRendererV2.

Definition at line 88 of file qgsgraduatedsymbolrendererv2.h.

References QgsFeatureRendererV2::Filter.

QString QgsGraduatedSymbolRendererV2::classAttribute ( ) const
inline
QgsFeatureRendererV2 * QgsGraduatedSymbolRendererV2::clone ( )
virtual
QgsFeatureRendererV2 * QgsGraduatedSymbolRendererV2::create ( QDomElement &  element)
static
QgsGraduatedSymbolRendererV2 * QgsGraduatedSymbolRendererV2::createRenderer ( QgsVectorLayer vlayer,
QString  attrName,
int  classes,
Mode  mode,
QgsSymbolV2 symbol,
QgsVectorColorRampV2 ramp,
bool  inverted = false 
)
static
void QgsGraduatedSymbolRendererV2::deleteAllClasses ( )

Definition at line 1226 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

void QgsGraduatedSymbolRendererV2::deleteClass ( int  idx)

Definition at line 1221 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

QString QgsGraduatedSymbolRendererV2::dump ( ) const
virtual

for debugging

Reimplemented from QgsFeatureRendererV2.

Definition at line 321 of file qgsgraduatedsymbolrendererv2.cpp.

References mAttrName, and mRanges.

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

Definition at line 156 of file qgsgraduatedsymbolrendererv2.h.

QgsLegendSymbolList QgsGraduatedSymbolRendererV2::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.

Definition at line 1099 of file qgsgraduatedsymbolrendererv2.cpp.

References classAttribute(), QgsRendererRangeV2::label(), mRanges, mRotation, mSizeScale, mTempSymbols, and QgsRendererRangeV2::symbol().

QgsLegendSymbologyList QgsGraduatedSymbolRendererV2::legendSymbologyItems ( QSize  iconSize)
virtual

return a list of symbology items for the legend

Reimplemented from QgsFeatureRendererV2.

Definition at line 1078 of file qgsgraduatedsymbolrendererv2.cpp.

References classAttribute(), QgsRendererRangeV2::label(), ranges(), QgsRendererRangeV2::symbol(), and QgsSymbolLayerV2Utils::symbolPreviewPixmap().

Mode QgsGraduatedSymbolRendererV2::mode ( ) const
inline

Definition at line 124 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 1231 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

const QgsRangeList& QgsGraduatedSymbolRendererV2::ranges ( )
inline
QString QgsGraduatedSymbolRendererV2::rotationField ( ) const
virtual
Note
added in 1.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 1184 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression(), and mRotation.

Referenced by clone().

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

Definition at line 180 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), and setScaleMethod().

void QgsGraduatedSymbolRendererV2::setClassAttribute ( QString  attr)
inline

Definition at line 93 of file qgsgraduatedsymbolrendererv2.h.

void QgsGraduatedSymbolRendererV2::setInvertedColorRamp ( bool  inverted)
inline

Definition at line 157 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), create(), createRenderer(), and updateColorRamp().

void QgsGraduatedSymbolRendererV2::setMode ( Mode  mode)
inline
void QgsGraduatedSymbolRendererV2::setRotationField ( QString  fieldOrExpression)
virtual
Note
added in 1.6

Reimplemented from QgsFeatureRendererV2.

Definition at line 1179 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolLayerV2Utils::fieldOrExpressionToExpression(), and mRotation.

Referenced by clone(), and create().

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

Definition at line 1199 of file qgsgraduatedsymbolrendererv2.cpp.

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

Referenced by clone(), and create().

void QgsGraduatedSymbolRendererV2::setSizeScaleField ( QString  fieldOrExpression)
Note
added in 1.6

Definition at line 1189 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolLayerV2Utils::fieldOrExpressionToExpression(), and mSizeScale.

Referenced by clone(), and create().

void QgsGraduatedSymbolRendererV2::setSourceColorRamp ( QgsVectorColorRampV2 ramp)

Definition at line 1144 of file qgsgraduatedsymbolrendererv2.cpp.

References mSourceColorRamp.

Referenced by clone(), create(), createRenderer(), and updateColorRamp().

void QgsGraduatedSymbolRendererV2::setSourceSymbol ( QgsSymbolV2 sym)

Definition at line 1134 of file qgsgraduatedsymbolrendererv2.cpp.

References mSourceSymbol.

Referenced by clone(), create(), createRenderer(), and updateSymbols().

QString QgsGraduatedSymbolRendererV2::sizeScaleField ( ) const
Note
added in 1.6

Definition at line 1194 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression(), and mSizeScale.

Referenced by clone().

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

Definition at line 1270 of file qgsgraduatedsymbolrendererv2.cpp.

References labelGreaterThan(), labelLessThan(), and mRanges.

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

Definition at line 1139 of file qgsgraduatedsymbolrendererv2.cpp.

References mSourceColorRamp.

QgsSymbolV2 * QgsGraduatedSymbolRendererV2::sourceSymbol ( )

Definition at line 1130 of file qgsgraduatedsymbolrendererv2.cpp.

References mSourceSymbol.

void QgsGraduatedSymbolRendererV2::startRender ( QgsRenderContext context,
const QgsFields fields 
)
virtual
void QgsGraduatedSymbolRendererV2::stopRender ( QgsRenderContext context)
virtual

Implements QgsFeatureRendererV2.

Definition at line 248 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges, and mTempSymbols.

QgsSymbolV2 * QgsGraduatedSymbolRendererV2::symbolForFeature ( QgsFeature feature)
virtual
QgsSymbolV2 * QgsGraduatedSymbolRendererV2::symbolForValue ( double  value)
protected

Definition at line 162 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

Referenced by symbolForFeature().

QgsSymbolV2List QgsGraduatedSymbolRendererV2::symbols ( )
virtual

for symbol levels

Implements QgsFeatureRendererV2.

Definition at line 364 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

Referenced by save().

void QgsGraduatedSymbolRendererV2::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 347 of file qgsgraduatedsymbolrendererv2.cpp.

References mAttrName, mRanges, mRotation, and mSizeScale.

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

Update the color ramp used.

Also updates all symbols colors. Doesn't alter current breaks.

Definition at line 1149 of file qgsgraduatedsymbolrendererv2.cpp.

References QgsSymbolV2::clone(), QgsVectorColorRampV2::color(), mRanges, QgsSymbolV2::setColor(), setInvertedColorRamp(), setSourceColorRamp(), QgsRendererRangeV2::symbol(), and updateRangeSymbol().

bool QgsGraduatedSymbolRendererV2::updateRangeLabel ( int  rangeIndex,
QString  label 
)

Definition at line 297 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

bool QgsGraduatedSymbolRendererV2::updateRangeLowerValue ( int  rangeIndex,
double  value 
)

Definition at line 313 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

bool QgsGraduatedSymbolRendererV2::updateRangeSymbol ( int  rangeIndex,
QgsSymbolV2 symbol 
)

Definition at line 289 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

Referenced by updateColorRamp(), and updateSymbols().

bool QgsGraduatedSymbolRendererV2::updateRangeUpperValue ( int  rangeIndex,
double  value 
)

Definition at line 305 of file qgsgraduatedsymbolrendererv2.cpp.

References mRanges.

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

Member Data Documentation

QString QgsGraduatedSymbolRendererV2::mAttrName
protected

Definition at line 184 of file qgsgraduatedsymbolrendererv2.h.

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

int QgsGraduatedSymbolRendererV2::mAttrNum
protected

attribute index (derived from attribute name in startRender)

Definition at line 195 of file qgsgraduatedsymbolrendererv2.h.

Referenced by startRender(), and symbolForFeature().

QScopedPointer<QgsExpression> QgsGraduatedSymbolRendererV2::mExpression
protected

Definition at line 193 of file qgsgraduatedsymbolrendererv2.h.

Referenced by startRender(), and symbolForFeature().

bool QgsGraduatedSymbolRendererV2::mInvertedColorRamp
protected

Definition at line 189 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), and save().

Mode QgsGraduatedSymbolRendererV2::mMode
protected

Definition at line 186 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), and save().

QgsRangeList QgsGraduatedSymbolRendererV2::mRanges
protected
QScopedPointer<QgsExpression> QgsGraduatedSymbolRendererV2::mRotation
protected
QgsSymbolV2::ScaleMethod QgsGraduatedSymbolRendererV2::mScaleMethod
protected

Definition at line 192 of file qgsgraduatedsymbolrendererv2.h.

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

QScopedPointer<QgsExpression> QgsGraduatedSymbolRendererV2::mSizeScale
protected
QScopedPointer<QgsVectorColorRampV2> QgsGraduatedSymbolRendererV2::mSourceColorRamp
protected

Definition at line 188 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), save(), setSourceColorRamp(), and sourceColorRamp().

QScopedPointer<QgsSymbolV2> QgsGraduatedSymbolRendererV2::mSourceSymbol
protected

Definition at line 187 of file qgsgraduatedsymbolrendererv2.h.

Referenced by clone(), save(), setSourceSymbol(), and sourceSymbol().

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

temporary symbols, used for data-defined rotation and scaling

Definition at line 198 of file qgsgraduatedsymbolrendererv2.h.

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


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