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     void renderFeature( QPainter* p, QgsFeature& f, QImage* img, bool selected, double widthScale = 1.0, double rasterScaleFactor = 1.0 );
00040     int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00043     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00045     bool needsAttributes() const;
00047     QgsAttributeList classificationAttributes() const;
00048     void updateSymbolAttributes();
00050     QString name() const;
00053     void insertValue( QString name, QgsSymbol* symbol );
00055     void clearValues();
00057     void setClassificationField( int field );
00059     int classificationField() const;
00061     const QList<QgsSymbol*> symbols() const;
00062     QgsRenderer* clone() const;
00063   protected:
00065     int mClassificationField;
00067     QMap<QString, QgsSymbol*> mSymbols;
00069     QgsSymbol *symbolForFeature( const QgsFeature* f );
00071     QgsAttributeList mSymbolAttributes;
00072     bool mSymbolAttributesDirty;  // insertValue was called
00073 };
00074 
00075 inline bool QgsUniqueValueRenderer::needsAttributes() const
00076 {
00077   return true;
00078 }
00079 
00080 #endif

Generated on Fri Jan 9 16:51:13 2009 for Quantum GIS API Documentation by  doxygen 1.5.1