Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
24 class CORE_EXPORT QgsComposerArrow: public QgsComposerItem
25 {
26  public:
27 
29  {
32  SVGMarker
33  };
34 
36  QgsComposerArrow( const QPointF& startPoint, const QPointF& stopPoint, QgsComposition* c );
38 
40  virtual int type() const { return ComposerArrow; }
41 
43  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
44 
46  void setSceneRect( const QRectF& rectangle );
47 
49  void setArrowHeadWidth( double width );
50  double arrowHeadWidth() const {return mArrowHeadWidth;}
51 
52  void setOutlineWidth( double width );
53  double outlineWidth() const {return mPen.widthF();}
54 
55  void setStartMarker( const QString& svgPath );
56  QString startMarker() const {return mStartMarkerFile;}
57  void setEndMarker( const QString& svgPath );
58  QString endMarker() const {return mEndMarkerFile;}
59 
60  QColor arrowColor() const { return mArrowColor; }
61  void setArrowColor( const QColor& c ) { mArrowColor = c; }
62 
63  MarkerMode markerMode() const { return mMarkerMode;}
64  void setMarkerMode( MarkerMode mode ) {mMarkerMode = mode;}
65 
70  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
71 
76  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
77 
78  private:
79 
81  {
83  EndMarker
84  };
85 
86  QPointF mStartPoint;
87  QPointF mStopPoint;
88 
89  QPen mPen;
90  QBrush mBrush;
91 
97 
101  QString mEndMarkerFile;
104  QColor mArrowColor;
105 
106 
107 
110  void adaptItemSceneRect();
112  void drawHardcodedMarker( QPainter* p, MarkerType type );
114  void drawSVGMarker( QPainter* p, MarkerType type, const QString& markerPath );
116  void initGraphicsSettings();
117 };
118 
119 #endif // QGSCOMPOSERARROW_H