Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgslinesymbollayerv2.h
Go to the documentation of this file.
1 
2 #ifndef QGSLINESYMBOLLAYERV2_H
3 #define QGSLINESYMBOLLAYERV2_H
4 
5 #include "qgssymbollayerv2.h"
6 
7 #include <QPen>
8 #include <QVector>
9 
10 #define DEFAULT_SIMPLELINE_COLOR QColor(0,0,0)
11 #define DEFAULT_SIMPLELINE_WIDTH DEFAULT_LINE_WIDTH
12 #define DEFAULT_SIMPLELINE_PENSTYLE Qt::SolidLine
13 #define DEFAULT_SIMPLELINE_JOINSTYLE Qt::BevelJoin
14 #define DEFAULT_SIMPLELINE_CAPSTYLE Qt::SquareCap
15 
16 
18 {
19  public:
21  double width = DEFAULT_SIMPLELINE_WIDTH,
22  Qt::PenStyle penStyle = DEFAULT_SIMPLELINE_PENSTYLE );
23 
24  // static stuff
25 
26  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
27 
28  // implemented from base classes
29 
30  QString layerType() const;
31 
32  void startRender( QgsSymbolV2RenderContext& context );
33 
34  void stopRender( QgsSymbolV2RenderContext& context );
35 
36  void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
37 
38  QgsStringMap properties() const;
39 
40  QgsSymbolLayerV2* clone() const;
41 
42  // new stuff
43 
44  Qt::PenStyle penStyle() const { return mPenStyle; }
45  void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; }
46 
47  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
48  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
49 
50  Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; }
51  void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; }
52 
53  double offset() const { return mOffset; }
54  void setOffset( double offset ) { mOffset = offset; }
55 
56  bool useCustomDashPattern() const { return mUseCustomDashPattern; }
57  void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; }
58 
59  QVector<qreal> customDashVector() const { return mCustomDashVector; }
60  void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashVector = vector; }
61 
62  protected:
63  Qt::PenStyle mPenStyle;
64  Qt::PenJoinStyle mPenJoinStyle;
65  Qt::PenCapStyle mPenCapStyle;
66  QPen mPen;
67  QPen mSelPen;
68  double mOffset;
69  //use a custom dash dot pattern instead of the predefined ones
72  QVector<qreal> mCustomDashVector;
73 };
74 
76 
77 #define DEFAULT_MARKERLINE_ROTATE true
78 #define DEFAULT_MARKERLINE_INTERVAL 3
79 
81 {
82  public:
84  double interval = DEFAULT_MARKERLINE_INTERVAL );
85 
87 
88  enum Placement
89  {
94  CentralPoint
95  };
96 
97  // static stuff
98 
99  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
100 
101  // implemented from base classes
102 
103  QString layerType() const;
104 
105  void startRender( QgsSymbolV2RenderContext& context );
106 
107  void stopRender( QgsSymbolV2RenderContext& context );
108 
109  void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
110 
111  QgsStringMap properties() const;
112 
113  QgsSymbolLayerV2* clone() const;
114 
115  void setColor( const QColor& color );
116 
118  bool setSubSymbol( QgsSymbolV2* symbol );
119 
120  virtual void setWidth( double width );
121  virtual double width() const;
122 
123  // new stuff
124 
125  bool rotateMarker() const { return mRotateMarker; }
126  void setRotateMarker( bool rotate ) { mRotateMarker = rotate; }
127 
128  double interval() const { return mInterval; }
129  void setInterval( double interval ) { mInterval = interval; }
130 
131  double offset() const { return mOffset; }
132  void setOffset( double offset ) { mOffset = offset; }
133 
134  Placement placement() const { return mPlacement; }
135  void setPlacement( Placement p ) { mPlacement = p; }
136 
137  protected:
138 
139  void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2RenderContext& context );
140  void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderContext& context );
141  void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderContext& context );
142 
144  double mInterval;
146  double mOffset;
148 };
149 
151 
152 #define DEFAULT_LINEDECORATION_COLOR QColor(0,0,0)
153 #define DEFAULT_LINEDECORATION_WIDTH DEFAULT_LINE_WIDTH
154 
156 {
157  public:
159  double width = DEFAULT_LINEDECORATION_WIDTH );
160 
162 
163  // static stuff
164 
165  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
166 
167  // implemented from base classes
168 
169  QString layerType() const;
170 
171  void startRender( QgsSymbolV2RenderContext& context );
172 
173  void stopRender( QgsSymbolV2RenderContext& context );
174 
175  void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
176 
177  QgsStringMap properties() const;
178 
179  QgsSymbolLayerV2* clone() const;
180 
181  protected:
182  QPen mPen;
183  QPen mSelPen;
184 
185 };
186 
187 #endif