QGIS API Documentation  2.12.0-Lyon
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 
26 {
27  public:
28 
30 
31  virtual ~QgsSingleSymbolRendererV2();
32 
33  virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
34 
35  virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) override;
36 
37  virtual void startRender( QgsRenderContext& context, const QgsFields& fields ) override;
38 
39  virtual void stopRender( QgsRenderContext& context ) override;
40 
41  virtual QList<QString> usedAttributes() override;
42 
43  QgsSymbolV2* symbol() const;
44  void setSymbol( QgsSymbolV2* s );
45 
46  Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
47  Q_DECL_DEPRECATED QString rotationField() const override;
48 
49  void setSizeScaleField( const QString& fieldOrExpression );
50  QString sizeScaleField() const;
51 
52  void setScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
53  QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; }
54 
55  virtual QString dump() const override;
56 
57  virtual QgsFeatureRendererV2* clone() const override;
58 
59  virtual void toSld( QDomDocument& doc, QDomElement &element ) const override;
60  static QgsFeatureRendererV2* createFromSld( QDomElement& element, QGis::GeometryType geomType );
61 
63  virtual int capabilities() override { return SymbolLevels | RotationField; }
64 
65  virtual QgsSymbolV2List symbols( QgsRenderContext& context ) override;
66 
68  static QgsFeatureRendererV2* create( QDomElement& element );
69 
71  virtual QDomElement save( QDomDocument& doc ) override;
72 
74  virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize ) override;
75 
78  virtual QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, const QString& rule = QString() ) override;
79 
82  virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const override;
83 
87  static QgsSingleSymbolRendererV2* convertFromRenderer( const QgsFeatureRendererV2 *renderer );
88 
89  protected:
94 
95  // temporary stuff for rendering
97  double mOrigSize;
98 };
100 
101 
102 #endif // QGSSINGLESYMBOLRENDERERV2_H
virtual QString dump() const
for debugging
virtual Q_DECL_DEPRECATED QgsSymbolV2 * originalSymbolForFeature(QgsFeature &feature)
Return symbol for feature.
virtual QDomElement save(QDomDocument &doc)
store renderer info to XML element
virtual int capabilities() override
returns bitwise OR-ed capabilities of the renderer
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:390
QgsSymbolV2::ScaleMethod scaleMethod() const
Container of fields for a vector layer.
Definition: qgsfield.h:177
GeometryType
Definition: qgis.h:104
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:176
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
Needs to be called when a new render cycle is started.
virtual void stopRender(QgsRenderContext &context)=0
virtual QgsFeatureRendererV2 * clone() const =0
virtual Q_DECL_DEPRECATED QgsSymbolV2 * symbolForFeature(QgsFeature &feature)
To be overridden.
virtual QgsLegendSymbolList legendSymbolItems(double scaleDenominator=-1, const QString &rule="")
return a list of item text / symbol
virtual Q_DECL_DEPRECATED QString rotationField() const
return rotation field name (or empty string if not set or not supported by renderer) ...
virtual Q_DECL_DEPRECATED QgsSymbolV2List symbols()
for symbol levels
QScopedPointer< QgsExpression > mSizeScale
virtual void toSld(QDomDocument &doc, QDomElement &element) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:391
Contains information about the context of a rendering operation.
ScaleMethod
Scale method.
Definition: qgssymbolv2.h:78
virtual QgsLegendSymbolListV2 legendSymbolItemsV2() const
Return a list of symbology items for the legend.
virtual Q_DECL_DEPRECATED void setRotationField(const QString &fieldName)
sets rotation field of renderer (if supported by the renderer)
QScopedPointer< QgsSymbolV2 > mTempSymbol
QScopedPointer< QgsExpression > mRotation