Quantum GIS API Documentation  1.7.4
src/core/renderer/qgsuniquevaluerenderer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgsuniquevaluerenderer.h  -  description
00003                              -------------------
00004     begin                : July 2004
00005     copyright            : (C) 2004 by Marco Hugentobler
00006     email                : marco.hugentobler@autoform.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: qgsuniquevaluerenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
00018 #ifndef QGSUNIQUEVALUERENDERER_H
00019 #define QGSUNIQUEVALUERENDERER_H
00020 
00021 #include "qgsrenderer.h"
00022 #include <QMap>
00023 
00024 class CORE_EXPORT QgsUniqueValueRenderer: public QgsRenderer
00025 {
00026   public:
00027     QgsUniqueValueRenderer( QGis::GeometryType type );
00028     QgsUniqueValueRenderer( const QgsUniqueValueRenderer& other );
00029     QgsUniqueValueRenderer& operator=( const QgsUniqueValueRenderer& other );
00030     virtual ~QgsUniqueValueRenderer();
00033     virtual bool willRenderFeature( QgsFeature *f );
00034 
00037     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00038 
00044     int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00047     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00049     bool needsAttributes() const;
00051     QgsAttributeList classificationAttributes() const;
00052     void updateSymbolAttributes();
00054     QString name() const;
00057     void insertValue( QString name, QgsSymbol* symbol );
00059     void clearValues();
00061     void setClassificationField( int field );
00063     int classificationField() const;
00065     const QList<QgsSymbol*> symbols() const { return mSymbols.values(); }
00068     const QMap<QString, QgsSymbol*> symbolMap() const { return mSymbols; }
00069     QgsRenderer* clone() const;
00070 
00072     QgsSymbol *symbolForFeature( const QgsFeature* f );
00073 
00074   protected:
00076     int mClassificationField;
00078     QMap<QString, QgsSymbol*> mSymbols;
00079 
00081     QgsAttributeList mSymbolAttributes;
00082     bool mSymbolAttributesDirty;  // insertValue was called
00083 };
00084 
00085 inline bool QgsUniqueValueRenderer::needsAttributes() const
00086 {
00087   return true;
00088 }
00089 
00090 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines