Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsfillsymbollayerv2.h
Go to the documentation of this file.
1 
2 #ifndef QGSFILLSYMBOLLAYERV2_H
3 #define QGSFILLSYMBOLLAYERV2_H
4 
5 #include "qgssymbollayerv2.h"
6 
7 #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255)
8 #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern
9 #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0)
10 #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine
11 #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH
12 
13 #include <QPen>
14 #include <QBrush>
15 
17 {
18  public:
20  Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
21  QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
22  Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
23  double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH );
24 
25  // static stuff
26 
27  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
28 
29  // implemented from base classes
30 
31  QString layerType() const;
32 
33  void startRender( QgsSymbolV2RenderContext& context );
34 
35  void stopRender( QgsSymbolV2RenderContext& context );
36 
37  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
38 
39  QgsStringMap properties() const;
40 
41  QgsSymbolLayerV2* clone() const;
42 
43  Qt::BrushStyle brushStyle() const { return mBrushStyle; }
44  void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; }
45 
46  QColor borderColor() const { return mBorderColor; }
47  void setBorderColor( QColor borderColor ) { mBorderColor = borderColor; }
48 
49  Qt::PenStyle borderStyle() const { return mBorderStyle; }
50  void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; }
51 
52  double borderWidth() const { return mBorderWidth; }
53  void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth; }
54 
55  void setOffset( QPointF offset ) { mOffset = offset; }
56  QPointF offset() { return mOffset; }
57 
58  protected:
59  QBrush mBrush;
60  QBrush mSelBrush;
61  Qt::BrushStyle mBrushStyle;
62  QColor mBorderColor;
63  Qt::PenStyle mBorderStyle;
64  double mBorderWidth;
65  QPen mPen;
66 
67  QPointF mOffset;
68 };
69 
73 {
74  public:
75  QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 );
76  QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, double rotation = 0.0 );
78 
79  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
80 
81  // implemented from base classes
82 
83  QString layerType() const;
84 
85  void startRender( QgsSymbolV2RenderContext& context );
86  void stopRender( QgsSymbolV2RenderContext& context );
87 
88  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
89 
90  QgsStringMap properties() const;
91 
92  QgsSymbolLayerV2* clone() const;
93 
94  //getters and setters
95  void setSvgFilePath( const QString& svgPath );
96  QString svgFilePath() const { return mSvgFilePath; }
97  void setPatternWidth( double width ) { mPatternWidth = width;}
98  double patternWidth() const { return mPatternWidth; }
99 
100  QgsSymbolV2* subSymbol() { return mOutline; }
101  bool setSubSymbol( QgsSymbolV2* symbol );
102 
103  protected:
107  QByteArray mSvgData;
109  QString mSvgFilePath;
111  QRectF mSvgViewBox;
113  QBrush mBrush;
118 
119  private:
121  void storeViewBox();
122 };
123 
124 
125 
127 {
128  public:
131 
132  // static stuff
133 
134  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
135 
136  // implemented from base classes
137 
138  QString layerType() const;
139 
140  void startRender( QgsSymbolV2RenderContext& context );
141 
142  void stopRender( QgsSymbolV2RenderContext& context );
143 
144  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
145 
146  QgsStringMap properties() const;
147 
148  QgsSymbolLayerV2* clone() const;
149 
150  void setColor( const QColor& color );
151 
153  bool setSubSymbol( QgsSymbolV2* symbol );
154 
155  protected:
157 };
158 
159 #endif