Quantum GIS API Documentation  1.8
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                : [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 QGSUNIQUEVALUERENDERER_H
00018 #define QGSUNIQUEVALUERENDERER_H
00019 
00020 #include "qgsrenderer.h"
00021 #include <QMap>
00022 
00023 class CORE_EXPORT QgsUniqueValueRenderer: public QgsRenderer
00024 {
00025   public:
00026     QgsUniqueValueRenderer( QGis::GeometryType type );
00027     QgsUniqueValueRenderer( const QgsUniqueValueRenderer& other );
00028     QgsUniqueValueRenderer& operator=( const QgsUniqueValueRenderer& other );
00029     virtual ~QgsUniqueValueRenderer();
00032     virtual bool willRenderFeature( QgsFeature *f );
00033 
00036     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00037 
00043     int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00046     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00048     bool needsAttributes() const;
00050     QgsAttributeList classificationAttributes() const;
00051     void updateSymbolAttributes();
00053     QString name() const;
00056     void insertValue( QString name, QgsSymbol* symbol );
00058     void clearValues();
00060     void setClassificationField( int field );
00062     int classificationField() const;
00064     const QList<QgsSymbol*> symbols() const { return mSymbols.values(); }
00067     const QMap<QString, QgsSymbol*> symbolMap() const { return mSymbols; }
00068     QgsRenderer* clone() const;
00069 
00071     QgsSymbol *symbolForFeature( const QgsFeature* f );
00072 
00073   protected:
00075     int mClassificationField;
00077     QMap<QString, QgsSymbol*> mSymbols;
00078 
00080     QgsAttributeList mSymbolAttributes;
00081     bool mSymbolAttributesDirty;  // insertValue was called
00082 };
00083 
00084 inline bool QgsUniqueValueRenderer::needsAttributes() const
00085 {
00086   return true;
00087 }
00088 
00089 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines