/
qgsellipsesymbollayerv2.h
100 lines (74 loc) · 3.6 KB
/
qgsellipsesymbollayerv2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef QGSELLIPSESYMBOLLAYERV2_H
#define QGSELLIPSESYMBOLLAYERV2_H
#include "qgsmarkersymbollayerv2.h"
#include <QPainterPath>
/**A symbol layer for rendering objects with major and minor axis (e.g. ellipse, rectangle )*/
class QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
{
public:
QgsEllipseSymbolLayerV2();
~QgsEllipseSymbolLayerV2();
static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& context );
QString layerType() const;
void startRender( QgsSymbolV2RenderContext& context );
void stopRender( QgsSymbolV2RenderContext& context );
QgsSymbolLayerV2* clone() const;
QgsStringMap properties() const;
void setSymbolName( const QString& name ){ mSymbolName = name; }
QString symbolName() const{ return mSymbolName; }
void setSymbolWidth( double w ){ mSymbolWidth = w; }
double symbolWidth() const { return mSymbolWidth; }
void setWidthField( int index, const QString& field );
const QPair<int, QString>& widthField() const { return mWidthField; }
void setSymbolHeight( double h ){ mSymbolHeight = h; }
double symbolHeight() const { return mSymbolHeight; }
void setHeightField( int index, const QString& field );
const QPair<int, QString>& heightField() const { return mHeightField; }
void setRotation( double r ){ mRotation = r; }
double rotation() const { return mRotation; }
void setRotationField( int index, const QString& field );
const QPair<int, QString>& rotationField() const { return mRotationField; }
void setOutlineWidth( double w ){ mOutlineWidth = w; }
double outlineWidth() const { return mOutlineWidth; }
void setOutlineWidthField( int index, const QString& field );
const QPair<int, QString>& outlineWidthField() const { return mOutlineWidthField; }
void setFillColor( const QColor& c ){ mFillColor = c;}
QColor fillColor() const { return mFillColor; }
void setFillColorField( int index, const QString& field );
const QPair<int, QString>& fillColorField() const { return mFillColorField; }
void setOutlineColor( const QColor& c ){ mOutlineColor = c; }
QColor outlineColor() const { return mOutlineColor; }
void setOutlineColorField( int index, const QString& field );
const QPair<int, QString>& outlineColorField() const { return mOutlineColorField; }
QSet<QString> usedAttributes() const;
private:
QString mSymbolName;
double mSymbolWidth;
double mSymbolHeight;
double mRotation;
QColor mFillColor;
QColor mOutlineColor;
double mOutlineWidth;
/**Take width from attribute (-1 if fixed width)*/
QPair<int, QString> mWidthField;
/**Take height from attribute (-1 if fixed height)*/
QPair<int, QString> mHeightField;
/**Take symbol rotation from attribute (-1 if fixed rotation)*/
QPair<int, QString> mRotationField;
/**Take outline width from attribute (-1 if fixed outline width)*/
QPair<int, QString> mOutlineWidthField;
/**Take fill color from attribute (-1 if fixed fill color)*/
QPair<int, QString> mFillColorField;
/**Take outline color from attribute (-1 if fixed outline color)*/
QPair<int, QString> mOutlineColorField;
QPainterPath mPainterPath;
QPen mPen;
QBrush mBrush;
/**Setup mPainterPath
@param feature to render (0 if no data defined rendering)*/
void preparePath( QgsSymbolV2RenderContext& context, const QgsFeature* f = 0 );
/**True if this symbol layer uses a data defined property*/
bool hasDataDefinedProperty() const;
};
#endif // QGSELLIPSESYMBOLLAYERV2_H