Quantum GIS API Documentation  1.8
Public Member Functions | Protected Attributes
QgsContinuousColorRenderer Class Reference

Renderer class which interpolates rgb values linear between the minimum and maximum value of the classification field. More...

#include <qgscontinuouscolorrenderer.h>

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

List of all members.

Public Member Functions

 QgsContinuousColorRenderer (QGis::GeometryType type)
 QgsContinuousColorRenderer (const QgsContinuousColorRenderer &other)
QgsContinuousColorRendereroperator= (const QgsContinuousColorRenderer &other)
virtual ~QgsContinuousColorRenderer ()
void renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *img, bool selected, double opacity=1.0)
 Renders the feature using the minimum and maximum value of the classification field added in 1.2.
int classificationField () const
 Returns the number of the classification field.
void setClassificationField (int id)
 Sets the id of the classification field.
void setMinimumSymbol (QgsSymbol *sy)
 Sets the symbol for the minimum value.
void setMaximumSymbol (QgsSymbol *sy)
 Sets the symbol for the maximum value.
void setDrawPolygonOutline (bool draw)
 Sets whether to draw the polygon outline.
const QgsSymbolminimumSymbol () const
 Returns the symbol for the minimum value.
const QgsSymbolmaximumSymbol () const
 Returns the symbol for the maximum value.
bool drawPolygonOutline () const
 whether to draw a polygon outline
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 with the index of the classification attribute.
QString name () const
 Returns the renderers name.
const QList< QgsSymbol * > symbols () const
 Return symbology items.
QgsRendererclone () const
 Returns a copy of the renderer (a deep copy on the heap)

Protected Attributes

int mClassificationField
 Number of the classification field (it must be a numerical field)
QgsSymbolmMinimumSymbol
 Item for the minimum value.
QgsSymbolmMaximumSymbol
 Item for the maximum value.
bool mDrawPolygonOutline
 Whether to draw the polygon outline or not.

Detailed Description

Renderer class which interpolates rgb values linear between the minimum and maximum value of the classification field.

Definition at line 30 of file qgscontinuouscolorrenderer.h.


Constructor & Destructor Documentation

Definition at line 31 of file qgscontinuouscolorrenderer.cpp.

References QgsRenderer::mGeometryType.

Referenced by clone().

Definition at line 58 of file qgscontinuouscolorrenderer.cpp.

References mMaximumSymbol, and mMinimumSymbol.


Member Function Documentation

Returns a list with the index of the classification attribute.

Implements QgsRenderer.

Definition at line 244 of file qgscontinuouscolorrenderer.cpp.

References mClassificationField.

Returns the number of the classification field.

Definition at line 87 of file qgscontinuouscolorrenderer.h.

References mClassificationField.

Referenced by readXML().

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

Implements QgsRenderer.

Definition at line 310 of file qgscontinuouscolorrenderer.cpp.

References QgsContinuousColorRenderer().

whether to draw a polygon outline

Definition at line 57 of file qgscontinuouscolorrenderer.h.

Returns the symbol for the maximum value.

Definition at line 102 of file qgscontinuouscolorrenderer.h.

References mMaximumSymbol.

Returns the symbol for the minimum value.

Definition at line 97 of file qgscontinuouscolorrenderer.h.

References mMinimumSymbol.

QString QgsContinuousColorRenderer::name ( ) const [virtual]

Returns the renderers name.

Implements QgsRenderer.

Definition at line 251 of file qgscontinuouscolorrenderer.cpp.

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

Returns true.

Implements QgsRenderer.

Definition at line 107 of file qgscontinuouscolorrenderer.h.

QgsContinuousColorRenderer & QgsContinuousColorRenderer::operator= ( const QgsContinuousColorRenderer other)
int QgsContinuousColorRenderer::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 193 of file qgscontinuouscolorrenderer.cpp.

References classificationField(), QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fieldNameIndex(), QgsVectorLayer::geometryType(), mDrawPolygonOutline, QgsRenderer::mGeometryType, QgsSymbol::readXML(), setClassificationField(), setMaximumSymbol(), setMinimumSymbol(), and QgsVectorLayer::setRenderer().

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

Sets the id of the classification field.

Definition at line 92 of file qgscontinuouscolorrenderer.h.

References mClassificationField.

Referenced by readXML().

Sets whether to draw the polygon outline.

Definition at line 51 of file qgscontinuouscolorrenderer.h.

Sets the symbol for the maximum value.

The symbol has to be created using the new operator and is automatically deleted when inserting a new symbol or when the instance is destroyed

Definition at line 70 of file qgscontinuouscolorrenderer.cpp.

References mMaximumSymbol.

Referenced by readXML().

Sets the symbol for the minimum value.

The symbol has to be created using the new operator and is automatically deleted when inserting a new symbol or when the instance is destroyed

Definition at line 64 of file qgscontinuouscolorrenderer.cpp.

References mMinimumSymbol.

Referenced by readXML().

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

Return symbology items.

Implements QgsRenderer.

Definition at line 302 of file qgscontinuouscolorrenderer.cpp.

References mMaximumSymbol, and mMinimumSymbol.

bool QgsContinuousColorRenderer::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 256 of file qgscontinuouscolorrenderer.cpp.

References QgsVectorLayer::dataProvider(), QgsVectorDataProvider::fields(), mClassificationField, mDrawPolygonOutline, mMaximumSymbol, mMinimumSymbol, and QgsSymbol::writeXML().


Member Data Documentation

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

Definition at line 78 of file qgscontinuouscolorrenderer.h.

Referenced by classificationAttributes(), classificationField(), operator=(), QgsContinuousColorRenderer(), renderFeature(), setClassificationField(), and writeXML().

Whether to draw the polygon outline or not.

Definition at line 84 of file qgscontinuouscolorrenderer.h.

Referenced by readXML(), renderFeature(), and writeXML().


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