Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgssinglesymbolrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglesymbolrenderer.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: qgssinglesymbolrenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
18 
19 #ifndef QGSSINGLESYMBOLRENDERER_H
20 #define QGSSINGLESYMBOLRENDERER_H
21 
22 #include <QMap>
23 #include "qgsrenderer.h"
24 #include "qgsrendercontext.h"
25 
26 
28 class CORE_EXPORT QgsSingleSymbolRenderer: public QgsRenderer
29 {
30  public:
33  QgsSingleSymbolRenderer& operator=( const QgsSingleSymbolRenderer& other );
34  virtual ~QgsSingleSymbolRenderer();
35 
37  void addSymbol( QgsSymbol* sy );
38  /*Returns a pointer to mSymbol*/
39  const QgsSymbol* symbol() const;
40 
43  void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
44 
50  virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
52  /*virtual void writeXML(std::ostream& xml);*/
55  virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
57  bool needsAttributes() const;
60  void updateSymbolAttributes();
62  virtual QString name() const;
64  const QList<QgsSymbol*> symbols() const;
66  QgsRenderer* clone() const;
67 
70  QgsSymbol* symbolForFeature( const QgsFeature* f ) { return mSymbol0; }
71 
72  protected:
75  QMap<QString, QgsSymbol*> mSymbols;
78 };
79 
81 {
82  return mSymbol0;
83 }
84 
86 {
87  return true;
88 }
89 
90 #endif