39 Class implementing a graphics item for an association between two items. |
39 Class implementing a graphics item for an association between two items. |
40 |
40 |
41 The association is drawn as an arrow starting at the first items and |
41 The association is drawn as an arrow starting at the first items and |
42 ending at the second. |
42 ending at the second. |
43 """ |
43 """ |
44 def __init__(self, itemA, itemB, type=Normal, topToBottom=False, |
44 def __init__(self, itemA, itemB, assocType=Normal, topToBottom=False, |
45 parent=None): |
45 parent=None): |
46 """ |
46 """ |
47 Constructor |
47 Constructor |
48 |
48 |
49 @param itemA first widget of the association |
49 @param itemA first widget of the association |
50 @param itemB second widget of the association |
50 @param itemB second widget of the association |
51 @param type type of the association. This must be one of |
51 @param assocType type of the association. This must be one of |
52 <ul> |
52 <ul> |
53 <li>Normal (default)</li> |
53 <li>Normal (default)</li> |
54 <li>Generalisation</li> |
54 <li>Generalisation</li> |
55 <li>Imports</li> |
55 <li>Imports</li> |
56 </ul> |
56 </ul> |
57 @keyparam topToBottom flag indicating to draw the association |
57 @keyparam topToBottom flag indicating to draw the association |
58 from item A top to item B bottom (boolean) |
58 from item A top to item B bottom (boolean) |
59 @keyparam parent reference to the parent object (QGraphicsItem) |
59 @keyparam parent reference to the parent object (QGraphicsItem) |
60 """ |
60 """ |
61 if type == Normal: |
61 if assocType == Normal: |
62 arrowType = NormalArrow |
62 arrowType = NormalArrow |
63 arrowFilled = True |
63 arrowFilled = True |
64 elif type == Imports: |
64 elif assocType == Imports: |
65 arrowType = NormalArrow |
65 arrowType = NormalArrow |
66 arrowFilled = True |
66 arrowFilled = True |
67 elif type == Generalisation: |
67 elif assocType == Generalisation: |
68 arrowType = WideArrow |
68 arrowType = WideArrow |
69 arrowFilled = False |
69 arrowFilled = False |
70 |
70 |
71 E5ArrowItem.__init__(self, QPointF(0, 0), QPointF(100, 100), |
71 E5ArrowItem.__init__(self, QPointF(0, 0), QPointF(100, 100), |
72 arrowFilled, arrowType, parent) |
72 arrowFilled, arrowType, parent) |
81 ## self.calculateEndingPoints = self.__calculateEndingPoints_center |
81 ## self.calculateEndingPoints = self.__calculateEndingPoints_center |
82 self.calculateEndingPoints = self.__calculateEndingPoints_rectangle |
82 self.calculateEndingPoints = self.__calculateEndingPoints_rectangle |
83 |
83 |
84 self.itemA = itemA |
84 self.itemA = itemA |
85 self.itemB = itemB |
85 self.itemB = itemB |
86 self.assocType = type |
86 self.assocType = assocType |
87 self.topToBottom = topToBottom |
87 self.topToBottom = topToBottom |
88 |
88 |
89 self.regionA = NoRegion |
89 self.regionA = NoRegion |
90 self.regionB = NoRegion |
90 self.regionB = NoRegion |
91 |
91 |