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.
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.
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é