Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [Zest] layout without keeping width / height ratio?
[Zest] layout without keeping width / height ratio? [message #520334] Thu, 11 March 2010 23:57 Go to next message
Andre Dietisheim is currently offline Andre DietisheimFriend
Messages: 131
Registered: July 2009
Senior Member
Hi!

I'm currently working on a custom layout algorithm that builds a tree of
branches in org.eclipse.emf.cdo (is pretty similar to branches in a
centralized SCM). I wanted to use timestamps as y-coordinates.
Unfortunately the results are not the way I expect them and I try to
figure out what's wrong.

actual result:
http://img689.yfrog.com/i/displaced.png/

expected result:
http://yfrog.com/jdshouldbep

My nodes are incredibly displaced horizontally (though I have very
little offsets on the x-axis). The scale on the y-axis is terribly wide
(I have timestamps as y-coords) while the x-axis pretty normal (between
-50 and +50).
I guess (stepping through AbstractLayoutAlgorythm) that the ratio
between the width and the height of the layout bounds are kept and the
differences on the x-axis are therefore terribly scaled.

I wonder whether my guess is completely wrong (what do I miss?) and
what's the snippet to change in AbstractLayoutAlgorythm.

Thanks a lot for for your help!!

Cheers
André
[Zest] layout without keeping width / height ratio? [message #520457 is a reply to message #520334] Fri, 12 March 2010 13:20 Go to previous message
Andre Dietisheim is currently offline Andre DietisheimFriend
Messages: 131
Registered: July 2009
Senior Member
Hi

I got a bit further in analyzing the problems I currently experience.

Both nodes that should be on identical x-coordinates are not. I think I
found the reason in

AbstractLayoutAlgorithm#defaultFitWithinBounds

All those calculations, relocations, shifts and resizes lead to a
precision loss (see
http://java.sun.com/docs/books/jls/third_edition/html/typesV alues.html#4.2.4)
and that's why both identical x-coordinates are not any longer identical.

My current conclusion is that I'd have to either:

1.) provide my own 'fitWithinBounds' that ensures that identical
x-coordinate values stay identical (different approach)

2.) provide my own 'fitWithinBounds' that uses BigDecimal (instead of
double).

Any thoughts?

Cheers and thanks for your thoughts!
André

Ande Dietisheim wrote:
> Hi!
>
> I'm currently working on a custom layout algorithm that builds a tree of
> branches in org.eclipse.emf.cdo (is pretty similar to branches in a
> centralized SCM). I wanted to use timestamps as y-coordinates.
> Unfortunately the results are not the way I expect them and I try to
> figure out what's wrong.
>
> actual result:
> http://img689.yfrog.com/i/displaced.png/
>
> expected result:
> http://yfrog.com/jdshouldbep
>
> My nodes are incredibly displaced horizontally (though I have very
> little offsets on the x-axis). The scale on the y-axis is terribly wide
> (I have timestamps as y-coords) while the x-axis pretty normal (between
> -50 and +50).
> I guess (stepping through AbstractLayoutAlgorythm) that the ratio
> between the width and the height of the layout bounds are kept and the
> differences on the x-axis are therefore terribly scaled.
>
> I wonder whether my guess is completely wrong (what do I miss?) and
> what's the snippet to change in AbstractLayoutAlgorythm.
>
> Thanks a lot for for your help!!
>
> Cheers
> André
Previous Topic:Getting the editor from a PropertySection
Next Topic:How to share a CommandStack and/or EditDomain?
Goto Forum:
  


Current Time: Sat Apr 20 15:15:38 GMT 2024

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

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

Back to the top