Quantum GIS API Documentation  1.7.4
src/core/renderer/qgsgraduatedsymbolrenderer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgsgraduatedsymbolrenderer.h  -  description
00003                              -------------------
00004     begin                : Oct 2003
00005     copyright            : (C) 2003 by Marco Hugentobler
00006     email                : mhugent@geo.unizh.ch
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 /* $Id: qgsgraduatedsymbolrenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
00018 
00019 #ifndef QGSGRADUATEDSYMBOLRENDERER_H
00020 #define QGSGRADUATEDSYMBOLRENDERER_H
00021 
00022 #include "qgsrenderer.h"
00023 
00024 class QgsVectorLayer;
00025 
00027 class CORE_EXPORT QgsGraduatedSymbolRenderer: public QgsRenderer
00028 {
00029   public:
00030     enum Mode
00031     {
00032       EqualInterval,
00033       Quantile,
00034       Empty
00035     };
00036     QgsGraduatedSymbolRenderer( QGis::GeometryType type, Mode theMode = EqualInterval );
00037     QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer& other );
00038     QgsGraduatedSymbolRenderer& operator=( const QgsGraduatedSymbolRenderer& other );
00039     virtual ~QgsGraduatedSymbolRenderer();
00040 
00046     Mode mode() const;
00047 
00053     void setMode( Mode theMode );
00054 
00057     void addSymbol( QgsSymbol* sy );
00058 
00060     int classificationField() const;
00061 
00063     void removeSymbols();
00064 
00067     virtual bool willRenderFeature( QgsFeature *f );
00068 
00076     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00077 
00080     void setClassificationField( int field );
00081 
00087     virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00088 
00091     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00092 
00094     bool needsAttributes() const;
00095 
00097     QgsAttributeList classificationAttributes() const;
00098 
00099     void updateSymbolAttributes();
00100 
00102     QString name() const;
00103 
00105     const QList<QgsSymbol*> symbols() const;
00106 
00108     QgsRenderer* clone() const;
00109 
00110     QgsSymbol *symbolForFeature( const QgsFeature* f );
00111 
00112   protected:
00114     Mode mMode;
00115 
00117     int mClassificationField;
00118 
00120     QList<QgsSymbol*> mSymbols;
00121 
00123     QgsAttributeList mSymbolAttributes;
00124 };
00125 
00126 inline void QgsGraduatedSymbolRenderer::addSymbol( QgsSymbol* sy )
00127 {
00128   mSymbols.push_back( sy );
00129 }
00130 
00131 inline int QgsGraduatedSymbolRenderer::classificationField() const
00132 {
00133   return mClassificationField;
00134 }
00135 
00136 inline void QgsGraduatedSymbolRenderer::setClassificationField( int index )
00137 {
00138   mClassificationField = index;
00139 }
00140 
00141 inline bool QgsGraduatedSymbolRenderer::needsAttributes() const
00142 {
00143   return true;
00144 }
00145 
00146 
00147 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines