QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsellipsesymbollayerv2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsellipsesymbollayerv2.h
3  ---------------------
4  begin : June 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole 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 #ifndef QGSELLIPSESYMBOLLAYERV2_H
16 #define QGSELLIPSESYMBOLLAYERV2_H
17 
18 #include "qgsmarkersymbollayerv2.h"
19 #include <QPainterPath>
20 
21 class QgsExpression;
22 
25 {
26  public:
29 
30  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
31  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
32 
33  void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );
34  QString layerType() const;
35  void startRender( QgsSymbolV2RenderContext& context );
36  void stopRender( QgsSymbolV2RenderContext& context );
37  QgsSymbolLayerV2* clone() const;
38  QgsStringMap properties() const;
39 
40  void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
41  void writeSldMarker( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
42 
43  void setSymbolName( const QString& name ) { mSymbolName = name; }
44  QString symbolName() const { return mSymbolName; }
45 
46  void setSymbolWidth( double w ) { mSymbolWidth = w; }
47  double symbolWidth() const { return mSymbolWidth; }
48 
49  void setSymbolHeight( double h ) { mSymbolHeight = h; }
50  double symbolHeight() const { return mSymbolHeight; }
51 
52  void setOutlineWidth( double w ) { mOutlineWidth = w; }
53  double outlineWidth() const { return mOutlineWidth; }
54 
55  void setFillColor( const QColor& c ) { mFillColor = c;}
56  QColor fillColor() const { return mFillColor; }
57 
58  void setOutlineColor( const QColor& c ) { mOutlineColor = c; }
59  QColor outlineColor() const { return mOutlineColor; }
60 
61  void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolWidthUnit = unit; }
62  QgsSymbolV2::OutputUnit symbolWidthUnit() const { return mSymbolWidthUnit; }
63 
64  void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolHeightUnit = unit; }
65  QgsSymbolV2::OutputUnit symbolHeightUnit() const { return mSymbolHeightUnit; }
66 
67  void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidthUnit = unit; }
68  QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidthUnit; }
69 
72 
73  private:
74  QString mSymbolName;
75  double mSymbolWidth;
77  double mSymbolHeight;
79  QColor mFillColor;
80  QColor mOutlineColor;
81  double mOutlineWidth;
83 
84  QPainterPath mPainterPath;
85 
86  QPen mPen;
87  QBrush mBrush;
88 
93  void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, const QgsFeature* f = 0 );
94 
96  bool hasDataDefinedProperty() const;
97 };
98 
99 #endif // QGSELLIPSESYMBOLLAYERV2_H