Node Layout in Subgraphs of CompoundDirectedGraph [message #213690] |
Mon, 10 April 2006 01:42 |
Eclipse User |
|
|
|
Originally posted by: fritz.cs.ubc.ca
Hi,
I am trying to create an application similar to a class diagram editor and
use the CompoundDirectedGraphLayout to get an initial layout for the
elements of the class diagram. I have used most of the code from the flow
example to contribute nodes/edges to the graph and to apply the graph
results. In my application, classes play the roles of subgraphs and methods
are the nodes contained in those subgraphs.
However, the CompoundDirectedGraphLayout orders the methods (i.e. the nodes
in a subgraph) from left to right and I would like to know if there is a way
to change that behaviour to order them top-down (i.e. the
CompoundDirectedGraphLayout calculates the width and height of the subgraph
and the positions of the nodes so that the methods are laid out from top to
bottom)?
Thanks,
Thomas
|
|
|
|
Re: Node Layout in Subgraphs of CompoundDirectedGraph [message #213928 is a reply to message #213765] |
Tue, 11 April 2006 21:06 |
Eclipse User |
|
|
|
Originally posted by: fritz.cs.ubc.ca
Hi Steven,
thanks a lot for your response. I have tried swapping the width and height
of the nodes and subgraphs that I input into the graph before I actually
call "new CompoundDirectedGraphLayout().visit(graph);" and then swapped the
x,y coordinates and the width and height of the resulting subgraphs and
nodes calculated by the layout algorithm. However, this did not work out and
the calculated bounds are even worse than before as now the class element
figure bounds are not set big enough for all of its method and field
elements.
Do I have to swap something else? (Furthermore, do you know if your approach
also results in the proper coordiantes for the virtual nodes of edges?)
So far I have used another workaround that introduces invisible edges
between the nodes of a subgraph in a way so that they are ordered top down,
i.e. I have added an edge between two methods that should be neighbours in
the end and set the weight of the edge quite high. This results in a top
down layout of the method elements of a class however the layout algorithm
often calculates blank spaces between methods and I still don't know how to
avoid those.
Thanks also for the tip with GMF. I wanted to use EMF in the first place but
then discarded the idea as it produces validation code that I do not want to
have and thus it seemed easier to me writing the model on my own and just
use GEF. However, I did not know that GMF already provides a default layout
action, and now that I struggle with the layout for already a quite long
time, this seems interesting. Is the default layout based on the compound
directed graph layout or is it using a completely different algorithm and if
so, does GEF not provide the same layout algorithm so that I could
incorporate it? (I think my editor will get more sophisticated at some point
and thus do not really know if it is best to base it on GMF or just on GEF
and get just more familiar with GEF. Do you have any suggestion when it is
best to use GMF and when just to base it on GEF?)
Thanks,
Thomas
"Steven Shaw" <steveshaw@ca.ibm.com> wrote in message
news:e1eid7$799$1@utils.eclipse.org...
> There isn't an explicit way in the CompoundDirectedGraphLayout class
> itself,
> but by simply swamping the (x,y) coordinate inputs to the graph you can
> accomplish this. After the graph is completed, then swap the values back
> into your native nodes (Figures / model).
>
> For simple class diagram type editors, you probably should take a look at
> the GMF project. (www.eclipse.org/gmf ) It can quickly generate the
> editor
> from an EMF model and it already has a default layout defined through an
> arrange action based on the GEF layouts.
>
> -Steve
>
> "Thomas Fritz" <fritz@cs.ubc.ca> wrote in message
> news:e1cd5h$d66$1@utils.eclipse.org...
>> Hi,
>>
>> I am trying to create an application similar to a class diagram editor
>> and
>> use the CompoundDirectedGraphLayout to get an initial layout for the
>> elements of the class diagram. I have used most of the code from the flow
>> example to contribute nodes/edges to the graph and to apply the graph
>> results. In my application, classes play the roles of subgraphs and
> methods
>> are the nodes contained in those subgraphs.
>> However, the CompoundDirectedGraphLayout orders the methods (i.e. the
> nodes
>> in a subgraph) from left to right and I would like to know if there is a
> way
>> to change that behaviour to order them top-down (i.e. the
>> CompoundDirectedGraphLayout calculates the width and height of the
> subgraph
>> and the positions of the nodes so that the methods are laid out from top
> to
>> bottom)?
>>
>> Thanks,
>> Thomas
>>
>>
>
>
|
|
|
Re: Node Layout in Subgraphs of CompoundDirectedGraph [message #215071 is a reply to message #213690] |
Wed, 26 April 2006 12:45 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
See DirectedGraph#setDirection(POsitionConstants.EAST)
"Thomas Fritz" <fritz@cs.ubc.ca> wrote in message
news:e1cd5h$d66$1@utils.eclipse.org...
> Hi,
>
> I am trying to create an application similar to a class diagram editor and
> use the CompoundDirectedGraphLayout to get an initial layout for the
> elements of the class diagram. I have used most of the code from the flow
> example to contribute nodes/edges to the graph and to apply the graph
> results. In my application, classes play the roles of subgraphs and
> methods are the nodes contained in those subgraphs.
> However, the CompoundDirectedGraphLayout orders the methods (i.e. the
> nodes in a subgraph) from left to right and I would like to know if there
> is a way to change that behaviour to order them top-down (i.e. the
> CompoundDirectedGraphLayout calculates the width and height of the
> subgraph and the positions of the nodes so that the methods are laid out
> from top to bottom)?
>
> Thanks,
> Thomas
>
|
|
|
Powered by
FUDForum. Page generated in 0.03309 seconds