1
/***************************************************************************
2
qgssinglesymbolrenderer.h - description
5
copyright : (C) 2003 by Marco Hugentobler
6
email : mhugent@geo.unizh.ch
7
***************************************************************************/
9
/***************************************************************************
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. *
16
***************************************************************************/
17
/* $Id: qgssinglesymbolrenderer.h 5371 2006-04-25 01:52:13Z wonder $ */
19
#ifndef QGSSINGLESYMBOLRENDERER_H
20
#define QGSSINGLESYMBOLRENDERER_H
23
#include "qgsrenderer.h"
24
#include "qgsrendercontext.h"
27
/**Render class to display all the features with a single QgsSymbol*/
28
class CORE_EXPORT QgsSingleSymbolRenderer: public QgsRenderer
31
QgsSingleSymbolRenderer( QGis::GeometryType type );
32
QgsSingleSymbolRenderer( const QgsSingleSymbolRenderer& other );
33
QgsSingleSymbolRenderer& operator=( const QgsSingleSymbolRenderer& other );
34
virtual ~QgsSingleSymbolRenderer();
36
/**Replaces the current mSymbol by sy*/
37
void addSymbol( QgsSymbol* sy );
38
/*Returns a pointer to mSymbol*/
39
const QgsSymbol* symbol() const;
43
void renderFeature( QgsRenderContext &renderContext, QgsFeature& f, QImage* img, bool selected, double opacity = 1.0 );
45
/**Reads the renderer configuration from an XML file
46
@param rnode the Dom node to read
47
@param vl the vector layer which will be associated with the renderer
48
@return 0 in case of success, 1 if vector layer has no renderer, 2 if classification field not found
50
virtual int readXML( const QDomNode& rnode, QgsVectorLayer& vl );
51
/**Writes the contents of the renderer to a configuration file*/
52
/*virtual void writeXML(std::ostream& xml);*/
53
/**Writes the contents of the renderer to a configuration file
54
@ return true in case of success*/
55
virtual bool writeXML( QDomNode & layer_node, QDomDocument & document, const QgsVectorLayer& vl ) const;
56
/**Returns true, attributes needed for single symbol*/
57
bool needsAttributes() const;
58
/**Returns a list of all needed attributes*/
59
QgsAttributeList classificationAttributes() const;
60
void updateSymbolAttributes();
61
/**Returns the renderers name*/
62
virtual QString name() const;
63
/**Returns a list containing mSymbol*/
64
const QList<QgsSymbol*> symbols() const;
65
/**Returns a deep copy of this renderer*/
66
QgsRenderer* clone() const;
68
/**Object containing symbology information*/
70
QMap<QString, QgsSymbol*> mSymbols;
71
/**Cached copy of all underlying symbols required attribute fields*/
72
QgsAttributeList mSymbolAttributes;
75
inline const QgsSymbol* QgsSingleSymbolRenderer::symbol() const
80
inline bool QgsSingleSymbolRenderer::needsAttributes() const