Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Automatic graph layout
Automatic graph layout [message #10280] Tue, 18 June 2002 15:24 Go to next message
Eclipse UserFriend
Originally posted by: francois.maurit.improve.fr

Hi,

I'm quite a beginner as far as heavy client interface is concerned.
I would like to know what is the best (simplest) way to achieve
automatic graph layout using Draw2D.

I currently have a set of boxes (RectangleFigure) linked as described in
the "Connections and Anchors" demo of the Draw2D help. I would like them
to get automatically arranged to ease readibility (not a perfect result
- minimize arrows length and crossings to a limited extent - but
something performed reasonnably fast since the boxes and arrows are
likely to change quite often).

I suppose the proper solution would make use of some kind of
LayoutManager and constraint objects.

Do some more advanced examples than those provided in the help exist ?
I quite wonder about the way constraint object are supposed to work (it
seems most provided implementations of these objects implement the
Locator interface, what rules should other constraint object respect ?)

Of course I would greatly appreciate a full example that answers my
question, but I any good starting point (web sites, existing swing
examples)will be welcome.

Thanks

Francois
Re: Automatic graph layout [message #10314 is a reply to message #10280] Tue, 18 June 2002 16:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

This is not supported yet. Would you want the user to be able to move the
items in the graph? Or have them always automatically routed?

"Fran
Re: Automatic graph layout [message #10410 is a reply to message #10314] Wed, 19 June 2002 07:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: francois.maurit.improve.fr

Well, I don't need user interaction with the items.
The resulting graph should be quite static after the layout has been
computed.

Randy Hudson wrote:
> This is not supported yet. Would you want the user to be able to move the
> items in the graph? Or have them always automatically routed?
Re: Automatic graph layout [message #10477 is a reply to message #10410] Wed, 19 June 2002 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

This is a multi-part message in MIME format.

------=_NextPart_000_0010_01C2177D.58395B60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

In that case, provided that you have "single-inheritance", meaning no =
node has more than one parent node, you could simulate such a layout =
with containers.
Each node would contain the children in it. You could give each node a =
"title bar", where you would just display a label centered, and a =
"content pane". The content pane would just be a flow layout from =
left-to-right, with top-aligment for the minor axis. Each =
child-subgraph would be treated as a single "block", reserving whatever =
space it needs for its children. You could augment the hit-testing of =
the figure, or change the registerVisuals method so that EditPart is =
*only* associated with the label for the node. The container would then =
be invisible to the user.

+------------------------------------------------+
| Root |
+------------------------------------------------+
| +---------------+ +--------------------------+ |
| | child | | child | |
| +---------------+ +--------------------------+ |
| | +---------+ +---------+ | |
| | |sub-child| |sub-child| | |
| | +---------+ +---------+ | |
| +--------------------------+ |
+------------------------------------------------+


The user would not see the boxes because they would just be transparent =
figures. Another bonus is that each "container" will cache its =
sub-graphs preferred-size, which should give you really fast =
performance.

You would still need to place Connection figures on the connection =
layer. However, if the user does not interact with the connections, =
just use figures for them, not edit parts.

"Fran=E7ois Maurit" <francois.maurit@improve.fr> wrote in message =
news:3D103905.2020200@improve.fr...
> Well, I don't need user interaction with the items.
> The resulting graph should be quite static after the layout has been=20
> computed.
>=20
> Randy Hudson wrote:
> > This is not supported yet. Would you want the user to be able to =
move the
> > items in the graph? Or have them always automatically routed?
>=20
>=20

------=_NextPart_000_0010_01C2177D.58395B60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>In that case, provided that you have=20
"single-inheritance", meaning no node has more than one parent node, you =
could=20
simulate such a layout with containers.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Each node would contain the children in =
it.&nbsp;=20
You could give each node a "title bar", where you would just display a =
label=20
centered, and a "content pane".&nbsp; The content pane would just be a =
flow=20
layout from left-to-right, with top-aligment for the minor axis.&nbsp; =
Each=20
child-subgraph would be treated as a single "block", reserving whatever =
space it=20
needs for its children.&nbsp; You could augment the hit-testing of the =
figure,=20
or change the registerVisuals method so that EditPart is *only* =
associated with=20
the label for the node.&nbsp; The container would then be invisible to =
the=20
user.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3Dcourier=20
size=3D2>+------------------------------------------------+ </FONT></DIV>
<DIV><FONT face=3Dcourier=20
size=3D2> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;=20
Root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n b=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
|</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2>+------------------------------------------------+ </FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>|=20
+---------------+&nbsp;+--------------------------+ |</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>| |&nbsp;&nbsp;&nbsp;=20
child&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |=20
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;=20
child&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp; | =
|</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2>| +---------------+ =
+--------------------------+=20
|</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;=20
|&nbsp; +---------+ +---------+ | |</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;|&nbsp;=20
|sub-child| |sub-child| | |</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;|&nbsp;=20
+---------+ +---------+ | |</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2> |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;=20
+--------------------------+ |</FONT></DIV>
<DIV><FONT face=3DCourier=20
size=3D2>+------------------------------------------------+ </FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>The user would not see the boxes =
because they=20
would just be transparent figures.&nbsp; Another bonus is that each =
"container"=20
will cache its sub-graphs preferred-size, which should give you really =
fast=20
performance.</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>You would still need to place =
Connection figures=20
on the connection layer.&nbsp; However, if the user does not interact =
with the=20
connections, just use figures for them, not edit parts.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Fran=E7ois Maurit" &lt;</FONT><A=20
href=3D"mailto:francois.maurit@improve.fr"><FONT face=3DArial=20
size=3D2>francois.maurit@improve.fr</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote=20
in message </FONT><A href=3D"news:3D103905.2020200@improve.fr"><FONT =
face=3DArial=20
size=3D2>news:3D103905.2020200@improve.fr</FONT></A><FONT face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt; Well, I don't =
need user=20
interaction with the items.<BR>&gt; The resulting graph should be quite =
static=20
after the layout has been <BR>&gt; computed.<BR>&gt; <BR>&gt; Randy =
Hudson=20
wrote:<BR>&gt; &gt; This is not supported yet.&nbsp; Would you want the =
user to=20
be able to move the<BR>&gt; &gt; items in the graph? Or have them always =

automatically routed?<BR>&gt; <BR>&gt; </FONT></BODY></HTML>

------=_NextPart_000_0010_01C2177D.58395B60--
Re: Automatic graph layout [message #12445 is a reply to message #10314] Mon, 08 July 2002 14:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: knut.paranor.ch

Hi,

Is it planned for future versions of draw2d to support such a feature?
Currently I see there is a routing mechanism for connections, but nothing
for a complete graph with nodes.

In other tools such as GVF, OpenJGraph, and JGraph there is support for this
type of layout algorithms. And I think they usually make an initial layout
of the graph, which the user can make changes to. (Which of course means
that a reinvocation of the layout algorithm would change the graph again.)

How would you currently go about implementing a graph layout algorithm?
Using a standard layout manager?

TIA,

--
knut


"Randy Hudson" <none@ibm.com> wrote in message
news:aenn3t$9tl$1@rogue.oti.com...
> This is not supported yet. Would you want the user to be able to move the
> items in the graph? Or have them always automatically routed?
>
> "Fran
Re: Automatic graph layout [message #12529 is a reply to message #12445] Mon, 08 July 2002 17:27 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

"Knut Wannheden" <knut@paranor.ch> wrote in message
news:agc6tc$d07$1@rogue.oti.com...
> Hi,
>
> Is it planned for future versions of draw2d to support such a feature?
> Currently I see there is a routing mechanism for connections, but nothing
> for a complete graph with nodes.
>
> In other tools such as GVF, OpenJGraph, and JGraph there is support for
this
> type of layout algorithms. And I think they usually make an initial layout
> of the graph, which the user can make changes to. (Which of course means
> that a reinvocation of the layout algorithm would change the graph again.)
>
> How would you currently go about implementing a graph layout algorithm?
> Using a standard layout manager?

No, it sounds like this would be a JFace Action which performs an
"arrangement" (another word for layout, but not to be confused with layout
managers) on the EditParts. That action would then send
ChangeBoundsRequests to the nodes in the graph, which would result in a
command to set their <x, y> locations. All of the commands would be
composed in a single undoable CompoundCommand for the "Arrange Nodes"
action.
Previous Topic:How implement Zoom and GridLayout
Next Topic:[SWT] Any support or porting projects for OS2?
Goto Forum:
  


Current Time: Sat Dec 21 16:55:49 GMT 2024

Powered by FUDForum. Page generated in 0.04613 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top