Quantum GIS API Documentation  master-2bfffaa
QgsGraduatedSymbolRenderer Class Reference

This class contains the information for graduate symbol rendering. More...

#include <qgsgraduatedsymbolrenderer.h>

+ Inheritance diagram for QgsGraduatedSymbolRenderer:
+ Collaboration diagram for QgsGraduatedSymbolRenderer:

List of all members.

Public Types

enum  Mode { EqualInterval, Quantile, Empty }

Public Member Functions

 QgsGraduatedSymbolRenderer (QGis::GeometryType type, Mode theMode=EqualInterval)
 QgsGraduatedSymbolRenderer (const QgsGraduatedSymbolRenderer &other)
virtual ~QgsGraduatedSymbolRenderer ()
void addSymbol (QgsSymbol *sy)
 Adds a new item.
QgsAttributeList classificationAttributes () const
 Returns a list of all needed attributes.
int classificationField () const
 Returns the index of the classification field.
QgsRendererclone () const
 Returns a copy of the renderer (a deep copy on the heap)
Mode mode () const
 Get the mode - which is only really used to be able to reinstate the graduated dialog properties properly, so we don't do anything else besides accessors and mutators in this class.
QString name () const
 Returns the renderers name.
bool needsAttributes () const
 Returns true.
QgsGraduatedSymbolRendereroperator= (const QgsGraduatedSymbolRenderer &other)
virtual int readXML (const QDomNode &rnode, QgsVectorLayer &vl)
 Reads the renderer configuration from an XML file.
void removeSymbols ()
 Removes all symbols.
void renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *img, bool selected, double opacity=1.0)
 Renders a feature.
void setClassificationField (int field)
 Sets the classicifation field by index.
void setMode (Mode theMode)
 Set the mode - which is only really used to be able to reinstate the graduated dialog properties properly, so we don't do anything else besides accessors and mutators in this class.
QgsSymbolsymbolForFeature (const QgsFeature *f)
 Returns renderer symbol for a feature.
const QList< QgsSymbol * > symbols () const
 Returns the symbols of the items.
void updateSymbolAttributes ()
virtual bool willRenderFeature (QgsFeature *f)
 Determines if a feature will be rendered or not.
virtual bool writeXML (QDomNode &layer_node, QDomDocument &document, const QgsVectorLayer &vl) const
 Writes the contents of the renderer to a configuration file @ return true in case of success.

Protected Attributes

int mClassificationField
 Index of the classification field (it must be a numerical field)
Mode mMode
 The graduation mode.
QgsAttributeList mSymbolAttributes
 Cached copy of all underlying symbols required attribute fields.
QList< QgsSymbol * > mSymbols
 List holding the symbols for the individual classes.

Detailed Description

This class contains the information for graduate symbol rendering.

Definition at line 26 of file qgsgraduatedsymbolrenderer.h.


Member Enumeration Documentation

Enumerator:
EqualInterval 
Quantile 
Empty 

Definition at line 29 of file qgsgraduatedsymbolrenderer.h.


Constructor & Destructor Documentation


Member Function Documentation

Adds a new item.

Parameters:
sya pointer to the QgsSymbol to be inserted. It has to be created using the new operator and is automatically destroyed when 'removeItems' is called or when this object is destroyed

Definition at line 125 of file qgsgraduatedsymbolrenderer.h.

References mSymbols.

Referenced by operator=(), QgsGraduatedSymbolRenderer(), readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().

Returns a list of all needed attributes.

Implements QgsRenderer.

Definition at line 289 of file qgsgraduatedsymbolrenderer.cpp.

References mClassificationField, and mSymbolAttributes.

Returns the index of the classification field.

Definition at line 130 of file qgsgraduatedsymbolrenderer.h.

References mClassificationField.

Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV1toV2().

Returns a copy of the renderer (a deep copy on the heap)

Implements QgsRenderer.

Definition at line 394 of file qgsgraduatedsymbolrenderer.cpp.

References QgsGraduatedSymbolRenderer().

Get the mode - which is only really used to be able to reinstate the graduated dialog properties properly, so we don't do anything else besides accessors and mutators in this class.

Definition at line 79 of file qgsgraduatedsymbolrenderer.cpp.

References mMode.

Referenced by QgsSymbologyV2Conversion::rendererV1toV2().

QString QgsGraduatedSymbolRenderer::name ( ) const [virtual]

Returns the renderers name.

Implements QgsRenderer.

Definition at line 327 of file qgsgraduatedsymbolrenderer.cpp.

Referenced by renderFeature().

bool QgsGraduatedSymbolRenderer::needsAttributes ( ) const [inline, virtual]

Returns true.

Implements QgsRenderer.

Definition at line 140 of file qgsgraduatedsymbolrenderer.h.

int QgsGraduatedSymbolRenderer::readXML ( const QDomNode &  rnode,
QgsVectorLayer vl 
) [virtual]

Reads the renderer configuration from an XML file.

Parameters:
rnodethe Dom node to read
vlthe vector layer which will be associated with the renderer
Returns:
0 in case of success, 1 if vector layer has no renderer, 2 if classification field not found

Implements QgsRenderer.

Definition at line 242 of file qgsgraduatedsymbolrenderer.cpp.

References addSymbol(), classificationField(), QgsVectorLayer::dataProvider(), Empty, EqualInterval, QgsVectorLayer::fieldNameIndex(), QgsVectorLayer::geometryType(), QgsRenderer::mGeometryType, mMode, Quantile, QgsSymbol::readXML(), setClassificationField(), QgsVectorLayer::setRenderer(), and updateSymbolAttributes().

Removes all symbols.

Definition at line 102 of file qgsgraduatedsymbolrenderer.cpp.

References mSymbols, and updateSymbolAttributes().

Referenced by operator=().

Sets the classicifation field by index.

Parameters:
fieldthe number of the field to classify

Definition at line 135 of file qgsgraduatedsymbolrenderer.h.

References mClassificationField.

Referenced by readXML(), and QgsSymbologyV2Conversion::rendererV2toV1().

Set the mode - which is only really used to be able to reinstate the graduated dialog properties properly, so we don't do anything else besides accessors and mutators in this class.

Definition at line 88 of file qgsgraduatedsymbolrenderer.cpp.

References mMode.

Returns renderer symbol for a feature.

Note:
: this method was added in version 1.6

Reimplemented from QgsRenderer.

Definition at line 220 of file qgsgraduatedsymbolrenderer.cpp.

References QgsFeature::attribute(), mClassificationField, and mSymbols.

Referenced by renderFeature(), and willRenderFeature().

const QList< QgsSymbol * > QgsGraduatedSymbolRenderer::symbols ( ) const [virtual]

Returns the symbols of the items.

Implements QgsRenderer.

Definition at line 97 of file qgsgraduatedsymbolrenderer.cpp.

References mSymbols.

Referenced by operator=(), QgsGraduatedSymbolRenderer(), and QgsSymbologyV2Conversion::rendererV1toV2().

Determines if a feature will be rendered or not.

Parameters:
fa pointer to the feature to determine if rendering will happen

Reimplemented from QgsRenderer.

Definition at line 115 of file qgsgraduatedsymbolrenderer.cpp.

References symbolForFeature().

bool QgsGraduatedSymbolRenderer::writeXML ( QDomNode &  layer_node,
QDomDocument &  document,
const QgsVectorLayer vl 
) const [virtual]

Writes the contents of the renderer to a configuration file @ return true in case of success.

Implements QgsRenderer.

Definition at line 332 of file qgsgraduatedsymbolrenderer.cpp.

References QgsFields::count(), QgsVectorLayer::dataProvider(), Empty, mClassificationField, mMode, mSymbols, QgsVectorLayer::pendingFields(), and Quantile.


Member Data Documentation

Index of the classification field (it must be a numerical field)

Definition at line 116 of file qgsgraduatedsymbolrenderer.h.

Referenced by classificationAttributes(), classificationField(), operator=(), QgsGraduatedSymbolRenderer(), setClassificationField(), symbolForFeature(), and writeXML().

The graduation mode.

Definition at line 113 of file qgsgraduatedsymbolrenderer.h.

Referenced by mode(), operator=(), QgsGraduatedSymbolRenderer(), readXML(), setMode(), and writeXML().

Cached copy of all underlying symbols required attribute fields.

Definition at line 122 of file qgsgraduatedsymbolrenderer.h.

Referenced by classificationAttributes(), and updateSymbolAttributes().

List holding the symbols for the individual classes.

Definition at line 119 of file qgsgraduatedsymbolrenderer.h.

Referenced by addSymbol(), removeSymbols(), symbolForFeature(), symbols(), updateSymbolAttributes(), and writeXML().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines