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

Bug 221214

Summary: Graph Layout should not modiy heights of nodes
Product: [Tools] GEF Reporter: Alex Boyko <aboyko>
Component: GEF-Legacy Draw2dAssignee: gef-inbox <gef-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: ahunter.eclipse, hudsonr
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch (draft)
none
cprrected patch
none
patch aboyko: review?

Description Alex Boyko CLA 2008-03-03 15:08:27 EST
DirectedGraphLayout and CompoundDirectedGraphLayout both modify heights of nodes located in the same rank.
The sizes of nodes shouldn't be modified or at least this should be presented as an option.
If nodes have different heights within the same row, edges need to be routed such that they don't intersect with neighbors of the source node and don't overlap with each other.
Patch to be uploaded.
Comment 1 Alex Boyko CLA 2008-03-03 15:39:51 EST
Created attachment 91437 [details]
Proposed patch (draft)

This is the patch, where layout algorithm doesn't modify nodes height.

Description of changes:
I'm passing hi-metric coordinates and dimensions of nodes and edges to the layout.  1 pixel = 26 himetric units. The diagrams are huge, so the numbers layout algorithm operates with are large. A couple of overflows happened. Overflows are fixed in:
Geometry
Point

The 10000 constant didn't seem enough in RouteEdges, so graph width is used for DirectedGraph, CompoundDirectedGraph has a 0 width and still uses 10000 constant. Also added support for routing edges orthogonally (i.e. edge consists of horizontal and vertical line segments only)
Modified:
RouteEdges

Introduced SpaceOutEdges visitor to layout edges coming out from a short node (i.e. node's height < rank's height)

The rest of the changes are made to support nodes with unmodified height and SpaceOutEdges visitor.

Examples:
DirectedGraph: fourLevelOrthogonalBinaryTree, variousHeightNodesGraph_Test
CompoundDirectedGraph: flowChartOrthogonalEdges, variousHeightNodesGraph

Randy, could you please take a look at this and provide feedback?
Thanks in advance.
Comment 2 Alex Boyko CLA 2008-03-04 11:24:44 EST
Created attachment 91531 [details]
cprrected patch

Corrected the patch
Comment 3 Alex Boyko CLA 2008-03-04 11:55:30 EST
Created attachment 91537 [details]
patch

Previous patch had RelativeBendpoint fix included in it. This is the patch for this issue only
Comment 4 Randy Hudson CLA 2008-03-18 10:21:05 EDT
The existing behavior should be preserved for existing code that uses it. Doesn't the patch change the behavior by default for everyone?
Comment 5 Alex Boyko CLA 2008-03-18 13:46:00 EDT
It does change the behavior for everyone. Nodes sizes won't be affected only the the x and y. I think I'll mark this as invalid since even if i make an option for not changing nodes sizes in Draw2D and route edges appropriately I will still have to route edges in GMF because I'm trying to assign distinct end points for edges as well as introduce BorderNode (there are border items in GMF) on the GMF side. I'd put that in GMF for now and move it to Draw2D if it works out fine
Comment 6 Alex Boyko CLA 2008-03-18 14:27:42 EDT
BTW, I'll think about putting all my layout inhacements for GMF in Draw2D. It's just that I don't really know what's the best way to do that yet.
Comment 7 Alex Boyko CLA 2008-03-27 16:44:26 EDT
Marked as invalid. This is to be done in GMF for now and will be put in Draw2D at a later time