QGIS API Documentation  2.14.0-Essen
qgsgeometrygeneratorsymbollayerv2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometrygeneratorsymbollayerv2.h
3  ---------------------
4  begin : November 2015
5  copyright : (C) 2015 by Matthias Kuhn
6  email : matthias at opengis dot ch
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 
16 #ifndef QGSGEOMETRYGENERATORSYMBOLLAYERV2_H
17 #define QGSGEOMETRYGENERATORSYMBOLLAYERV2_H
18 
19 #include "qgssymbollayerv2.h"
20 
22 {
23  public:
25 
26  static QgsSymbolLayerV2* create( const QgsStringMap& properties );
27 
28  QString layerType() const override;
29 
36  void setSymbolType( QgsSymbolV2::SymbolType symbolType );
37 
44  QgsSymbolV2::SymbolType symbolType() const { return mSymbolType; }
45 
46  void startRender( QgsSymbolV2RenderContext& context ) override;
47 
48  void stopRender( QgsSymbolV2RenderContext& context ) override;
49 
50  QgsSymbolLayerV2* clone() const override;
51 
52  QgsStringMap properties() const override;
53 
54  void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) override;
55 
59  void setGeometryExpression( const QString& exp );
60 
64  QString geometryExpression() const { return mExpression->expression(); }
65 
66  virtual QgsSymbolV2* subSymbol() override { return mSymbol; }
67 
68  virtual bool setSubSymbol( QgsSymbolV2* symbol ) override;
69 
70  virtual QSet<QString> usedAttributes() const override;
71 
75  bool isCompatibleWithSymbol( QgsSymbolV2* symbol ) const override;
76 
87  virtual void render( QgsSymbolV2RenderContext& context );
88 
89  void setColor( const QColor& color ) override;
90 
91  private:
92  QgsGeometryGeneratorSymbolLayerV2( const QString& expression );
93 
95  QgsFillSymbolV2* mFillSymbol;
96  QgsLineSymbolV2* mLineSymbol;
97  QgsMarkerSymbolV2* mMarkerSymbol;
98  QgsSymbolV2* mSymbol;
99 
103  QgsSymbolV2::SymbolType mSymbolType;
104 };
105 
106 #endif // QGSGEOMETRYGENERATORSYMBOLLAYERV2_H
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
virtual QgsSymbolLayerV2 * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual bool isCompatibleWithSymbol(QgsSymbolV2 *symbol) const
Returns if the layer can be used below the specified symbol.
QString geometryExpression() const
Get the expression to generate this geometry.
QgsSymbolV2::SymbolType symbolType() const
Access the symbol type.
virtual void startRender(QgsSymbolV2RenderContext &context)=0
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
virtual QString layerType() const =0
Returns a string that represents this layer type.
SymbolType
Type of the symbol.
Definition: qgssymbolv2.h:76
virtual void setColor(const QColor &color)
The fill color.
virtual void drawPreviewIcon(QgsSymbolV2RenderContext &context, QSize size)=0
virtual bool setSubSymbol(QgsSymbolV2 *symbol)
set layer&#39;s subsymbol. takes ownership of the passed symbol
virtual void stopRender(QgsSymbolV2RenderContext &context)=0