QGIS API Documentation  2.4.0-Chugiak
 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 : [email protected]
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 
26 class CORE_EXPORT QgsComposerArrow: public QgsComposerItem
27 {
28  public:
29 
31  {
34  SVGMarker
35  };
36 
38  QgsComposerArrow( const QPointF& startPoint, const QPointF& stopPoint, QgsComposition* c );
40 
42  virtual int type() const { return ComposerArrow; }
43 
45  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
46 
48  void setSceneRect( const QRectF& rectangle );
49 
51  void setArrowHeadWidth( double width );
52  double arrowHeadWidth() const {return mArrowHeadWidth;}
53 
54  void setOutlineWidth( double width );
55  double outlineWidth() const {return mPen.widthF();}
56 
57  void setStartMarker( const QString& svgPath );
58  QString startMarker() const {return mStartMarkerFile;}
59  void setEndMarker( const QString& svgPath );
60  QString endMarker() const {return mEndMarkerFile;}
61 
62  QColor arrowColor() const { return mArrowColor; }
63  void setArrowColor( const QColor& c ) { mArrowColor = c; }
64 
65  MarkerMode markerMode() const { return mMarkerMode;}
66  void setMarkerMode( MarkerMode mode );
67 
72  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
73 
78  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
79 
80  private:
81 
83  {
85  EndMarker
86  };
87 
88  QPointF mStartPoint;
89  QPointF mStopPoint;
90 
96 
97  QPen mPen;
98  QBrush mBrush;
99 
105 
109  QString mEndMarkerFile;
112  QColor mArrowColor;
117 
120  void adaptItemSceneRect();
122  double computeMarkerMargin() const;
124  void drawHardcodedMarker( QPainter* p, MarkerType type );
126  void drawSVGMarker( QPainter* p, MarkerType type, const QString& markerPath );
128  void initGraphicsSettings();
129 };
130 
131 #endif // QGSCOMPOSERARROW_H
132 
133 
int mStartXIdx
Considering the rectangle as spanning [x[0], x[1]] x [y[0], y[1]], these indices specify which index ...
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)=0
sets state from Dom document
An item that draws an arrow between to points.
A item that forms part of a map composition.
QString mStartMarkerFile
Path to the start marker file.
double outlineWidth() const
MarkerMode markerMode() const
QColor arrowColor() const
MarkerMode mMarkerMode
Default marker, no marker or svg marker.
void setArrowColor(const QColor &c)
virtual int type() const
return correct graphics item type.
int mBoundsBehaviour
Indicates QGIS version to mimic bounding box behaviour for.
QString endMarker() const
Graphics scene for map printing.
QString startMarker() const
double mArrowHeadWidth
Width of the arrow marker in mm.
QString mEndMarkerFile
Path to the end marker file.
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.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const =0
stores state in Dom element
double arrowHeadWidth() const