00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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 protected:
00072 int mClassificationField;
00074 QMap<QString, QgsSymbol*> mSymbols;
00076 QgsSymbol *symbolForFeature( const QgsFeature* f );
00078 QgsAttributeList mSymbolAttributes;
00079 bool mSymbolAttributesDirty;
00080 };
00081
00082 inline bool QgsUniqueValueRenderer::needsAttributes() const
00083 {
00084 return true;
00085 }
00086
00087 #endif