Quantum GIS API Documentation  1.7.4
src/core/renderer/qgssinglesymbolrenderer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgssinglesymbolrenderer.h  -  description
00003                              -------------------
00004     begin                : Oct 2003
00005     copyright            : (C) 2003 by Marco Hugentobler
00006     email                : mhugent@geo.unizh.ch
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 /* $Id: qgssinglesymbolrenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
00018 
00019 #ifndef QGSSINGLESYMBOLRENDERER_H
00020 #define QGSSINGLESYMBOLRENDERER_H
00021 
00022 #include <QMap>
00023 #include "qgsrenderer.h"
00024 #include "qgsrendercontext.h"
00025 
00026 
00028 class CORE_EXPORT QgsSingleSymbolRenderer: public QgsRenderer
00029 {
00030   public:
00031     QgsSingleSymbolRenderer( QGis::GeometryType type );
00032     QgsSingleSymbolRenderer( const QgsSingleSymbolRenderer& other );
00033     QgsSingleSymbolRenderer& operator=( const QgsSingleSymbolRenderer& other );
00034     virtual ~QgsSingleSymbolRenderer();
00035 
00037     void addSymbol( QgsSymbol* sy );
00038     /*Returns a pointer to mSymbol*/
00039     const QgsSymbol* symbol() const;
00040 
00043     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00044 
00050     virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00052     /*virtual void writeXML(std::ostream& xml);*/
00055     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00057     bool needsAttributes() const;
00059     QgsAttributeList classificationAttributes() const;
00060     void updateSymbolAttributes();
00062     virtual QString name() const;
00064     const QList<QgsSymbol*> symbols() const;
00066     QgsRenderer* clone() const;
00067 
00070     QgsSymbol* symbolForFeature( const QgsFeature* f ) { return mSymbol0; }
00071 
00072   protected:
00074     QgsSymbol *mSymbol0;
00075     QMap<QString, QgsSymbol*> mSymbols;
00077     QgsAttributeList mSymbolAttributes;
00078 };
00079 
00080 inline const QgsSymbol* QgsSingleSymbolRenderer::symbol() const
00081 {
00082   return mSymbol0;
00083 }
00084 
00085 inline bool QgsSingleSymbolRenderer::needsAttributes() const
00086 {
00087   return true;
00088 }
00089 
00090 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines