NCL Composer  0.1.5
 All Classes Functions Variables Pages
qnstgraphicsedge.h
1 #ifndef QNSTGRAPHICSEDGE_H
2 #define QNSTGRAPHICSEDGE_H
3 
4 #define PI 3.14159265
5 
6 #include <cmath>
7 #include <QLineF>
8 
9 #include "qnstgraphicsentity.h"
10 
12 {
13 public:
15 
17 
18  bool isInvalid();
19 
20  void setInvalid(bool invalid);
21 
22  QnstGraphicsEntity* getEntityA() const;
23 
24  void setEntityA(QnstGraphicsEntity* entity);
25 
26  QnstGraphicsEntity* getEntityB() const;
27 
28  void setEntityB(QnstGraphicsEntity* entity);
29 
30  bool isEntityAEnabled() const;
31 
32  void setEntityAEnabled(bool enable);
33 
34  bool isEntityBEnabled() const;
35 
36  void setEntityBEnabled(bool enable);
37 
38  void adjust(bool avoidCollision = false);
39 
40  void aux_adjust(QPointF pointa, QPointF pointb);
41 
42  QPointF arcPointAt(QLineF line, qreal at, bool toend = true);
43 
44  qreal getAngle();
45 
46  void setAngle(qreal angle);
47 
48  qreal getAdjAngle();
49 
50  void setAdjAngle(qreal adjangle);
51 
52 protected:
53  virtual void draw(QPainter* painter) = 0;
54 
55  virtual void delineate(QPainterPath* painter) const = 0;
56 
57  virtual void move(QGraphicsSceneMouseEvent* event);
58 
59  virtual void resize(QGraphicsSceneMouseEvent* event);
60 
61 private:
62  bool invalid;
63 
64  qreal angle;
65 
66  qreal adjustedangle;
67 
68  bool entityaenabled;
69 
70  bool entitybenabled;
71 
72  QnstGraphicsEntity* entitya;
73 
74  QnstGraphicsEntity* entityb;
75 };
76 
77 // \fixme This class is temporary and must be removed as soon as possible!
78 // The information of edges should be in the parent, and not inside the own
79 // entity
81 {
82 public:
85 
86 
87  QVector<QnstGraphicsEdge*> getnstGraphicsEdges();
88 
89  void addnstGraphicsEdge(QnstGraphicsEdge* edge);
90 
91  void removenstGraphicsEdge(QnstGraphicsEdge* edge);
92 
93 private:
94  QVector<QnstGraphicsEdge*> edges;
95 };
96 
97 #endif // QNSTGRAPHICSEDGE_H