Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Still struggling with coordinates
Still struggling with coordinates [message #198240] Sun, 09 October 2005 01:19 Go to next message
Brad Reynolds is currently offline Brad ReynoldsFriend
Messages: 309
Registered: July 2009
Senior Member
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
Re: Still struggling with coordinates [message #198251 is a reply to message #198240] Sun, 09 October 2005 01:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

What you are asking is the opposite of what XYLayout does when it lays out.
So refer to its layout method

"Brad Reynolds" <bradleyjames@gmail.com> wrote in message
news:di9r6f$qdk$1@news.eclipse.org...
> 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
Re: Still struggling with coordinates [message #198255 is a reply to message #198240] Sun, 09 October 2005 01:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

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@gmail.com> wrote in message
news:di9r6f$qdk$1@news.eclipse.org...
> 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
Re: Still struggling with coordinates [message #198268 is a reply to message #198255] Sun, 09 October 2005 14:35 Go to previous message
Brad Reynolds is currently offline Brad ReynoldsFriend
Messages: 309
Registered: July 2009
Senior Member
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@gmail.com> wrote in message
> news:di9r6f$qdk$1@news.eclipse.org...
>
>>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
>
>
>
Previous Topic:eDiagram and existing references
Next Topic:How to add menu item to figure's context menu?
Goto Forum:
  


Current Time: Mon Dec 02 18:11:11 GMT 2024

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

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

Back to the top