Quantum GIS API Documentation  1.8
src/core/renderer/qgscontinuouscolorrenderer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgscontinuouscolorrenderer.h  -  description
00003                              -------------------
00004     begin                : Nov 2003
00005     copyright            : (C) 2003 by Marco Hugentobler
00006     email                : [email protected]
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #ifndef QGSCONTINUOUSCOLORRENDERER_H
00018 #define QGSCONTINUOUSCOLORRENDERER_H
00019 
00020 #include "qgsrenderer.h"
00021 #include "qgsmaptopixel.h"
00022 #include "qgspoint.h"
00023 #include "qgsfeature.h"
00024 
00025 class QgsSymbol;
00026 class QPainter;
00027 class QImage;
00028 
00030 class CORE_EXPORT QgsContinuousColorRenderer: public QgsRenderer
00031 {
00032   public:
00033     QgsContinuousColorRenderer( QGis::GeometryType type );
00034     QgsContinuousColorRenderer( const QgsContinuousColorRenderer& other );
00035     QgsContinuousColorRenderer& operator=( const QgsContinuousColorRenderer& other );
00036     virtual ~QgsContinuousColorRenderer();
00037 
00040     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00041 
00043     int classificationField() const;
00045     void setClassificationField( int id );
00047     void setMinimumSymbol( QgsSymbol* sy );
00049     void setMaximumSymbol( QgsSymbol* sy );
00051     void setDrawPolygonOutline( bool draw ) { mDrawPolygonOutline = draw;}
00053     const QgsSymbol* minimumSymbol() const;
00055     const QgsSymbol* maximumSymbol() const;
00057     bool drawPolygonOutline() const { return mDrawPolygonOutline; }
00063     virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00066     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00068     bool needsAttributes() const;
00070     QgsAttributeList classificationAttributes() const;
00072     QString name() const;
00074     const QList<QgsSymbol*> symbols() const;
00075     QgsRenderer* clone() const;
00076   protected:
00078     int mClassificationField;
00080     QgsSymbol* mMinimumSymbol;
00082     QgsSymbol* mMaximumSymbol;
00084     bool mDrawPolygonOutline;
00085 };
00086 
00087 inline int QgsContinuousColorRenderer::classificationField() const
00088 {
00089   return mClassificationField;
00090 }
00091 
00092 inline void QgsContinuousColorRenderer::setClassificationField( int id )
00093 {
00094   mClassificationField = id;
00095 }
00096 
00097 inline const QgsSymbol* QgsContinuousColorRenderer::minimumSymbol() const
00098 {
00099   return mMinimumSymbol;
00100 }
00101 
00102 inline const QgsSymbol* QgsContinuousColorRenderer::maximumSymbol() const
00103 {
00104   return mMaximumSymbol;
00105 }
00106 
00107 inline bool QgsContinuousColorRenderer::needsAttributes() const
00108 {
00109   return true;
00110 }
00111 
00112 
00113 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines