Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsgraduatedsymbolrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgraduatedsymbolrenderer.h - description
3  -------------------
4  begin : Oct 2003
5  copyright : (C) 2003 by Marco Hugentobler
6  email : mhugent@geo.unizh.ch
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: qgsgraduatedsymbolrenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
18 
19 #ifndef QGSGRADUATEDSYMBOLRENDERER_H
20 #define QGSGRADUATEDSYMBOLRENDERER_H
21 
22 #include "qgsrenderer.h"
23 
24 class QgsVectorLayer;
25 
27 class CORE_EXPORT QgsGraduatedSymbolRenderer: public QgsRenderer
28 {
29  public:
30  enum Mode
31  {
34  Empty
35  };
36  QgsGraduatedSymbolRenderer( QGis::GeometryType type, Mode theMode = EqualInterval );
38  QgsGraduatedSymbolRenderer& operator=( const QgsGraduatedSymbolRenderer& other );
39  virtual ~QgsGraduatedSymbolRenderer();
40 
46  Mode mode() const;
47 
53  void setMode( Mode theMode );
54 
57  void addSymbol( QgsSymbol* sy );
58 
60  int classificationField() const;
61 
63  void removeSymbols();
64 
67  virtual bool willRenderFeature( QgsFeature *f );
68 
76  void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
77 
80  void setClassificationField( int field );
81 
87  virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
88 
91  virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
92 
94  bool needsAttributes() const;
95 
98 
99  void updateSymbolAttributes();
100 
102  QString name() const;
103 
105  const QList<QgsSymbol*> symbols() const;
106 
108  QgsRenderer* clone() const;
109 
111 
112  protected:
115 
118 
120  QList<QgsSymbol*> mSymbols;
121 
124 };
125 
127 {
128  mSymbols.push_back( sy );
129 }
130 
132 {
133  return mClassificationField;
134 }
135 
137 {
138  mClassificationField = index;
139 }
140 
142 {
143  return true;
144 }
145 
146 
147 #endif