Quantum GIS API Documentation  1.8
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                : [email protected]
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 
00018 #ifndef QGSSINGLESYMBOLRENDERER_H
00019 #define QGSSINGLESYMBOLRENDERER_H
00020 
00021 #include <QMap>
00022 #include "qgsrenderer.h"
00023 #include "qgsrendercontext.h"
00024 
00025 
00027 class CORE_EXPORT QgsSingleSymbolRenderer: public QgsRenderer
00028 {
00029   public:
00030     QgsSingleSymbolRenderer( QGis::GeometryType type );
00031     QgsSingleSymbolRenderer( const QgsSingleSymbolRenderer& other );
00032     QgsSingleSymbolRenderer& operator=( const QgsSingleSymbolRenderer& other );
00033     virtual ~QgsSingleSymbolRenderer();
00034 
00036     void addSymbol( QgsSymbol* sy );
00037     /*Returns a pointer to mSymbol*/
00038     const QgsSymbol* symbol() const;
00039 
00042     void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
00043 
00049     virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
00051     /*virtual void writeXML(std::ostream& xml);*/
00054     virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
00056     bool needsAttributes() const;
00058     QgsAttributeList classificationAttributes() const;
00059     void updateSymbolAttributes();
00061     virtual QString name() const;
00063     const QList<QgsSymbol*> symbols() const;
00065     QgsRenderer* clone() const;
00066 
00069     QgsSymbol* symbolForFeature( const QgsFeature* f ) { Q_UNUSED( f ); return mSymbol0; }
00070 
00071   protected:
00073     QgsSymbol *mSymbol0;
00074     QMap<QString, QgsSymbol*> mSymbols;
00076     QgsAttributeList mSymbolAttributes;
00077 };
00078 
00079 inline const QgsSymbol* QgsSingleSymbolRenderer::symbol() const
00080 {
00081   return mSymbol0;
00082 }
00083 
00084 inline bool QgsSingleSymbolRenderer::needsAttributes() const
00085 {
00086   return true;
00087 }
00088 
00089 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines