~ubuntu-branches/ubuntu/quantal/qgis/quantal

« back to all changes in this revision

Viewing changes to src/qgsuvalmarenderer.h

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
              qgsuvalmarenderer.h  -  unique value marker renderer
3
 
                             -------------------
4
 
    begin                : September 2004
5
 
    copyright            : (C) 2004 by Lars Luthman
6
 
    email                : larsl@users.sourceforge.net
7
 
 ***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
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.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
/* $Id: qgsuvalmarenderer.h,v 1.7 2005/04/02 09:42:54 rabla Exp $ */
18
 
#ifndef QGSUVALMARENDERER_H
19
 
#define QGSUVALMARENDERER_H
20
 
 
21
 
#include "qgsrenderer.h"
22
 
#include <qcolor.h>
23
 
#include <map>
24
 
 
25
 
class QgsRenderItem;
26
 
 
27
 
class QgsUValMaRenderer: public QgsRenderer
28
 
{
29
 
 public:
30
 
    QgsUValMaRenderer();
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*/
48
 
    QString 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*/
52
 
    void clearValues();
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;
61
 
 protected:
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;
68
 
};
69
 
 
70
 
inline bool QgsUValMaRenderer::needsAttributes()
71
 
{
72
 
    return true;
73
 
}
74
 
 
75
 
inline void QgsUValMaRenderer::insertValue(QString name, QgsRenderItem* item)
76
 
{
77
 
    mEntries.insert(std::make_pair(name,item));
78
 
}
79
 
 
80
 
inline void QgsUValMaRenderer::setClassificationField(int field)
81
 
{
82
 
    mClassificationField=field;
83
 
}
84
 
 
85
 
inline int QgsUValMaRenderer::classificationField()
86
 
{
87
 
    return mClassificationField;
88
 
}
89
 
 
90
 
#endif