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 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;
00073 };
00074
00075 inline bool QgsUniqueValueRenderer::needsAttributes() const
00076 {
00077 return true;
00078 }
00079
00080 #endif