Quantum GIS API Documentation  1.8
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 
00018 #ifndef QGSGRADUATEDSYMBOLRENDERER_H
00019 #define QGSGRADUATEDSYMBOLRENDERER_H
00020 
00021 #include "qgsrenderer.h"
00022 
00023 class QgsVectorLayer;
00024 
00026 class CORE_EXPORT QgsGraduatedSymbolRenderer: public QgsRenderer
00027 {
00028   public:
00029     enum Mode
00030     {
00031       EqualInterval,
00032       Quantile,
00033       Empty
00034     };
00035     QgsGraduatedSymbolRenderer( QGis::GeometryType type, Mode theMode = EqualInterval );
00036     QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer& other );
00037     QgsGraduatedSymbolRenderer& operator=( const QgsGraduatedSymbolRenderer& other );
00038     virtual ~QgsGraduatedSymbolRenderer();
00039 
00045     Mode mode() const;
00046 
00052     void setMode( Mode theMode );
00053 
00056     void addSymbol( QgsSymbol* sy );
00057 
00059     int classificationField() const;
00060 
00062     void removeSymbols();
00063 
00066     virtual bool willRenderFeature( QgsFeature *f );
00067 
00075     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00076 
00079     void setClassificationField( int field );
00080 
00086     virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00087 
00090     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00091 
00093     bool needsAttributes() const;
00094 
00096     QgsAttributeList classificationAttributes() const;
00097 
00098     void updateSymbolAttributes();
00099 
00101     QString name() const;
00102 
00104     const QList<QgsSymbol*> symbols() const;
00105 
00107     QgsRenderer* clone() const;
00108 
00109     QgsSymbol *symbolForFeature( const QgsFeature* f );
00110 
00111   protected:
00113     Mode mMode;
00114 
00116     int mClassificationField;
00117 
00119     QList<QgsSymbol*> mSymbols;
00120 
00122     QgsAttributeList mSymbolAttributes;
00123 };
00124 
00125 inline void QgsGraduatedSymbolRenderer::addSymbol( QgsSymbol* sy )
00126 {
00127   mSymbols.push_back( sy );
00128 }
00129 
00130 inline int QgsGraduatedSymbolRenderer::classificationField() const
00131 {
00132   return mClassificationField;
00133 }
00134 
00135 inline void QgsGraduatedSymbolRenderer::setClassificationField( int index )
00136 {
00137   mClassificationField = index;
00138 }
00139 
00140 inline bool QgsGraduatedSymbolRenderer::needsAttributes() const
00141 {
00142   return true;
00143 }
00144 
00145 
00146 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines