Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » translatetoAbsolute problem
translatetoAbsolute problem [message #223981] Tue, 10 October 2006 18:04 Go to next message
Eclipse UserFriend
Originally posted by: something.eclipse.org

I have read a lot of posts here, but I still am missing something. I
have a layer with some figures and some anchors on the figures. I
cannot find out how to get the absolute location of the anchors. I
start with a point relative to the figure and try to translate it to
absolute (among other things), but the point always come back unchanged.

An example:
Layer bounds (0,0, 1500, 1500)
Figure Bounds (100, 100, 50, 50)
Anchor Location (5, 5) figure relative

I tried getOwner().translateTo<Everything> on the anchor location and I
always get the same point back. I thought getOwner.translateToAbsolute
would work, but no.

I would appreciate any help with this!

thanks,
adam
Re: translatetoAbsolute problem [message #224055 is a reply to message #223981] Wed, 11 October 2006 11:46 Go to previous messageGo to next message
Nhu Le is currently offline Nhu LeFriend
Messages: 47
Registered: July 2009
Member
I assume that you have set the useRelativeCoordinate in your figure to
be true (because of the relative anchor). I think as far as the figure
concerns, relative is the same as absolute as absolute is actually
relative to the layer. Have you tried anchor.translateToAbsolute()?

Nhu Le

AdamC wrote:
> I have read a lot of posts here, but I still am missing something. I
> have a layer with some figures and some anchors on the figures. I
> cannot find out how to get the absolute location of the anchors. I
> start with a point relative to the figure and try to translate it to
> absolute (among other things), but the point always come back unchanged.
>
> An example:
> Layer bounds (0,0, 1500, 1500)
> Figure Bounds (100, 100, 50, 50)
> Anchor Location (5, 5) figure relative
>
> I tried getOwner().translateTo<Everything> on the anchor location and I
> always get the same point back. I thought getOwner.translateToAbsolute
> would work, but no.
>
> I would appreciate any help with this!
>
> thanks,
> adam
Re: translatetoAbsolute problem [message #224126 is a reply to message #223981] Wed, 11 October 2006 15:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Your anchor's not a figure, so it's relative coordinates don't mean the
figure is using a local/relative coordinate system. You just have to get
the figure's absolute location and translate the location by 5,5 (or
whatever the anchor's location is) yourself.

"AdamC" <something@eclipse.org> wrote in message
news:eggnas$vt4$1@utils.eclipse.org...
>I have read a lot of posts here, but I still am missing something. I have
>a layer with some figures and some anchors on the figures. I cannot find
>out how to get the absolute location of the anchors. I start with a point
>relative to the figure and try to translate it to absolute (among other
>things), but the point always come back unchanged.
>
> An example:
> Layer bounds (0,0, 1500, 1500)
> Figure Bounds (100, 100, 50, 50)
> Anchor Location (5, 5) figure relative
>
> I tried getOwner().translateTo<Everything> on the anchor location and I
> always get the same point back. I thought getOwner.translateToAbsolute
> would work, but no.
>
> I would appreciate any help with this!
>
> thanks,
> adam
Re: translatetoAbsolute problem [message #224134 is a reply to message #224126] Wed, 11 October 2006 16:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: something.eclipse.org

Thanks for the help. I found out the problem was that layout had not
occurred yet, even though I thought it had. The only solution I could
find was to use Display.async and call translate when I knew all the
figures were placed. If there is a better place to do this, I would
like to hear it!

thanks again,
adam

Pratik Shah wrote:
> Your anchor's not a figure, so it's relative coordinates don't mean the
> figure is using a local/relative coordinate system. You just have to get
> the figure's absolute location and translate the location by 5,5 (or
> whatever the anchor's location is) yourself.
>
> "AdamC" <something@eclipse.org> wrote in message
> news:eggnas$vt4$1@utils.eclipse.org...
>> I have read a lot of posts here, but I still am missing something. I have
>> a layer with some figures and some anchors on the figures. I cannot find
>> out how to get the absolute location of the anchors. I start with a point
>> relative to the figure and try to translate it to absolute (among other
>> things), but the point always come back unchanged.
>>
>> An example:
>> Layer bounds (0,0, 1500, 1500)
>> Figure Bounds (100, 100, 50, 50)
>> Anchor Location (5, 5) figure relative
>>
>> I tried getOwner().translateTo<Everything> on the anchor location and I
>> always get the same point back. I thought getOwner.translateToAbsolute
>> would work, but no.
>>
>> I would appreciate any help with this!
>>
>> thanks,
>> adam
>
>
Re: translatetoAbsolute problem [message #224141 is a reply to message #224134] Wed, 11 October 2006 17:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

What are you trying to do? If you can give me a bigger picture than the
figure not having laid out when you're accessing anchor location, perhaps I
can help.

"AdamC" <something@eclipse.org> wrote in message
news:egj725$qaj$1@utils.eclipse.org...
> Thanks for the help. I found out the problem was that layout had not
> occurred yet, even though I thought it had. The only solution I could
> find was to use Display.async and call translate when I knew all the
> figures were placed. If there is a better place to do this, I would like
> to hear it!
>
> thanks again,
> adam
>
> Pratik Shah wrote:
>> Your anchor's not a figure, so it's relative coordinates don't mean the
>> figure is using a local/relative coordinate system. You just have to get
>> the figure's absolute location and translate the location by 5,5 (or
>> whatever the anchor's location is) yourself.
>>
>> "AdamC" <something@eclipse.org> wrote in message
>> news:eggnas$vt4$1@utils.eclipse.org...
>>> I have read a lot of posts here, but I still am missing something. I
>>> have a layer with some figures and some anchors on the figures. I
>>> cannot find out how to get the absolute location of the anchors. I
>>> start with a point relative to the figure and try to translate it to
>>> absolute (among other things), but the point always come back unchanged.
>>>
>>> An example:
>>> Layer bounds (0,0, 1500, 1500)
>>> Figure Bounds (100, 100, 50, 50)
>>> Anchor Location (5, 5) figure relative
>>>
>>> I tried getOwner().translateTo<Everything> on the anchor location and I
>>> always get the same point back. I thought getOwner.translateToAbsolute
>>> would work, but no.
>>>
>>> I would appreciate any help with this!
>>>
>>> thanks,
>>> adam
>>
Re: translatetoAbsolute problem [message #224156 is a reply to message #224141] Wed, 11 October 2006 17:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: something.eclipse.org

I am trying to make connections before the diagram is shown. To make
the connections, I need to know the absolute locations of the anchors.
The only way I could find to do this is the async call as this is the
only time I can be sure layout has happened. There is still an pause
though, using this method, between the time when the diagram is shown
and when the connections are shown.


Pratik Shah wrote:
> What are you trying to do? If you can give me a bigger picture than the
> figure not having laid out when you're accessing anchor location, perhaps I
> can help.
>
> "AdamC" <something@eclipse.org> wrote in message
> news:egj725$qaj$1@utils.eclipse.org...
>> Thanks for the help. I found out the problem was that layout had not
>> occurred yet, even though I thought it had. The only solution I could
>> find was to use Display.async and call translate when I knew all the
>> figures were placed. If there is a better place to do this, I would like
>> to hear it!
>>
>> thanks again,
>> adam
>>
>> Pratik Shah wrote:
>>> Your anchor's not a figure, so it's relative coordinates don't mean the
>>> figure is using a local/relative coordinate system. You just have to get
>>> the figure's absolute location and translate the location by 5,5 (or
>>> whatever the anchor's location is) yourself.
>>>
>>> "AdamC" <something@eclipse.org> wrote in message
>>> news:eggnas$vt4$1@utils.eclipse.org...
>>>> I have read a lot of posts here, but I still am missing something. I
>>>> have a layer with some figures and some anchors on the figures. I
>>>> cannot find out how to get the absolute location of the anchors. I
>>>> start with a point relative to the figure and try to translate it to
>>>> absolute (among other things), but the point always come back unchanged.
>>>>
>>>> An example:
>>>> Layer bounds (0,0, 1500, 1500)
>>>> Figure Bounds (100, 100, 50, 50)
>>>> Anchor Location (5, 5) figure relative
>>>>
>>>> I tried getOwner().translateTo<Everything> on the anchor location and I
>>>> always get the same point back. I thought getOwner.translateToAbsolute
>>>> would work, but no.
>>>>
>>>> I would appreciate any help with this!
>>>>
>>>> thanks,
>>>> adam
>
Re: translatetoAbsolute problem [message #224173 is a reply to message #224156] Wed, 11 October 2006 19:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

Why do you need the absolute location of the anchor? Is that what you store
in your model for where the connection starts/ends? You should model
terminals, like LED or circuit in the logic example.

"AdamC" <something@eclipse.org> wrote in message
news:egjb7t$ik6$1@utils.eclipse.org...
>I am trying to make connections before the diagram is shown. To make the
>connections, I need to know the absolute locations of the anchors. The only
>way I could find to do this is the async call as this is the only time I
>can be sure layout has happened. There is still an pause though, using
>this method, between the time when the diagram is shown and when the
>connections are shown.
>
>
> Pratik Shah wrote:
>> What are you trying to do? If you can give me a bigger picture than the
>> figure not having laid out when you're accessing anchor location, perhaps
>> I can help.
>>
>> "AdamC" <something@eclipse.org> wrote in message
>> news:egj725$qaj$1@utils.eclipse.org...
>>> Thanks for the help. I found out the problem was that layout had not
>>> occurred yet, even though I thought it had. The only solution I could
>>> find was to use Display.async and call translate when I knew all the
>>> figures were placed. If there is a better place to do this, I would
>>> like to hear it!
>>>
>>> thanks again,
>>> adam
>>>
>>> Pratik Shah wrote:
>>>> Your anchor's not a figure, so it's relative coordinates don't mean the
>>>> figure is using a local/relative coordinate system. You just have to
>>>> get the figure's absolute location and translate the location by 5,5
>>>> (or whatever the anchor's location is) yourself.
>>>>
>>>> "AdamC" <something@eclipse.org> wrote in message
>>>> news:eggnas$vt4$1@utils.eclipse.org...
>>>>> I have read a lot of posts here, but I still am missing something. I
>>>>> have a layer with some figures and some anchors on the figures. I
>>>>> cannot find out how to get the absolute location of the anchors. I
>>>>> start with a point relative to the figure and try to translate it to
>>>>> absolute (among other things), but the point always come back
>>>>> unchanged.
>>>>>
>>>>> An example:
>>>>> Layer bounds (0,0, 1500, 1500)
>>>>> Figure Bounds (100, 100, 50, 50)
>>>>> Anchor Location (5, 5) figure relative
>>>>>
>>>>> I tried getOwner().translateTo<Everything> on the anchor location and
>>>>> I always get the same point back. I thought
>>>>> getOwner.translateToAbsolute would work, but no.
>>>>>
>>>>> I would appreciate any help with this!
>>>>>
>>>>> thanks,
>>>>> adam
>>
Re: translatetoAbsolute problem [message #224181 is a reply to message #224173] Wed, 11 October 2006 19:18 Go to previous message
Eclipse UserFriend
Originally posted by: something.eclipse.org

Actually, I need the absolute locations because part of my connection
algorithm check the absolute position of the anchor before deciding to
make a connection. It would really help to know where I could put code
that would be called after layout but before showing my diagram.

adam

Pratik Shah wrote:
> Why do you need the absolute location of the anchor? Is that what you store
> in your model for where the connection starts/ends? You should model
> terminals, like LED or circuit in the logic example.
>
> "AdamC" <something@eclipse.org> wrote in message
> news:egjb7t$ik6$1@utils.eclipse.org...
>> I am trying to make connections before the diagram is shown. To make the
>> connections, I need to know the absolute locations of the anchors. The only
>> way I could find to do this is the async call as this is the only time I
>> can be sure layout has happened. There is still an pause though, using
>> this method, between the time when the diagram is shown and when the
>> connections are shown.
>>
>>
>> Pratik Shah wrote:
>>> What are you trying to do? If you can give me a bigger picture than the
>>> figure not having laid out when you're accessing anchor location, perhaps
>>> I can help.
>>>
>>> "AdamC" <something@eclipse.org> wrote in message
>>> news:egj725$qaj$1@utils.eclipse.org...
>>>> Thanks for the help. I found out the problem was that layout had not
>>>> occurred yet, even though I thought it had. The only solution I could
>>>> find was to use Display.async and call translate when I knew all the
>>>> figures were placed. If there is a better place to do this, I would
>>>> like to hear it!
>>>>
>>>> thanks again,
>>>> adam
>>>>
>>>> Pratik Shah wrote:
>>>>> Your anchor's not a figure, so it's relative coordinates don't mean the
>>>>> figure is using a local/relative coordinate system. You just have to
>>>>> get the figure's absolute location and translate the location by 5,5
>>>>> (or whatever the anchor's location is) yourself.
>>>>>
>>>>> "AdamC" <something@eclipse.org> wrote in message
>>>>> news:eggnas$vt4$1@utils.eclipse.org...
>>>>>> I have read a lot of posts here, but I still am missing something. I
>>>>>> have a layer with some figures and some anchors on the figures. I
>>>>>> cannot find out how to get the absolute location of the anchors. I
>>>>>> start with a point relative to the figure and try to translate it to
>>>>>> absolute (among other things), but the point always come back
>>>>>> unchanged.
>>>>>>
>>>>>> An example:
>>>>>> Layer bounds (0,0, 1500, 1500)
>>>>>> Figure Bounds (100, 100, 50, 50)
>>>>>> Anchor Location (5, 5) figure relative
>>>>>>
>>>>>> I tried getOwner().translateTo<Everything> on the anchor location and
>>>>>> I always get the same point back. I thought
>>>>>> getOwner.translateToAbsolute would work, but no.
>>>>>>
>>>>>> I would appreciate any help with this!
>>>>>>
>>>>>> thanks,
>>>>>> adam
>
>
Previous Topic:Bringing figures to top
Next Topic:Question about connection. How can I do this?
Goto Forum:
  


Current Time: Thu Oct 28 16:36:10 GMT 2021

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

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

Back to the top