1
/***************************************************************************
2
qgsuvalmarenderer.h - unique value marker renderer
5
copyright : (C) 2004 by Lars Luthman
6
email : larsl@users.sourceforge.net
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
17
/* $Id: qgsuvalmarenderer.h,v 1.7 2005/04/02 09:42:54 rabla Exp $ */
18
#ifndef QGSUVALMARENDERER_H
19
#define QGSUVALMARENDERER_H
21
#include "qgsrenderer.h"
27
class QgsUValMaRenderer: public QgsRenderer
31
virtual ~QgsUValMaRenderer();
32
void initializeSymbology(QgsVectorLayer* layer, QgsDlgVectorLayerProperties* pr=0);
33
void renderFeature(QPainter* p, QgsFeature* f,QPicture* pic, double* scalefactor, bool selected, int oversampling = 1, double widthScale = 1.);
34
/**Reads the renderer configuration from an XML file
35
@param rnode the DOM node to read
36
@param vl the vector layer which will be associated with the renderer*/
37
void readXML(const QDomNode& rnode, QgsVectorLayer& vl);
38
/**Writes the contents of the renderer to a configuration file*/
39
void writeXML(std::ostream& xml);
40
/**Writes the contents of the renderer to a configuration file
41
@ return true in case of success*/
42
virtual bool writeXML( QDomNode & layer_node, QDomDocument & document );
43
/** Returns true, if attribute values are used by the renderer and false otherwise*/
44
bool needsAttributes();
45
/**Returns a list with indexes of classification attributes*/
46
std::list<int> classificationAttributes();
47
/**Returns the renderers name*/
49
/**Inserts an entry into mEntries. The render items have to be created with the new operator and are automatically destroyed if not needed anymore*/
50
void insertValue(QString name, QgsRenderItem* item);
51
/**Removes all entries from mEntries*/
53
/**Sets the Field index used for classification*/
54
void setClassificationField(int field);
55
/**Returns the index of the classification field*/
56
int classificationField();
57
/**Returns the values*/
58
std::map<QString,QgsRenderItem*>& items();
59
/**Return symbology items*/
60
const std::list<QgsRenderItem*> items() const;
62
/**Field index used for classification*/
63
int mClassificationField;
64
/**Entries for the unique values*/
65
std::map<QString,QgsRenderItem*> mEntries;
66
/**Colour used to render selected features*/
67
QColor mSelectionColor;
70
inline bool QgsUValMaRenderer::needsAttributes()
75
inline void QgsUValMaRenderer::insertValue(QString name, QgsRenderItem* item)
77
mEntries.insert(std::make_pair(name,item));
80
inline void QgsUValMaRenderer::setClassificationField(int field)
82
mClassificationField=field;
85
inline int QgsUValMaRenderer::classificationField()
87
return mClassificationField;