Quantum GIS API Documentation  1.7.4
Public Types | Public Member Functions | Protected Attributes
QgsGraduatedSymbolRenderer Class Reference

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

#include <qgsgraduatedsymbolrenderer.h>

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

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)
QgsGraduatedSymbolRendereroperator= (const QgsGraduatedSymbolRenderer &other)
virtual ~QgsGraduatedSymbolRenderer ()
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.
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.
void addSymbol (QgsSymbol *sy)
 Adds a new item.
int classificationField () const
 Returns the indes of the classification field.
void removeSymbols ()
 Removes all symbols.
virtual bool willRenderFeature (QgsFeature *f)
 Determines if a feature will be rendered or not.
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.
virtual int readXML (const QDomNode &rnode, QgsVectorLayer &vl)
 Reads the renderer configuration from an XML file.
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.
bool needsAttributes () const
 Returns true.
QgsAttributeList classificationAttributes () const
 Returns a list of all needed attributes.
void updateSymbolAttributes ()
QString name () const
 Returns the renderers name.
const QList< QgsSymbol * > symbols () const
 Returns the symbols of the items.
QgsRendererclone () const
 Returns a copy of the renderer (a deep copy on the heap)
QgsSymbolsymbolForFeature (const QgsFeature *f)
 Returns renderer symbol for a feature.

Protected Attributes

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

Detailed Description

This class contains the information for graduate symbol rendering.

Definition at line 27 of file qgsgraduatedsymbolrenderer.h.


Member Enumeration Documentation

Enumerator:
EqualInterval 
Quantile 
Empty 

Definition at line 30 of file qgsgraduatedsymbolrenderer.h.


Constructor & Destructor Documentation

Definition at line 35 of file qgsgraduatedsymbolrenderer.cpp.

References QgsRenderer::mGeometryType.

Referenced by clone().

Definition at line 72 of file qgsgraduatedsymbolrenderer.cpp.


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 126 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 292 of file qgsgraduatedsymbolrenderer.cpp.

References mClassificationField, and mSymbolAttributes.

Returns the indes of the classification field.

Definition at line 131 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 396 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 78 of file qgsgraduatedsymbolrenderer.cpp.

References mMode.

Referenced by QgsSymbologyV2Conversion::rendererV1toV2().

QString QgsGraduatedSymbolRenderer::name ( ) const [virtual]

Returns the renderers name.

Implements QgsRenderer.

Definition at line 330 of file qgsgraduatedsymbolrenderer.cpp.

Referenced by renderFeature().

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

Returns true.

Implements QgsRenderer.

Definition at line 141 of file qgsgraduatedsymbolrenderer.h.

QgsGraduatedSymbolRenderer & QgsGraduatedSymbolRenderer::operator= ( const QgsGraduatedSymbolRenderer other)
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 245 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 101 of file qgsgraduatedsymbolrenderer.cpp.

References mSymbols, and updateSymbolAttributes().

Referenced by operator=().

void QgsGraduatedSymbolRenderer::renderFeature ( QgsRenderContext renderContext,
QgsFeature f,
QImage *  img,
bool  selected,
double  opacity = 1.0 
) [virtual]

Sets the classicifation field by index.

Parameters:
fieldthe number of the field to classify

Definition at line 136 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 87 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 222 of file qgsgraduatedsymbolrenderer.cpp.

References QgsFeature::attributeMap(), 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 96 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 114 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 335 of file qgsgraduatedsymbolrenderer.cpp.

References 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 117 of file qgsgraduatedsymbolrenderer.h.

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

The graduation mode.

Definition at line 114 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 123 of file qgsgraduatedsymbolrenderer.h.

Referenced by classificationAttributes(), and updateSymbolAttributes().

List holding the symbols for the individual classes.

Definition at line 120 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 Friends Defines