-
Notifications
You must be signed in to change notification settings - Fork 1
/
arrow.h
87 lines (78 loc) · 2.61 KB
/
arrow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*!
* \file arrow.h
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Header file for arrow used in stategraphs
*/
#ifndef ARROW_H_
#define ARROW_H_
#include <QGraphicsLineItem>
#include "./graphicsitem.h"
#include "./mpre.h"
#include "./mpost.h"
#include "./memorymodel.h"
#include "./transition.h"
/*!
* \brief Graphics arrow class
*
* This class represents an arrow in the stategraph graphics scene.
*/
class Arrow : public QGraphicsLineItem {
public:
/*!
* \brief This enum is used to hold a unique int associated with graphicsitems
*/
enum {
Type = UserType + 4 /**< enum Type is the unique graphicsitems int. */
};
Arrow(GraphicsItem *startItem, GraphicsItem *endItem,
QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
int type() const
{ return Type; }
QRectF boundingRect() const;
QPainterPath shape() const;
void setColor(const QColor &color)
{ myColor = color; }
GraphicsItem *startItem() const
{ return myStartItem; }
GraphicsItem *endItem() const
{ return myEndItem; }
QString getName() const
{ return name; }
void setName(QString n);
Mpre getMpre() const
{ return mpre; }
void setMpre(Mpre m);
Mpost getMpost() const
{ return mpost; }
Mpre * getMprePointer() { return &mpre; }
void setMpost(Mpost mp);
void setTransition(Transition * t) { myTransition = t; }
void drawHead(bool b) { showHead = b; }
int number; /**< \brief . */
int total; /**< \brief . */
double offset; /**< \brief . */
/*! \brief flag for local to current model or foreign. */
bool foreign;
/*! \brief flag for state transition or communication arrows. */
bool isCommunication;
public slots:
void updatePosition();
protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget = 0);
private:
QString name; /**< \brief . */
GraphicsItem *myStartItem; /**< \brief the tail graphics item. */
GraphicsItem *myEndItem; /**< \brief the head graphics item. */
QColor myColor; /**< \brief the arrow colour. */
/*! \brief the polygon representation of the arrow head. */
QPolygonF arrowHead;
Mpre mpre; /**< \brief any associated condition. */
Mpost mpost; /**< \brief . */
bool showHead; /**< \brief flag to show the arrow head. */
/*! \brief any associated function transition. */
Transition * myTransition;
};
#endif // ARROW_H_