Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 437528

Summary: Forcing an edge direction toward the center of a node.
Product: [Modeling] Sirius Reporter: Florian Barbin <florian.barbin>
Component: DiagramAssignee: Florian Barbin <florian.barbin>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: laurent.redor
Version: 1.0.0Keywords: triaged
Target Milestone: 2.0.0   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=444734
https://bugs.eclipse.org/bugs/show_bug.cgi?id=448739
Whiteboard:
Attachments:
Description Flags
Test case container in container
none
Test copy paste issue with rectilinear edges
none
Test repair on edge centering
none
tabbarTest.zip none

Description Florian Barbin CLA 2014-06-16 08:55:53 EDT
The edge source and edge target are not systematically oriented toward the center of the node, depending on where the edge has been created or moved by the end user. Taking the example of a "port" concept that is represented by a 10px by 10px bordered node. For esthetic reasons the specifier could force the edges ends to be centered on those bordered nodes.
Comment 1 Florian Barbin CLA 2014-06-16 10:05:55 EDT
We take about "Border Node" and not "Bordered Node". There is a confusion in my previous comment.
Comment 3 Florian Barbin CLA 2014-08-06 04:08:54 EDT
New patch set: https://git.eclipse.org/r/#/c/31082/
Comment 4 Florian Barbin CLA 2014-08-07 10:40:07 EDT
All the gerrit reviews are available here: https://git.eclipse.org/r/#/q/status:open+project:sirius/org.eclipse.sirius+branch:bug/437528_centered_edges,n,z

In addition of automatic tests, some manual tests should be performed during the validation:

* Move a rectilinear edge segment on a centered source and target => The edge segment should stay centered.

* Move a rectilinear edge segment on a free source and target.

* Create a straight edge (centered on its source and target) with multiple bendpoints. Convert it to rectilinear => The last edge segments should be centered.
Comment 5 Florian Barbin CLA 2014-08-29 03:19:34 EDT
Merged on master. See http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/log/?qt=grep&q=437528
Comment 6 Florian Barbin CLA 2014-09-05 03:58:30 EDT
We identified an issue with the "Snape to Grid". If it activated, the edge follows the grid in priority and not the node center.
Comment 7 Florian Barbin CLA 2014-09-08 10:43:36 EDT
https://git.eclipse.org/r/#/c/32932/ fix this issue
Comment 8 Florian Barbin CLA 2014-09-10 10:22:58 EDT
Fixed with http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3e7acc0a5429c7377c7f58d86d55954955b469ef.

An additional test has to be performed manually since we were not able to drag and drop a rectilinear edge segement with SWTBot:

* Create a new project in your workspace and import inside the files from /org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/
* Open the "moving" representation
* Display the diagram Grid and set the Grid Spacing to 30px
* Move the "node2" top-left corner toward the first Grid intersection (toward the north-west direction)
* Change the "edge6" routing style to "Rectilinear"
* Move the last edge segment on the "node2" top-left corner (the edge segment should be Snap by the grid)
* When dropping the edge, it should retrieve its original location toward the "node2" center.
Comment 9 Florian Barbin CLA 2014-09-19 04:21:29 EDT
Created attachment 247225 [details]
Test case container in container

* Import the test case and open the unique diagram
* Zoom on the diagram in a kind that you can scroll it toward the bottom-right.
* Move an edge segment on the edge between "eClass2" and "eClass4"
* The other bendpoints move too.
That was due to a wrong source and target absolute bounds computation with scrollbar and with at least one  hierarchical level of containement.
Comment 10 Florian Barbin CLA 2014-09-19 04:21:50 EDT
https://git.eclipse.org/r/#/c/33561/4 fix the last issue
Comment 11 Laurent Redor CLA 2014-09-19 10:21:27 EDT
The fix corresponding to review of comment 10 has been pushed on master: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=15ce2d42b50bc970ecd920dc23c4ba1cb5668763
Comment 12 Laurent Redor CLA 2014-09-24 04:10:59 EDT
There is still a not covered scenario.

Steps to reproduce:
* Import the project of https://bugs.eclipse.org/bugs/attachment.cgi?id=247232
* Open the diagram diagWithEdgeWithBendpoints
* Select the green edge (between InterfaceA and InterfaceB)
* Change its Centered properties to Both (via the Properties view in Style tab)
* Resize the InterfaceB from north side
KO: The edge does not move and  does not pointed to center anymore.


Probably a check of centered propery to add in org.eclipse.sirius.diagram.ui.internal.operation.ShiftEdgeIdentityAnchorOperation.handleTargetEdges(View, EditPart) and in org.eclipse.sirius.diagram.ui.internal.operation.ShiftEdgeIdentityAnchorOperation.handleSourceEdges(View, EditPart)
Comment 13 Laurent Redor CLA 2014-09-25 04:47:20 EDT
The bug detected in comment 12 is here since the bug 441424.
A proposition of fix is available here: https://git.eclipse.org/r/33865
Comment 15 Laurent Redor CLA 2014-10-14 07:44:21 EDT
During validation of bug 444734. I noticed that there is a similar problem with the action ArrangeAll.

Steps to reproduce:
* Import the project of bug 444734
* Open the diagram "new testReconnect"
* Select All
* Unpin selected elements (all)
* Launch Arrange all
* The edge between eClass2 and eClass4 is no longer centered on eClass4 side (target side).
Comment 16 Florian Barbin CLA 2014-10-17 03:58:06 EDT
Created attachment 247959 [details]
Test copy paste issue with rectilinear edges

A new issue during the copy paste has been detected.

Steps to reproduce:

* Import testCopyPasteEdge.zip test case.
* Open the "copyPaste" representation.
* Perform a copy paste layout on the same diagram.
* The two rectilinear edges become straight => KO
* The edge layout should be the same after the paste.
Comment 17 Florian Barbin CLA 2014-10-17 04:55:03 EDT
Created attachment 247962 [details]
Test repair on edge centering

If the edge centering property has been changed in the VSM, the repair refresh the centering property on the edgeStyle but the Edge bendpoints are still the same.

Step to reproduce:

* import the testRepairEdge.zip use case
* DO NOT open the representation
* Launch a repair on the aird file.
* Open the representation:
** There are two edges which should be centered but its not the case: only the edge style centering value has been changed. => KO
Comment 19 Laurent Redor CLA 2014-10-21 08:30:54 EDT
Another KO scenario:
* Import the project of bug 444734
* Open the diagram "new testReconnect"
* Resize the border node eClass4 to the left
* The edge is no longer centered
Comment 21 Laurent Redor CLA 2014-10-22 06:02:25 EDT
Created attachment 248082 [details]
tabbarTest.zip

Another KO scenario with these steps:
* Import project "TabbarTest" from tabbarTest.zip
* Open the session
* Open the diagram "aaaa package entities"
* Select the connection "ref0"
* In the properties view, in tab Style, change the Centered property to Both
KO: The edge is not centered.

* After this, move the last segment to have the edge that arrives to the top of the target node (the edge is now centered).
* Resize the target node
KO: The edge is no longer centered.
Comment 23 Florian Barbin CLA 2014-10-22 07:20:47 EDT
See https://git.eclipse.org/r/#/c/35324/ to fix Comment 21
Comment 24 Laurent Redor CLA 2014-10-22 08:00:59 EDT
The gerrit https://git.eclipse.org/r/#/c/35324/ fixes only the first part (first KO) of the Comment 21.
Comment 25 Florian Barbin CLA 2014-10-23 10:45:31 EDT
We still have known issues about this feature:

In the case of auto-size containers, we compute a wrong size in pure GMF coordinate system. That happens with long labels for instance since we do not compute the real label size according to the font name, the font-size, etc.

According to these limitations, we have two identified cases where the edge centering could be wrong:

* When performing an arrange-all (or selection)
* When re-sizing one of the edge ends shape.

These issues will be fixed as part of new bugzilla.
Comment 26 Laurent Redor CLA 2014-10-24 09:17:16 EDT
Verified with Sirius 2.0.0-S20141024-041312
Comment 27 Florian Barbin CLA 2014-10-24 11:14:11 EDT
See bug 448739
Comment 28 Pierre-Charles David CLA 2014-10-27 06:52:03 EDT
Available in Sirius 2.0.0.