QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
25 {
26  public:
28 
29  static QgsSymbolLayerV2* create( const QgsStringMap& properties );
30 
31  QString layerType() const override;
32 
39  void setSymbolType( QgsSymbolV2::SymbolType symbolType );
40 
47  QgsSymbolV2::SymbolType symbolType() const { return mSymbolType; }
48 
49  void startRender( QgsSymbolV2RenderContext& context ) override;
50 
51  void stopRender( QgsSymbolV2RenderContext& context ) override;
52 
53  QgsSymbolLayerV2* clone() const override;
54 
55  QgsStringMap properties() const override;
56 
57  void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ) override;
58 
62  void setGeometryExpression( const QString& exp );
63 
67  QString geometryExpression() const { return mExpression->expression(); }
68 
69  virtual QgsSymbolV2* subSymbol() override { return mSymbol; }
70 
71  virtual bool setSubSymbol( QgsSymbolV2* symbol ) override;
72 
73  virtual QSet<QString> usedAttributes() const override;
74 
78  bool isCompatibleWithSymbol( QgsSymbolV2* symbol ) const override;
79 
90  virtual void render( QgsSymbolV2RenderContext& context );
91 
92  void setColor( const QColor& color ) override;
93 
94  private:
95  QgsGeometryGeneratorSymbolLayerV2( const QString& expression );
96 
98  QgsFillSymbolV2* mFillSymbol;
99  QgsLineSymbolV2* mLineSymbol;
100  QgsMarkerSymbolV2* mMarkerSymbol;
101  QgsSymbolV2* mSymbol;
102 
106  QgsSymbolV2::SymbolType mSymbolType;
107 };
108 
109 #endif // QGSGEOMETRYGENERATORSYMBOLLAYERV2_H
QgsSymbolV2::SymbolType symbolType() const
Access the symbol type.
virtual QgsSymbolLayerV2 * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
virtual QSet< QString > usedAttributes() const
Returns the set of attributes referenced by the layer.
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:79
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
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.