QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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  bool writeDxf( QgsDxfExport& e, double mmMapUnitScaleFactor, const QString& layerName, const QgsSymbolV2RenderContext* context, const QgsFeature* f, const QPointF& shift = QPointF( 0.0, 0.0 ) ) const;
44 
45  void setSymbolName( const QString& name ) { mSymbolName = name; }
46  QString symbolName() const { return mSymbolName; }
47 
48  void setSymbolWidth( double w ) { mSymbolWidth = w; }
49  double symbolWidth() const { return mSymbolWidth; }
50 
51  void setSymbolHeight( double h ) { mSymbolHeight = h; }
52  double symbolHeight() const { return mSymbolHeight; }
53 
54  Qt::PenStyle outlineStyle() const { return mOutlineStyle; }
55  void setOutlineStyle( Qt::PenStyle outlineStyle ) { mOutlineStyle = outlineStyle; }
56 
57  void setOutlineWidth( double w ) { mOutlineWidth = w; }
58  double outlineWidth() const { return mOutlineWidth; }
59 
60  void setFillColor( const QColor& c ) { mFillColor = c;}
61  QColor fillColor() const { return mFillColor; }
62 
63  void setOutlineColor( const QColor& c ) { mOutlineColor = c; }
64  QColor outlineColor() const { return mOutlineColor; }
65 
66  void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolWidthUnit = unit; }
67  QgsSymbolV2::OutputUnit symbolWidthUnit() const { return mSymbolWidthUnit; }
68 
69  void setSymbolWidthMapUnitScale( const QgsMapUnitScale& scale ) { mSymbolWidthMapUnitScale = scale; }
70  const QgsMapUnitScale& symbolWidthMapUnitScale() const { return mSymbolWidthMapUnitScale; }
71 
72  void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolHeightUnit = unit; }
73  QgsSymbolV2::OutputUnit symbolHeightUnit() const { return mSymbolHeightUnit; }
74 
75  void setSymbolHeightMapUnitScale( const QgsMapUnitScale& scale ) { mSymbolHeightMapUnitScale = scale; }
76  const QgsMapUnitScale& symbolHeightMapUnitScale() const { return mSymbolHeightMapUnitScale; }
77 
78  void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidthUnit = unit; }
79  QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidthUnit; }
80 
81  void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOutlineWidthMapUnitScale = scale; }
82  const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutlineWidthMapUnitScale; }
83 
86 
87  void setMapUnitScale( const QgsMapUnitScale& scale );
89 
90  private:
91  QString mSymbolName;
92  double mSymbolWidth;
93  QgsSymbolV2::OutputUnit mSymbolWidthUnit;
94  QgsMapUnitScale mSymbolWidthMapUnitScale;
95  double mSymbolHeight;
96  QgsSymbolV2::OutputUnit mSymbolHeightUnit;
97  QgsMapUnitScale mSymbolHeightMapUnitScale;
98  QColor mFillColor;
99  QColor mOutlineColor;
100  Qt::PenStyle mOutlineStyle;
101  double mOutlineWidth;
102  QgsSymbolV2::OutputUnit mOutlineWidthUnit;
103  QgsMapUnitScale mOutlineWidthMapUnitScale;
104 
105  QPainterPath mPainterPath;
106 
107  QPen mPen;
108  QBrush mBrush;
109 
117  void preparePath( const QString& symbolName, QgsSymbolV2RenderContext& context, double* scaledWidth = 0, double* scaledHeight = 0, const QgsFeature* f = 0 );
118 
120  bool hasDataDefinedProperty() const;
121 };
122 
123 #endif // QGSELLIPSESYMBOLLAYERV2_H
124 
125 
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition: qgsexpression.h:89
void setSymbolHeight(double h)
Definition: qgsellipsesymbollayerv2.h:51
void setSymbolWidthUnit(QgsSymbolV2::OutputUnit unit)
Definition: qgsellipsesymbollayerv2.h:66
OutputUnit
Definition: qgssymbolv2.h:47
QgsSymbolV2::OutputUnit outputUnit() const
Definition: qgssymbollayerv2.cpp:356
virtual QgsSymbolLayerV2 * clone() const =0
QColor fillColor() const
Get fill color.
Definition: qgsellipsesymbollayerv2.h:61
void setSymbolWidth(double w)
Definition: qgsellipsesymbollayerv2.h:48
void setMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgssymbollayerv2.cpp:365
double outlineWidth() const
Definition: qgsellipsesymbollayerv2.h:58
void startRender(QgsSymbolV2RenderContext &context)
Definition: qgssymbollayerv2.cpp:230
void setOutlineWidthUnit(QgsSymbolV2::OutputUnit unit)
Definition: qgsellipsesymbollayerv2.h:78
virtual void toSld(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
Definition: qgssymbollayerv2.cpp:480
Definition: qgssymbollayerv2.h:45
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:113
void setOutputUnit(QgsSymbolV2::OutputUnit unit)
Definition: qgssymbollayerv2.cpp:350
A symbol layer for rendering objects with major and minor axis (e.g.
Definition: qgsellipsesymbollayerv2.h:24
QMap< QString, QString > QgsStringMap
Definition: qgis.h:416
double symbolWidth() const
Definition: qgsellipsesymbollayerv2.h:49
virtual void writeSldMarker(QDomDocument &doc, QDomElement &element, QgsStringMap props) const
Definition: qgssymbollayerv2.h:198
const QgsMapUnitScale & symbolWidthMapUnitScale() const
Definition: qgsellipsesymbollayerv2.h:70
void setSymbolHeightMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsellipsesymbollayerv2.h:75
virtual void renderPoint(const QPointF &point, QgsSymbolV2RenderContext &context)=0
void setFillColor(const QColor &c)
Set fill color.
Definition: qgsellipsesymbollayerv2.h:60
virtual QgsStringMap properties() const =0
void setOutlineStyle(Qt::PenStyle outlineStyle)
Definition: qgsellipsesymbollayerv2.h:55
void setSymbolName(const QString &name)
Definition: qgsellipsesymbollayerv2.h:45
QgsSymbolV2::OutputUnit symbolHeightUnit() const
Definition: qgsellipsesymbollayerv2.h:73
QgsMapUnitScale mapUnitScale() const
Definition: qgssymbollayerv2.cpp:371
virtual bool writeDxf(QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, const QgsSymbolV2RenderContext *context, const QgsFeature *f, const QPointF &shift=QPointF(0.0, 0.0)) const
Definition: qgssymbollayerv2.cpp:81
virtual QString layerType() const =0
const QgsMapUnitScale & outlineWidthMapUnitScale() const
Definition: qgsellipsesymbollayerv2.h:82
QColor outlineColor() const
Get outline color.
Definition: qgsellipsesymbollayerv2.h:64
const QgsMapUnitScale & symbolHeightMapUnitScale() const
Definition: qgsellipsesymbollayerv2.h:76
Definition: qgsmapunitscale.h:24
void setSymbolWidthMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsellipsesymbollayerv2.h:69
Qt::PenStyle outlineStyle() const
Definition: qgsellipsesymbollayerv2.h:54
QgsSymbolV2::OutputUnit symbolWidthUnit() const
Definition: qgsellipsesymbollayerv2.h:67
Definition: qgssymbollayerv2.h:160
Definition: qgssymbolv2.h:167
QString symbolName() const
Definition: qgsellipsesymbollayerv2.h:46
double symbolHeight() const
Definition: qgsellipsesymbollayerv2.h:52
virtual void stopRender(QgsSymbolV2RenderContext &context)=0
void setSymbolHeightUnit(QgsSymbolV2::OutputUnit unit)
Definition: qgsellipsesymbollayerv2.h:72
void setOutlineColor(const QColor &c)
Set outline color.
Definition: qgsellipsesymbollayerv2.h:63
void setOutlineWidthMapUnitScale(const QgsMapUnitScale &scale)
Definition: qgsellipsesymbollayerv2.h:81
Definition: qgsdxfexport.h:32
void setOutlineWidth(double w)
Definition: qgsellipsesymbollayerv2.h:57
QgsSymbolV2::OutputUnit outlineWidthUnit() const
Definition: qgsellipsesymbollayerv2.h:79