[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Still struggling with coordinates

For some reason I was thinking that there was some universal way to get these coordinates but apparently I need to check the figures to see if they use local coordinates and then do my thing that way. That's fine and it makes sense. I just thought that I was misusing something. I'm using this to figure out some bounds in my figures. I need to be able to determine the available space for a cell editor in a custom table.

Thanks for the tip on the help as well. I had looked in there before but hadn't since I grabbed 3.1.1.

Pratik Shah wrote:
Think of absolute and local (relative) as two different coordinate systems.
translateToRelative() translates the coordinates to that figure's local
coordinate system, which may not necessarily be relative to that figure's
origin (as is the case with ScalableLayeredPane).  In your case, the parent
and child are in the same coordinate system, which is why
translateToRelative() does nothing.  To do what you want, you can just
subtract the parent's location from that of the child's.  What are you using
this for?

The new GEF help documentation (3.1.1 and later) has a section on
coordinates that might clear things up for you.

"Brad Reynolds" <bradleyjames@xxxxxxxxx> wrote in message
news:di9r6f$qdk$1@xxxxxxxxxxxxxxxxxxx

There's something fundamental that I'm missing and hopefully someone can
straighten me out.  I have a figure that contains another figure.  What
I want is to be able to get the coordinates of the child figure relative
to it's parent's figure.  When I call any of the translate methods the
check to useLocalCoordinates() always returns false so it doesn't
translate.  How can I translate a figure's bounds to be relative to it's
parent?

Thanks,
Brad