Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
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]

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. More...
 
int classificationField () const
 Returns the number of the classification field. More...
 
void setClassificationField (int id)
 Sets the id of the classification field. More...
 
void setMinimumSymbol (QgsSymbol *sy)
 Sets the symbol for the minimum value. More...
 
void setMaximumSymbol (QgsSymbol *sy)
 Sets the symbol for the maximum value. More...
 
void setDrawPolygonOutline (bool draw)
 Sets whether to draw the polygon outline. More...
 
const QgsSymbolminimumSymbol () const
 Returns the symbol for the minimum value. More...
 
const QgsSymbolmaximumSymbol () const
 Returns the symbol for the maximum value. More...
 
bool drawPolygonOutline () const
 whether to draw a polygon outline More...
 
virtual int readXML (const QDomNode &rnode, QgsVectorLayer &vl)
 Reads the renderer configuration from an XML file. More...
 
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. More...
 
bool needsAttributes () const
 Returns true. More...
 
QgsAttributeList classificationAttributes () const
 Returns a list with the index of the classification attribute. More...
 
QString name () const
 Returns the renderers name. More...
 
const QList< QgsSymbol * > symbols () const
 Return symbology items. More...
 
QgsRendererclone () const
 Returns a copy of the renderer (a deep copy on the heap) More...
 
- Public Member Functions inherited from QgsRenderer
 QgsRenderer ()
 Default ctor sets up selection color from project properties. More...
 
virtual ~QgsRenderer ()
 Virtual destructor because we have virtual methods... More...
 
virtual bool willRenderFeature (QgsFeature *f)
 Determines if a feature will be rendered or not. More...
 
void renderFeature (QPainter *p, QgsFeature &f, QImage *img, bool selected, double widthScale=1.0, double rasterScaleFactor=1.0)
 A vector layer passes features to a renderer object to change the brush and pen of the qpainter. More...
 
void renderFeature (QgsRenderContext &renderContext, QgsFeature &f, QImage *pic, bool selected)
 A vector layer passes features to a renderer object to change the brush and pen of the qpainter. More...
 
virtual bool containsPixmap () const
 Returns true if this renderer returns a pixmap in the render method (e.g. More...
 
virtual bool usesTransparency () const
 Returns true if this renderer uses its own transparency settings, e.g. More...
 
virtual QgsSymbolsymbolForFeature (const QgsFeature *f)
 Returns renderer symbol for a feature. More...
 

Protected Attributes

int mClassificationField
 Number of the classification field (it must be a numerical field) More...
 
QgsSymbolmMinimumSymbol
 Item for the minimum value. More...
 
QgsSymbolmMaximumSymbol
 Item for the maximum value. More...
 
bool mDrawPolygonOutline
 Whether to draw the polygon outline or not. More...
 
- Protected Attributes inherited from QgsRenderer
QGis::GeometryType mGeometryType
 Layer type. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsRenderer
static void setSelectionColor (QColor color)
 Change selection color. More...
 
static QColor selectionColor ()
 Get selection color. More...
 
static void scaleBrush (QBrush &b, double rasterScaleFactor)
 Scales a brush to a given raster scale factor (e.g. More...
 
- Static Protected Attributes inherited from QgsRenderer
static QColor mSelectionColor = QColor( 0, 0, 0 )
 Color to draw selected features - static so we can change it in proj props and automatically all renderers are updated. More...
 

Detailed Description

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

Definition at line 31 of file qgscontinuouscolorrenderer.h.

Constructor & Destructor Documentation

QgsContinuousColorRenderer::QgsContinuousColorRenderer ( QGis::GeometryType  type)

Definition at line 32 of file qgscontinuouscolorrenderer.cpp.

References QgsRenderer::mGeometryType.

Referenced by clone().

QgsContinuousColorRenderer::QgsContinuousColorRenderer ( const QgsContinuousColorRenderer other)
QgsContinuousColorRenderer::~QgsContinuousColorRenderer ( )
virtual

Definition at line 59 of file qgscontinuouscolorrenderer.cpp.

References mMaximumSymbol, and mMinimumSymbol.

Member Function Documentation

QgsAttributeList QgsContinuousColorRenderer::classificationAttributes ( ) const
virtual

Returns a list with the index of the classification attribute.

Implements QgsRenderer.

Definition at line 245 of file qgscontinuouscolorrenderer.cpp.

References mClassificationField.

int QgsContinuousColorRenderer::classificationField ( ) const
inline

Returns the number of the classification field.

Definition at line 88 of file qgscontinuouscolorrenderer.h.

References mClassificationField.

Referenced by readXML().

QgsRenderer * QgsContinuousColorRenderer::clone ( ) const
virtual

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

Implements QgsRenderer.

Definition at line 311 of file qgscontinuouscolorrenderer.cpp.

References QgsContinuousColorRenderer().

bool QgsContinuousColorRenderer::drawPolygonOutline ( ) const
inline

whether to draw a polygon outline

Definition at line 58 of file qgscontinuouscolorrenderer.h.

const QgsSymbol * QgsContinuousColorRenderer::maximumSymbol ( ) const
inline

Returns the symbol for the maximum value.

Definition at line 103 of file qgscontinuouscolorrenderer.h.

References mMaximumSymbol.

const QgsSymbol * QgsContinuousColorRenderer::minimumSymbol ( ) const
inline

Returns the symbol for the minimum value.

Definition at line 98 of file qgscontinuouscolorrenderer.h.

References mMinimumSymbol.

QString QgsContinuousColorRenderer::name ( ) const
virtual

Returns the renderers name.

Implements QgsRenderer.

Definition at line 252 of file qgscontinuouscolorrenderer.cpp.

bool QgsContinuousColorRenderer::needsAttributes ( ) const
inlinevirtual

Returns true.

Implements QgsRenderer.

Definition at line 108 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 194 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
void QgsContinuousColorRenderer::setClassificationField ( int  id)
inline

Sets the id of the classification field.

Definition at line 93 of file qgscontinuouscolorrenderer.h.

References mClassificationField.

Referenced by readXML().

void QgsContinuousColorRenderer::setDrawPolygonOutline ( bool  draw)
inline

Sets whether to draw the polygon outline.

Definition at line 52 of file qgscontinuouscolorrenderer.h.

void QgsContinuousColorRenderer::setMaximumSymbol ( QgsSymbol sy)

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 71 of file qgscontinuouscolorrenderer.cpp.

References mMaximumSymbol.

Referenced by readXML().

void QgsContinuousColorRenderer::setMinimumSymbol ( QgsSymbol sy)

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 65 of file qgscontinuouscolorrenderer.cpp.

References mMinimumSymbol.

Referenced by readXML().

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

Return symbology items.

Implements QgsRenderer.

Definition at line 303 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 257 of file qgscontinuouscolorrenderer.cpp.

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

Member Data Documentation

int QgsContinuousColorRenderer::mClassificationField
protected

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

Definition at line 79 of file qgscontinuouscolorrenderer.h.

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

bool QgsContinuousColorRenderer::mDrawPolygonOutline
protected

Whether to draw the polygon outline or not.

Definition at line 85 of file qgscontinuouscolorrenderer.h.

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

QgsSymbol* QgsContinuousColorRenderer::mMaximumSymbol
protected
QgsSymbol* QgsContinuousColorRenderer::mMinimumSymbol
protected

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