93
91
virtual UMLClassifier* seqNumAndOp(QString& seqNum, QString& op);
94
92
virtual void setSeqNumAndOp(const QString &seqNum, const QString &op);
94
virtual void constrainTextPos(UMLSceneValue &textX, UMLSceneValue &textY,
95
UMLSceneValue textWidth, UMLSceneValue textHeight,
96
98
virtual void calculateNameTextSegment();
98
100
//---------- End LinkWidget Interface methods implemementation.
100
UMLAssociation * getAssociation() const;
101
UMLAttribute * getAttribute() const;
102
UMLAssociation* association() const;
103
UMLAttribute* attribute() const;
103
105
//AssociationWidget& operator=(const AssociationWidget & Other);
104
106
bool operator==(const AssociationWidget & Other) const;
105
107
bool operator!=(AssociationWidget & Other) const;
109
void setWidget(UMLWidget* widget, Uml::Role_Type role);
111
FloatingTextWidget* getMultiWidget(Uml::Role_Type role);
112
FloatingTextWidget* getNameWidget();
113
FloatingTextWidget* getRoleWidget(Uml::Role_Type role);
114
FloatingTextWidget* getTextWidgetByRole(Uml::TextRole tr);
116
QString getName() const;
109
FloatingTextWidget* textWidgetByRole(Uml::TextRole tr) const;
111
FloatingTextWidget* nameWidget() const;
112
QString name() const;
117
113
void setName(const QString &strRole);
115
FloatingTextWidget* roleWidget(Uml::Role_Type role) const;
119
116
QString roleName(Uml::Role_Type role) const;
120
117
void setRoleName(const QString &strRole, Uml::Role_Type role);
121
119
QString roleDocumentation(Uml::Role_Type role) const;
120
void setRoleDocumentation(const QString& doc, Uml::Role_Type role);
122
FloatingTextWidget* multiplicityWidget(Uml::Role_Type role) const;
123
123
QString multiplicity(Uml::Role_Type role) const;
124
void setMultiplicity(const QString &strMulti, Uml::Role_Type role);
124
void setMultiplicity(const QString& text, Uml::Role_Type role);
126
126
Uml::Visibility visibility(Uml::Role_Type role) const;
127
void setVisibility(Uml::Visibility visibility, Uml::Role_Type role );
127
void setVisibility(Uml::Visibility value, Uml::Role_Type role);
129
FloatingTextWidget* changeabilityWidget(Uml::Role_Type role) const;
129
130
Uml::Changeability changeability(Uml::Role_Type role) const;
130
void setChangeability (Uml::Changeability value, Uml::Role_Type role);
131
void setChangeability(Uml::Changeability value, Uml::Role_Type role);
132
Uml::IDType getWidgetID(Uml::Role_Type role) const;
133
Uml::IDType widgetIDForRole(Uml::Role_Type role) const;
133
134
UMLWidget* widgetForRole(Uml::Role_Type role) const;
135
void setWidgetForRole(UMLWidget* widget, Uml::Role_Type role);
135
137
bool setWidgets(UMLWidget* widgetA, Uml::AssociationType assocType, UMLWidget* widgetB);
139
141
bool contains(UMLWidget* widget);
141
bool isCollaboration();
143
143
Uml::AssociationType associationType() const;
145
144
void setAssociationType(Uml::AssociationType type);
146
bool isCollaboration() const;
148
QString toString() const;
149
150
bool isActivated();
150
151
void setActivated(bool active /*=true*/);
153
bool isSelected() const;
152
154
void setSelected(bool _select = true);
155
* Returns the state of whether the widget is selected.
157
* @return Returns the state of whether the widget is selected.
159
bool getSelected() const {
156
AssociationLine* associationLine() const;
164
* Returns a pointer to the association widget's line path.
166
AssociationLine* getLinePath() {
167
return m_associationLine;
158
virtual bool activate();
159
QRect boundingRect();
170
161
void widgetMoved(UMLWidget* widget, int x, int y);
172
void updatePointsException ();
163
void updatePointsException();
174
165
void saveIdealTextPositions();
176
void mouseDoubleClickEvent(QMouseEvent * me);
177
void mousePressEvent(QMouseEvent * me);
178
void mouseReleaseEvent(QMouseEvent * me);
179
void mouseMoveEvent(QMouseEvent * me);
167
void mouseDoubleClickEvent(QMouseEvent* me);
168
void mousePressEvent(QMouseEvent* me);
169
void mouseReleaseEvent(QMouseEvent* me);
170
void mouseMoveEvent(QMouseEvent* me);
181
bool onAssociation(const QPoint & point);
182
bool onAssocClassLine(const QPoint & point);
172
bool onAssociation(const QPoint& point);
173
bool onAssocClassLine(const QPoint& point);
184
175
void createAssocClassLine();
185
176
void createAssocClassLine(ClassifierWidget* classifierWidget,
188
179
void selectAssocClassLine(bool sel = true);
190
void moveMidPointsBy( int x, int y );
192
void moveEntireAssoc( int x, int y );
194
QRect getAssocLineRectangle();
181
void moveMidPointsBy(int x, int y);
182
void moveEntireAssoc(int x, int y);
196
184
QFont font() const;
198
virtual void setLineColor(const QColor &colour);
186
virtual void setTextColor(const QColor &color);
187
virtual void setLineColor(const QColor &color);
199
188
void setLineWidth(uint width);
201
FloatingTextWidget* getChangeWidget(Uml::Role_Type role);
203
void setRoleDocumentation(const QString &doc, Uml::Role_Type role);
205
void constrainTextPos(int &textX, int &textY, int textWidth, int textHeight,
208
190
void setIndex(int index, Uml::Role_Type role);
209
191
int getIndex(Uml::Role_Type role) const;
211
void setTotalCount(int count, Uml::Role_Type role);
212
int getTotalCount(Uml::Role_Type role) const;
214
void setTotalCount(int count);
216
193
void calculateEndingPoints();
218
195
void removeAssocClassLine();
220
196
void computeAssocClassLine();
224
void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
225
bool loadFromXMI( QDomElement & qElement );
227
bool loadFromXMI( QDomElement & qElement, const UMLWidgetList& widgets,
228
const MessageWidgetList* pMessages = NULL);
200
bool loadFromXMI(QDomElement& qElement, const UMLWidgetList& widgets,
201
const MessageWidgetList* messages);
202
virtual bool loadFromXMI(QDomElement& qElement);
203
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement);
208
void slotMenuSelection(QAction* action);
209
void slotRemovePopupMenu();
210
void slotClearAllSelected();
211
void slotClassifierListItemRemoved(UMLClassifierListItem* obj);
212
void slotAttributeChanged();
219
UMLScenePoint calculateTextPosition(Uml::TextRole role);
220
void setTextPosition(Uml::TextRole role);
221
void setTextPositionRelatively(Uml::TextRole role, const QPoint &oldPosition);
222
void setFloatingText(Uml::TextRole role, const QString& text, FloatingTextWidget* &ft);
235
225
* Constructor is made non accessible:
238
228
AssociationWidget(UMLScene *scene);
240
void setUMLAssociation (UMLAssociation * assoc);
230
void setUMLAssociation(UMLAssociation * assoc);
242
232
void mergeAssociationDataIntoUMLRepresentation();
244
234
static Region findPointRegion(const QRect& Rect, int PosX, int PosY);
246
235
static int findInterceptOnEdge(const QRect &rect, Region region, const QPoint &point);
248
236
static QPoint findIntercept(const QRect &rect, const QPoint &point);
250
238
void moveEvent(QMoveEvent *me);
252
Uml::TextRole CalculateNameType(Uml::TextRole defaultRoleType);
240
Uml::TextRole calculateNameType(Uml::TextRole defaultRoleType);
254
bool isPointInsideBoundaries(int PosX, int PosY, QPoint & SPoint,
255
uint & StartSegmentIndex, uint & EndSegmentIndex);
242
// bool isPointInsideBoundaries(int PosX, int PosY, QPoint & SPoint,
243
// uint & StartSegmentIndex, uint & EndSegmentIndex);
257
245
static QPoint swapXY(const QPoint &p);
247
// float totalLength();
261
249
static QPoint calculatePointAtDistance(const QPoint &P1, const QPoint &P2, float Distance);
263
250
static QPoint calculatePointAtDistanceOnPerpendicular(const QPoint &P1, const QPoint &P2, float Distance);
265
252
static float perpendicularProjection(const QPoint& P1, const QPoint& P2, const QPoint& P3, QPoint& ResultingPoint);
267
254
static QPoint midPoint(const QPoint& p0, const QPoint& p1);
269
QPoint calculateTextPosition(Uml::TextRole role);
271
void setTextPosition(Uml::TextRole role);
273
void setTextPositionRelatively(Uml::TextRole role, const QPoint &oldPosition);
275
Region getWidgetRegion(AssociationWidget * widget) const;
278
* This is a pointer to the Floating Text widget which displays the
279
* name of this association.
281
FloatingTextWidget* m_pName;
256
// Region getWidgetRegion(AssociationWidget * widget) const;
284
259
* The WidgetRole struct gathers all information pertaining to the role.
288
263
struct WidgetRole {
291
* This is a pointer to the Floating Text widget at the role's side
292
* of the association.
293
* This FloatingTextWidget displays the information regarding multiplicity.
295
FloatingTextWidget* m_pMulti;
298
* This is a pointer to the Floating Text widget at the role's side
299
* of the association.
300
* This FloatingTextWidget displays the information regarding changeability.
302
FloatingTextWidget* m_pChangeWidget;
305
* This member holds a pointer to the floating text that displays
306
* the role's label of this association.
308
FloatingTextWidget* m_pRole;
311
* This member holds a pointer to the UMLWidget at this role's side
312
* of the association.
314
UMLWidget* m_pWidget;
317
* This role's old top left corner before moving.
322
* The region of this role's widget.
324
Region m_WidgetRegion;
327
* The index of where the line is on the region for this role.
332
* The total amount of associations on the region this role's line is on.
265
FloatingTextWidget* multiplicityWidget; ///< information regarding multiplicity
266
FloatingTextWidget* changeabilityWidget; ///< information regarding changeability
267
FloatingTextWidget* roleWidget; ///< role's label of this association
269
UMLWidget* umlWidget; ///< UMLWidget at this role's side of this association
271
QPoint m_OldCorner; ///< old top left corner before moving
272
Region m_WidgetRegion; ///< region of this role's widget
274
int m_nIndex; ///< the index of where the line is on the region for this role
275
int m_nTotalCount; ///< total amount of associations on the region this role's line is on
336
277
// The following items are only used if m_pObject is not set.
337
Uml::Visibility m_Visibility;
338
Uml::Changeability m_Changeability;
343
void setFloatingText(Uml::TextRole tr, const QString &text, FloatingTextWidget* &ft);
278
Uml::Visibility visibility;
279
Uml::Changeability changeability;
280
QString roleDocumentation;
345
284
void updateRegionLineCount(int index, int totalCount,
346
285
AssociationWidget::Region region, Uml::Role_Type role);
379
312
* m_associationLine[m_unNameLineSegment] -- m_associationLine[m_unNameLineSegment+1]
381
314
uint m_unNameLineSegment;
382
UMLDoc * m_umldoc; ///< just a shorthand for UMLApp::app()->getDocument()
315
UMLDoc *m_umldoc; ///< just a shorthand for UMLApp::app()->getDocument()
383
316
ListPopupMenu *m_pMenu;
385
318
int m_nMovingPoint;
388
* Position of Name floatingtext saved by saveIdealTextPositions()
390
QPoint m_oldNamePoint;
392
* Position of role A multiplicity floatingtext saved by
393
* saveIdealTextPositions()
395
QPoint m_oldMultiAPoint;
397
* Position of role B multiplicity floatingtext saved by
398
* saveIdealTextPositions()
400
QPoint m_oldMultiBPoint;
402
* Position of role A changeability floatingtext saved by
403
* saveIdealTextPositions()
405
QPoint m_oldChangeAPoint;
407
* Position of role B changeability floatingtext saved by
408
* saveIdealTextPositions()
410
QPoint m_oldChangeBPoint;
412
* Position of role A name floatingtext saved by
413
* saveIdealTextPositions()
415
QPoint m_oldRoleAPoint;
417
* Position of role B name floatingtext saved by
418
* saveIdealTextPositions()
420
QPoint m_oldRoleBPoint;
320
QPoint m_oldNamePoint; ///< Position of name floatingtext saved by saveIdealTextPositions()
321
QPoint m_oldMultiAPoint; ///< Position of role A multiplicity floatingtext saved by saveIdealTextPositions()
322
QPoint m_oldMultiBPoint; ///< Position of role B multiplicity floatingtext saved by saveIdealTextPositions()
323
QPoint m_oldChangeAPoint; ///< Position of role A changeability floatingtext saved by saveIdealTextPositions()
324
QPoint m_oldChangeBPoint; ///< Position of role B changeability floatingtext saved by saveIdealTextPositions()
325
QPoint m_oldRoleAPoint; ///< Position of role A name floatingtext saved by saveIdealTextPositions()
326
QPoint m_oldRoleBPoint; ///< Position of role B name floatingtext saved by saveIdealTextPositions()
422
328
int m_nLinePathSegmentIndex; ///< anchor for m_pAssocClassLine
423
329
UMLSceneLineItem *m_pAssocClassLine; ///< used for connecting assoc. class
424
330
/// selection adornment for the endpoints of the assoc. class connecting line
425
UMLSceneRectItem *m_pAssocClassLineSel0, *m_pAssocClassLineSel1;
427
ClassifierWidget *m_pAssocClassWidget; ///< used if we have an assoc. class
430
* The definition points for the association line.
432
AssociationLine *m_associationLine;
434
// The following items are only used if m_pObject is not set.
435
Uml::AssociationType m_AssocType;
438
void slotMenuSelection(QAction* action);
439
void slotRemovePopupMenu();
440
void slotClearAllSelected();
441
void slotClassifierListItemRemoved(UMLClassifierListItem* obj);
442
void slotAttributeChanged();
331
UMLSceneRectItem *m_pAssocClassLineSel0;
332
UMLSceneRectItem *m_pAssocClassLineSel1;
334
AssociationLine *m_associationLine; ///< the definition points for the association line
335
ClassifierWidget *m_associationClass; ///< used if we have an assoc. class
336
Uml::AssociationType m_associationType; ///< is only used if m_pObject is not set
337
WidgetRole m_role[2];
338
FloatingTextWidget* m_nameWidget; ///< displays the name of this association