QGIS API Documentation  2.2.0-Valmiera
 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 #include "qgsexpression.h"
22 #include <QScopedPointer>
23 
25 {
26  public:
27 
29 
30  virtual ~QgsSingleSymbolRendererV2();
31 
32  virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature );
33 
34  virtual void startRender( QgsRenderContext& context, const QgsVectorLayer *vlayer );
35 
36  virtual void stopRender( QgsRenderContext& context );
37 
38  virtual QList<QString> usedAttributes();
39 
40  QgsSymbolV2* symbol() const;
41  void setSymbol( QgsSymbolV2* s );
42 
44  void setRotationField( QString fieldOrExpression );
46  QString rotationField() const;
47 
49  void setSizeScaleField( QString fieldOrExpression );
51  QString sizeScaleField() const;
52 
54  void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
56  QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; }
57 
58  virtual QString dump() const;
59 
60  virtual QgsFeatureRendererV2* clone();
61 
62  virtual void toSld( QDomDocument& doc, QDomElement &element ) const;
63  static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType );
64 
67  virtual int capabilities() { return SymbolLevels | RotationField; }
68 
69  virtual QgsSymbolV2List symbols();
70 
72  static QgsFeatureRendererV2* create( QDomElement& element );
73 
75  virtual QDomElement save( QDomDocument& doc );
76 
78  virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );
79 
83  virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = QString() );
84 
85  protected:
86  QScopedPointer<QgsSymbolV2> mSymbol;
87  QScopedPointer<QgsExpression> mRotation;
88  QScopedPointer<QgsExpression> mSizeScale;
90 
91  // temporary stuff for rendering
92  QScopedPointer<QgsSymbolV2> mTempSymbol;
93  double mOrigSize;
94 };
95 
96 
97 #endif // QGSSINGLESYMBOLRENDERERV2_H