Bug 67223 - Fixed connection points for associations on widgets
Summary: Fixed connection points for associations on widgets
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.1.1
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 67226 83433 105845 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-04 20:11 UTC by Eugine V. Kosenko
Modified: 2006-03-26 22:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugine V. Kosenko 2003-11-04 20:11:48 UTC
Version:           1.1.1 (using KDE KDE 3.1.2)
Installed from:    Unspecified Linux
OS:          Linux

Now umbrello uses an intelligent behavior of associations during a rearrangement of widgets. However, this behavior may be sometimes strange, annoyed or even ugly. For example, let I try to compact diagram and make associations as short as possible. However, when an association becomes too short, the tool may unexpectedy rearrange its connection point, for example, reconnect from a bottom point of decision square (on activity diagrams) to a side point.

I think, may not be any more annoyment than a system, which makes decisions behind my back. IMHO, there is much more useful to make a set of connection points on a widgets, where I can connect an association. In more difficult way, there may be a mechanism of the definition of connection points, as, for example, this made in Visio. It is also possible to keep the intelligent behavior, when the user obviously starts the drag of an association from the middle of a widget instead of a selected connection point. This behavior is also well implemented in Visio.
Comment 1 Jonathan Riddell 2003-11-04 20:20:43 UTC
*** Bug 67226 has been marked as a duplicate of this bug. ***
Comment 2 Sebastian Stein 2003-12-02 10:09:47 UTC
I think this really is a wish and not just a bug.
Comment 3 Oliver Kellogg 2003-12-26 19:58:02 UTC
I confirm. In particular, when the lines of a self association
were manually rearranged (for example, moved to the left or right
or bottom side to avoid a clash with a generalization arrow) and
then one of the role labels is moved, the lines jerk around to
unpredictable positions.
Comment 4 Oliver Kellogg 2004-07-02 18:36:15 UTC
*** Bug 83433 has been marked as a duplicate of this bug. ***
Comment 5 Mathieu Jobin 2004-08-27 22:42:18 UTC
I was about to submit a new wish report but....
I suggest making connection point, just like in kivio, so arrow match with correct connection point, and they can manually be changed.

instead of this buggy auto thing.

Comment 6 Jonathan Riddell 2004-08-28 21:49:13 UTC
Fixed assocaition points are a bad idea because you will run out of association points.  Having an algorithm that will use horizontal or vertical lines in all cases makes more sense.
Comment 7 Mathieu Jobin 2004-08-29 01:15:49 UTC
maybe you right, the algo makes more sense, but you won't run out of association points, since you can have multiple association on a single point.

just like in kivio
Comment 8 Brad Markel 2005-04-24 17:32:32 UTC
Perhaps include the ability to drag the connection points around the entity, at least in the class diagram.  The two "control boxes" at the end of the associations suggest that this can be done already, which is confusing.
Comment 9 ahiroito 2005-10-21 18:01:49 UTC
my vote is for the algo too. it could have multiple association on a single point, but that looks horrendous (one of the things i dislike about visio and kivio are the fixed connection points). and we shall not be wasting time rearranging connection points.
Comment 10 Oliver Kellogg 2006-02-24 08:24:56 UTC
SVN commit 513000 by okellogg:

http://www.geeksoc.org/~jr/umbrello/uml-devel/att-9250/straightlines.tar.bz2
applied from http://www.geeksoc.org/~jr/umbrello/uml-devel/9248.html
Many thanks to Marius Helf <marius.helf_at_gmx.de> for this feature.
BUG:67223


 M  +1 -0      ChangeLog  
 M  +1 -0      THANKS  
 M  +58 -11    umbrello/associationwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #512999:513000
@@ -5,6 +5,7 @@
 * fixed problem with font size computation/word wrap in note widgets
   http://sourceforge.net/mailarchive/forum.php?thread_id=9558795&forum_id=472
 * Bugs/wishes from http://bugs.kde.org:
+* Fixed connection points for associations on widgets (67223)
 * Import Rose model files (81364)
 * Documentation for association roles not saved (105661)
 * Default data types not added for old Java generator (115991)
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #512999:513000
@@ -32,6 +32,7 @@
 Gregorio Guidi <g.guidi @sns.it>
 Esben Mose Hansen <esben @despammed.com>
 Olaf Hartig <OleBowle @gmx.de>
+Marius Helf <marius.helf @gmx.de>
 Michel Hermier <michel.hermier @wanadoo.fr>
 Paul Hensgen <phensgen @bigpond.net.au>
 David Hugh-Jones <hughjonesd @yahoo.co.uk>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #512999:513000
@@ -2204,6 +2204,20 @@
         setSelected( false );
         return;
     }
+
+    // Check whether a point was moved and whether the moved point is
+    // located on the straight line between its neighbours.
+    // if yes, remove it
+    ///@todo: check for non-horizontal / -vertical lines
+    if (m_nMovingPoint > 0 && m_nMovingPoint < m_LinePath.count() - 1)
+    {
+        QPoint m = m_LinePath.getPoint(m_nMovingPoint);
+        QPoint b = m_LinePath.getPoint(m_nMovingPoint - 1);
+        QPoint a = m_LinePath.getPoint(m_nMovingPoint + 1);
+        if ( (b.x() == m.x() && a.x() == m.x()) ||
+             (b.y() == m.y() && a.y() == m.y()) )
+            m_LinePath.removePoint(m_nMovingPoint, m, POINT_DELTA);
+    }
     m_nMovingPoint = -1;
     const QPoint p = me->pos();
     if (me->button() == Qt::LeftButton) {
@@ -2502,11 +2516,24 @@
 }
 
 void AssociationWidget::mouseMoveEvent(QMouseEvent* me) {
-    //make sure we have a moving point
-    //I don't think there is another reason for being here
-    if( m_nMovingPoint == -1 || me->state() != Qt::LeftButton) {
+    if( me->state() != Qt::LeftButton) {
         return;
     }
+
+    // if we have no moving point,create one
+    if (m_nMovingPoint == -1)
+    {
+        //create moving point near the mouse on the line
+        int i = m_LinePath.onLinePath(me->pos());
+
+        if (i > -1)
+        {
+            m_LinePath.insertPoint( i + 1, me->pos() );
+            m_nMovingPoint = i + 1;
+        } else
+            return;
+    }
+    
     setSelected();
     //new position for point
     QPoint p = me->pos();
@@ -2845,6 +2872,7 @@
 void AssociationWidget::updateRegionLineCount(int index, int totalCount,
         AssociationWidget::Region region,
         Role_Type role) {
+            ///@todo remove parameter totalCount (no longer needed)
     if( region == Error )
         return;
     // If the association is to self and the line ends are on the same region then
@@ -2900,16 +2928,35 @@
     robj.m_OldCorner.setY(y);
     int ww = pWidget->getWidth();
     int wh = pWidget->getHeight();
-    int ch = wh * index / totalCount;
-    int cw = ww * index / totalCount;
+//    int ch = wh * index / totalCount;
+//    int cw = ww * index / totalCount;
+    uint nind = role == A ? 1: m_LinePath.count() - 2;
+    QPoint neighbour = m_LinePath.getPoint(nind);
+    int ch = 0;
+    int cw = 0;
+    if (neighbour.x() < x)
+        cw = 0;
+    else if (neighbour.x() > x + ww)
+        cw = 0 + ww;
+    else
+        cw = neighbour.x() - x;
+
+    if (neighbour.y() < y)
+        ch = 0;
+    else if (neighbour.y() > y + wh)
+        ch = 0 + wh;
+    else
+        ch = neighbour.y() - y;
+
     int snapX = m_pView->snappedX(x + cw);
     int snapY = m_pView->snappedY(y + ch);
 
-    QPoint pt;
+    QPoint pt(snapX, snapY);
 
-    switch(region) {
-    case West:
-        pt.setX(x);
+/*    switch(region) {
+    default:
+//     case West:
+        pt.setX(snapX);
         pt.setY(snapY);
         break;
     case North:
@@ -2928,9 +2975,9 @@
         pt.setX(x + ww / 2);
         pt.setY(y + wh / 2);
         break;
-    default:
+//     default:
         break;
-    }
+    }*/
     if (role == A)
         m_LinePath.setPoint( 0, pt );
     else {
Comment 11 Oliver Kellogg 2006-03-22 07:37:34 UTC
*** Bug 105845 has been marked as a duplicate of this bug. ***
Comment 12 Oliver Kellogg 2006-03-26 22:04:49 UTC
SVN commit 522834 by okellogg:

Make the new angular-line drawing feature switchable in the Umbrello
general settings. (Switched off by default for backward compatibility.)
CCBUG:67223


 M  +51 -46    associationwidget.cpp  
 M  +7 -5      dialogs/settingsdlg.cpp  
 M  +3 -5      dialogs/settingsdlg.h  
 M  +1 -0      optionstate.h  
 M  +4 -5      uml.cpp