QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposerarrow.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposerarrow.h
3  ----------------------
4  begin : November 2009
5  copyright : (C) 2009 by Marco Hugentobler
6  email : marco@hugis.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSCOMPOSERARROW_H
19 #define QGSCOMPOSERARROW_H
20 
21 #include "qgscomposeritem.h"
22 #include <QBrush>
23 #include <QPen>
24 
25 class QgsLineSymbolV2;
26 
28 class CORE_EXPORT QgsComposerArrow: public QgsComposerItem
29 {
30  public:
31 
33  {
36  SVGMarker
37  };
38 
43 
49  QgsComposerArrow( const QPointF& startPoint, const QPointF& stopPoint, QgsComposition* c );
50 
52 
56  virtual int type() const { return ComposerArrow; }
57 
59  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
60 
63  void setSceneRect( const QRectF& rectangle );
64 
69  void setArrowHeadWidth( double width );
70 
75  double arrowHeadWidth() const { return mArrowHeadWidth; }
76 
80  Q_DECL_DEPRECATED void setOutlineWidth( double width );
81 
85  Q_DECL_DEPRECATED double outlineWidth() const;
86 
92  void setStartMarker( const QString& svgPath );
93 
99  QString startMarker() const { return mStartMarkerFile; }
100 
106  void setEndMarker( const QString& svgPath );
107 
113  QString endMarker() const { return mEndMarkerFile; }
114 
118  Q_DECL_DEPRECATED QColor arrowColor() const;
119 
123  Q_DECL_DEPRECATED void setArrowColor( const QColor& c );
124 
131  QColor arrowHeadOutlineColor() const { return mArrowHeadOutlineColor; }
132 
139  void setArrowHeadOutlineColor( const QColor& color );
140 
147  QColor arrowHeadFillColor() const { return mArrowHeadFillColor; }
148 
155  void setArrowHeadFillColor( const QColor& color );
156 
163  void setArrowHeadOutlineWidth( const double width );
164 
171  double arrowHeadOutlineWidth() const { return mArrowHeadOutlineWidth; }
172 
178  void setLineSymbol( QgsLineSymbolV2* symbol );
179 
185  QgsLineSymbolV2* lineSymbol() { return mLineSymbol; }
186 
191  MarkerMode markerMode() const { return mMarkerMode; }
192 
197  void setMarkerMode( MarkerMode mode );
198 
203  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
204 
209  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
210 
211  private:
212 
214  {
216  EndMarker
217  };
218 
219  QPointF mStartPoint;
220  QPointF mStopPoint;
221 
227 
228  QPen mPen;
229  QBrush mBrush;
230 
236 
240  QString mEndMarkerFile;
243 
251 
253 
256  void adaptItemSceneRect();
258  double computeMarkerMargin() const;
260  void drawHardcodedMarker( QPainter* p, MarkerType type );
262  void drawSVGMarker( QPainter* p, MarkerType type, const QString& markerPath );
264  void init();
268  void createDefaultLineSymbol();
272  void drawLine( QPainter *painter );
273 };
274 
275 #endif // QGSCOMPOSERARROW_H
276 
277 
int mStartXIdx
Considering the rectangle as spanning [x[0], x[1]] x [y[0], y[1]], these indices specify which index ...
QgsLineSymbolV2 * lineSymbol()
Returns the line symbol used for drawing the line portion of the arrow.
double outlineWidth
Definition: qgssvgcache.cpp:78
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
An item that draws an arrow between to points.
A item that forms part of a map composition.
QColor arrowHeadFillColor() const
Returns the color used to fill the arrow head.
QString mStartMarkerFile
Path to the start marker file.
MarkerMode markerMode() const
Returns marker mode, which controls how the arrow endpoints are drawn.
MarkerMode mMarkerMode
Default marker, no marker or svg marker.
QgsLineSymbolV2 * mLineSymbol
QColor arrowHeadOutlineColor() const
Returns the color used to draw outline around the the arrow head.
virtual int type() const
Return composer item type.
int mBoundsBehaviour
Indicates QGIS version to mimic bounding box behaviour for.
QString endMarker() const
Returns the marker drawn at the end of the line.
Graphics scene for map printing.
QString startMarker() const
Returns the marker drawn at the start of the line.
double arrowHeadOutlineWidth() const
Returns the pen width for the outline of the arrow head.
void init(const bool manageZValue)
double mArrowHeadWidth
Width of the arrow marker in mm.
QString mEndMarkerFile
Path to the end marker file.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
double mStartArrowHeadHeight
Height of the arrow marker in mm.
double arrowHeadWidth() const
Returns the width of the arrow head in mm.