QGIS API Documentation  2.10.1-Pisa
 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 ) override;
33 
34  virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature ) override;
35 
36  virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
37 
38  virtual void stopRender( QgsRenderContext& context ) override;
39 
40  virtual QList<QString> usedAttributes() override;
41 
42  QgsSymbolV2* symbol() const;
43  void setSymbol( QgsSymbolV2* s );
44 
45  void setRotationField( QString fieldOrExpression ) override;
46  QString rotationField() const override;
47 
48  void setSizeScaleField( QString fieldOrExpression );
49  QString sizeScaleField() const;
50 
51  void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
52  QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; }
53 
54  virtual QString dump() const override;
55 
56  virtual QgsFeatureRendererV2* clone() const override;
57 
58  virtual void toSld( QDomDocument& doc, QDomElement &element ) const override;
59  static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType );
60 
62  virtual int capabilities() override { return SymbolLevels | RotationField; }
63 
64  virtual QgsSymbolV2List symbols() override;
65 
67  static QgsFeatureRendererV2* create( QDomElement& element );
68 
70  virtual QDomElement save( QDomDocument& doc ) override;
71 
73  virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
74 
77  virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QString rule = QString() ) override;
78 
81  virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
82 
86  static QgsSingleSymbolRendererV2* convertFromRenderer( const QgsFeatureRendererV2 *renderer );
87 
88  protected:
93 
94  // temporary stuff for rendering
96  double mOrigSize;
97 };
98 
99 
100 #endif // QGSSINGLESYMBOLRENDERERV2_H
virtual QgsSymbolV2 * originalSymbolForFeature(QgsFeature &feature)
Return symbol for feature.
Definition: qgsrendererv2.h:96
virtual void setRotationField(QString fieldName)
sets rotation field of renderer (if supported by the renderer)
GeometryType
Definition: qgis.h:155
virtual QString dump() const
for debugging
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
virtual int capabilities() override
returns bitwise OR-ed capabilities of the renderer
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, QString rule="")
return a list of item text / symbol
QgsSymbolV2::ScaleMethod scaleMethod() const
Container of fields for a vector layer.
Definition: qgsfield.h:173
virtual QList< QString > usedAttributes()=0
QScopedPointer< QgsSymbolV2 > mSymbol
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:162
QgsSymbolV2::ScaleMethod mScaleMethod
virtual QgsLegendSymbologyList legendSymbologyItems(QSize iconSize)
return a list of symbology items for the legend
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
virtual void stopRender(QgsRenderContext &context)=0
virtual QString rotationField() const
return rotation field name (or empty string if not set or not supported by renderer) ...
virtual QgsSymbolV2List symbols()=0
for symbol levels
virtual QgsFeatureRendererV2 * clone() const =0
QScopedPointer< QgsExpression > mSizeScale
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 QgsLegendSymbolListV2 legendSymbolItemsV2() const
Return a list of symbology items for the legend.
virtual QgsSymbolV2 * symbolForFeature(QgsFeature &feature)=0
to be overridden
QScopedPointer< QgsSymbolV2 > mTempSymbol
QScopedPointer< QgsExpression > mRotation