Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Directed Cyclic Graph/Tree and Draw2d
Directed Cyclic Graph/Tree and Draw2d [message #157041] Fri, 05 November 2004 19:18 Go to next message
Donna Gresh is currently offline Donna GreshFriend
Messages: 30
Registered: July 2009
Member
This is a multipart message in MIME format.
--=_alternative 006A026585256F43_=
Content-Type: text/plain; charset="US-ASCII"

I have a need to draw a tree which is cyclic. I would like to create
something where all edges go out the top of the source node and come in at
the bottom of the target node. Thus for example if there is a cycle
between two nodes which lie one above the other, *two* edges would be
drawn: one from the "top-of-the-lower" to the "bottom-of-the-upper", and
another which bends around, starting from the "top-of-the-upper" and drawn
down and around, coming in at the "bottom-of-the-lower"

My first attempt, based on DirectedGraphDemo, adding an edge from node a
to b and also an edge from b to a, yielded a result which had a single
edge with an arrow head at both ends. It implies the same thing, but does
not convey what my users expect to see.

I did not see any examples in the draw2D demos which had this sort of
situation. I tried reading the javadoc on the varous Node, Edge,
DirectedGraph, DirectedGraphLayout, etc. but there is very little info on
what the parameters and methods actually do for any of these.

Thanks for any pointers.
--=_alternative 006A026585256F43_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 face="sans-serif">I have a need to draw a tree which is
cyclic. I would like to create something where all edges go out the top
of the source node and come in at the bottom of the target node. Thus for
example if there is a cycle between two nodes which lie one above the other,
*two* edges would be drawn: one from the &quot;top-of-the-lower&quot; to
the &quot;bottom-of-the-upper&quot;, and another which bends around, starting
from the &quot;top-of-the-upper&quot; and drawn down and around, coming
in at the &quot;bottom-of-the-lower&quot;</font>
<br>
<br><font size=2 face="sans-serif">My first attempt, based on DirectedGraphDemo,
adding an edge from node a to b and also an edge from b to a, yielded a
result which had a single edge with an arrow head at both ends. It implies
the same thing, but does not convey what my users expect to see. </font>
<br>
<br><font size=2 face="sans-serif">I did not see any examples in the draw2D
demos which had this sort of situation. I tried reading the javadoc on
the varous Node, Edge, &nbsp;DirectedGraph, DirectedGraphLayout, etc. but
there is very little info on what the parameters and methods actually do
for any of these.</font>
<br>
<br><font size=2 face="sans-serif">Thanks for any pointers.</font>
--=_alternative 006A026585256F43_=--
Re: Directed Cyclic Graph/Tree and Draw2d [message #157053 is a reply to message #157041] Sat, 06 November 2004 00:44 Go to previous message
Vineet Sinha is currently offline Vineet SinhaFriend
Messages: 31
Registered: July 2009
Member
> I have a need to draw a tree which is cyclic. I would like to create
> something where all edges go out the top of the source node and come in
> at the bottom of the target node. Thus for example if there is a cycle
> between two nodes which lie one above the other, *two* edges would be
> drawn: one from the "top-of-the-lower" to the "bottom-of-the-upper", and
> another which bends around, starting from the "top-of-the-upper" and
> drawn down and around, coming in at the "bottom-of-the-lower"
>
> My first attempt, based on DirectedGraphDemo, adding an edge from node a
> to b and also an edge from b to a, yielded a result which had a single
> edge with an arrow head at both ends. It implies the same thing, but
> does not convey what my users expect to see.
>
> ...

My guess is that you actually saw two edges with each having a single
arrow. You would most probably need to get one of the two edges drawn
differently. I would suggest doing two things:

1]] Set the source connection anchor to always start from the top on a
node and always end at the bottom of a node (as opposed to the edge
connected by the shorted line). You would need to look at:
[a] AbstractConnectionEditPart
.getSourceConnectionAnchor() +
.getTargetConnectionAnchor()
[b] ChopboxAnchor + AbstractGraphDemo.TopOrBottomAnchor

2]] Modify the connection router. See subtypes of AbstractRouter


Vineet
Previous Topic:Displaying some text on empty palette.
Next Topic:Get EditPart
Goto Forum:
  


Current Time: Fri Dec 27 01:59:35 GMT 2024

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

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

Back to the top