Bug 147810 - Component Diagram, moving component results in an absurd shape of a self-association
Summary: Component Diagram, moving component results in an absurd shape of a self-asso...
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Debian stable Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-12 14:36 UTC by Anton Pussep
Modified: 2007-07-15 11:39 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
component diagram in which the error occurres (26.88 KB, application/octet-stream)
2007-07-12 14:37 UTC, Anton Pussep
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Pussep 2007-07-12 14:36:10 UTC
Version:           1.5.71 (using KDE KDE 3.5.5)
Installed from:    Debian stable Packages
OS:                Linux

In my component diagram (see attached file pc_architecture_v0.3.xmi) there is a component "PC Provider" that is associated to itself. When I try to move this component then the shape of the self-association changes such that the middle of the arrow is somewhere in the far, far left corner.

It would be also great if the self-association line would not start in the arrow that comes from the component "Actions"...

And thanks for this great application, it's really nice working with it!
Comment 1 Anton Pussep 2007-07-12 14:37:09 UTC
Created attachment 21125 [details]
component diagram in which the error occurres

illustrates the error
Comment 2 Oliver Kellogg 2007-07-12 19:08:42 UTC
Confirm.
While moving the "PC Provider" component, there are error messages on the console,
umbrello: updateAssociations: error from findInterceptOnEdge for assocType=502 ownWidget=Business Logic otherWidget=PC Provider
Comment 3 Oliver Kellogg 2007-07-14 04:51:57 UTC
SVN commit 687614 by okellogg:

mouseMoveEvent(): UMLWidget::adjustUnselectedAssocs() expects absolute coordinate.
getPosition(): New method, factored from getPositionDifference(), returns the
 absolute coordinate.
getPositionDifference(): Use getPosition().
CCBUG:147810


 M  +18 -18    umlwidgetcontroller.cpp  
 M  +12 -1     umlwidgetcontroller.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #687613:687614
@@ -134,9 +134,9 @@
         setSelectionBounds();
     }
 
-    QPoint positionDifference = getPositionDifference(me);
-    int diffX = positionDifference.x();
-    int diffY = positionDifference.y();
+    QPoint position = getPosition(me);
+    int diffX = position.x() - m_widget->getX();
+    int diffY = position.y() - m_widget->getY();
 
     if ((me->state() & Qt::ShiftButton) && (me->state() & Qt::ControlButton)) {
         //Move in Y axis
@@ -166,10 +166,7 @@
         update = true;
         lastUpdate.restart();
 
-        // CHECK: UMLWidget::adjustUnselectedAssocs(x,y) appears to take absolute
-        //      values for x and y. Surprisingly, supplying diffX and diffY seems
-        //      to work all the same ?!?
-        m_widget->adjustUnselectedAssocs(diffX, diffY);
+        m_widget->adjustUnselectedAssocs(position.x(), position.y());
     }
 
     while ((widget = it.current()) != 0) {
@@ -481,12 +478,12 @@
     return biggestY;
 }
 
-QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+QPoint UMLWidgetController::getPosition(QMouseEvent* me) {
     /*
-    kDebug() << "UMLWidgetController::getPositionDifference: me->x=" << me->x()
+    kDebug() << "UMLWidgetController::getPosition: me->x=" << me->x()
         << " m_widget->getX=" << m_widget->getX() << ", m_oldX=" << m_oldX
         << ", m_pressOffsetX=" << m_pressOffsetX << endl;
-    kDebug() << "UMLWidgetController::getPositionDifference: me->y=" << me->y()
+    kDebug() << "UMLWidgetController::getPosition: me->y=" << me->y()
         << " m_widget->getY=" << m_widget->getY() << ", m_oldY=" << m_oldY
         << ", m_pressOffsetY=" << m_pressOffsetY << endl;
      */
@@ -499,28 +496,31 @@
     m_oldY = newY;
 
     if (newX + (m_minSelectedX - m_widget->getX()) < 0) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.1" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.1" << endl;
         newX = m_widget->getX() - m_minSelectedX;
     }
     if (newY + (m_minSelectedY - m_widget->getY()) < 0) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.2" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.2" << endl;
         newY = m_widget->getY() - m_minSelectedY;
     }
     if (newX + (m_maxSelectedX - m_widget->getX()) > maxX) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.3" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.3" << endl;
         newX = maxX - (m_maxSelectedX - m_widget->getX());
     }
     if (newY + (m_maxSelectedY - m_widget->getY()) > maxY) {
-        //kDebug() << "UMLWidgetController::getPositionDifference: got into cond.4" << endl;
+        //kDebug() << "UMLWidgetController::getPosition: got into cond.4" << endl;
         newY = maxY - (m_maxSelectedY - m_widget->getY());
     }
-
-    newX -= m_widget->getX();
-    newY -= m_widget->getY();
-
     return QPoint(newX, newY);
 }
 
+QPoint UMLWidgetController::getPositionDifference(QMouseEvent* me) {
+    QPoint newPoint = getPosition(me);
+    const int diffX = newPoint.x() - m_widget->getX();
+    const int diffY = newPoint.y() - m_widget->getY();
+    return QPoint(diffX, diffY);
+}
+
 void UMLWidgetController::showPopupMenu(QMouseEvent *me) {
     //TODO why this condition?
     if (m_widget->m_pMenu) {
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.h #687613:687614
@@ -362,10 +362,21 @@
     int getBiggestY(const UMLWidgetList &widgetList);
 
     /**
+     * Returns the adjusted position for the given mouse event.
+     * The adjusted position is computed using the current widget position
+     * m_widget->get{X,Y}(), the previous position m_old{X,Y}, and the
+     * mouse press offset m_pressOffset{X,Y}.
+     *
+     * @param me The QMouseEvent for which to get the adjusted position.
+     * @return A QPoint with the adjusted position.
+     */
+    QPoint getPosition(QMouseEvent *me);
+
+    /**
      * Returns a QPoint with the new X and Y position difference of the mouse event
      * respect to the position of the widget.
      *
-     * @param me The QMouseEVent to get the position to compare.
+     * @param me The QMouseEvent to get the position to compare.
      * @return A QPoint with the position difference.
      */
     QPoint getPositionDifference(QMouseEvent *me);
Comment 4 Oliver Kellogg 2007-07-15 11:39:08 UTC
SVN commit 688175 by okellogg:

mouseMoveEvent(): Use raw pos of m_widget at call to UMLWidget::adjustUnselectedAssocs()
BUG:147810


 M  +1 -0      ChangeLog  
 M  +1 -1      umbrello/umlwidgetcontroller.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #688174:688175
@@ -7,6 +7,7 @@
 * End Activity Symbol gets invalid when line thickness is increased (146925)
 * The size of a fork/join is not restored (147069)
 * Crash when changing the association type to containment (147202)
+* Moving component on diagram results in absurd shape of self-association (147810)
 
 Version 1.5.71
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidgetcontroller.cpp #688174:688175
@@ -166,7 +166,7 @@
         update = true;
         lastUpdate.restart();
 
-        m_widget->adjustUnselectedAssocs(position.x(), position.y());
+        m_widget->adjustUnselectedAssocs(m_widget->getX(), m_widget->getY());
     }
 
     while ((widget = it.current()) != 0) {