QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgssinglesymbolrendererv2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssinglesymbolrendererv2.h
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSSINGLESYMBOLRENDERERV2_H
16 #define QGSSINGLESYMBOLRENDERERV2_H
17 
18 #include "qgis.h"
19 #include "qgsrendererv2.h"
20 #include "qgssymbolv2.h"
21 
23 {
24  public:
25 
27 
28  virtual ~QgsSingleSymbolRendererV2();
29 
30  virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
31 
32  virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
33 
34  virtual void stopRender( QgsRenderContext& context );
35 
36  virtual QList<QString> usedAttributes();
37 
38  QgsSymbolV2* symbol() const;
39  void setSymbol( QgsSymbolV2* s );
40 
42  void setRotationField( QString fieldName ) { mRotationField = fieldName; }
44  QString rotationField() const { return mRotationField; }
45 
47  void setSizeScaleField( QString fieldName ) { mSizeScaleField = fieldName; }
49  QString sizeScaleField() const { return mSizeScaleField; }
50 
52  void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
54  QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; }
55 
56  virtual QString dump() const;
57 
58  virtual QgsFeatureRendererV2* clone();
59 
60  virtual void toSld( QDomDocument& doc, QDomElement &element ) const;
61  static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType );
62 
65  virtual int capabilities() { return SymbolLevels | RotationField; }
66 
67  virtual QgsSymbolV2List symbols();
68 
70  static QgsFeatureRendererV2* create( QDomElement& element );
71 
73  virtual QDomElement save( QDomDocument& doc );
74 
76  virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
77 
82 
83  protected:
85  QString mRotationField;
86  QString mSizeScaleField;
88 
89  // temporary stuff for rendering
90  int mRotationFieldIdx, mSizeScaleFieldIdx;
92  double mOrigSize;
93 };
94 
95 
96 #endif // QGSSINGLESYMBOLRENDERERV2_H
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
GeometryType
Definition: qgis.h:115
QList< QgsSymbolV2 * > QgsSymbolV2List
Definition: qgsrendererv2.h:36
virtual QString dump() const
for debugging
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
QList< QPair< QString, QPixmap > > QgsLegendSymbologyList
Definition: qgsrendererv2.h:39
QgsSymbolV2::ScaleMethod scaleMethod() const
virtual QList< QString > usedAttributes()=0
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:114
QgsSymbolV2::ScaleMethod mScaleMethod
virtual QgsLegendSymbologyList legendSymbologyItems(QSize iconSize)
return a list of symbology items for the legend
virtual void stopRender(QgsRenderContext &context)=0
void setRotationField(QString fieldName)
virtual QgsSymbolV2List symbols()=0
for symbol levels
virtual QgsFeatureRendererV2 * clone()=0
virtual QgsLegendSymbolList legendSymbolItems()
return a list of item text / symbol
virtual void toSld(QDomDocument &doc, QDomElement &element) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Contains information about the context of a rendering operation.
virtual void startRender(QgsRenderContext &context, const QgsVectorLayer *vlayer)=0
Represents a vector layer which manages a vector based data sets.
QList< QPair< QString, QgsSymbolV2 * > > QgsLegendSymbolList
Definition: qgsrendererv2.h:40
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
void setSizeScaleField(QString fieldName)