Skip to main content



      Home
Home » Eclipse Projects » GEF » Problem with Local / absolute coordinates
Problem with Local / absolute coordinates [message #167070] Sat, 05 February 2005 10:06 Go to next message
Eclipse UserFriend
Originally posted by: no.mail.please

Hi !

I need to place a figure inside a container based on the coordinates of
another figure inside another container figure.

My problem is that I get absolutes coordinates from my model and so
cannot place the second figure correctly.

I would like to translate these absolute coordinates in local
coordinates relative to the parent figure, but I can't manage to do it
using translateFromParent.

How can I do it ?

TIA

--
Arnaud

the locations methods in my model classes look like that :

/**
* Set the Location of this bean.
* @param newLocation a non-null Point instance
* @throws IllegalArgumentException if the parameter is null
*/
public void setBeanLocation(Point newLocation) {
if (newLocation == null) {
throw new IllegalArgumentException();
}
location.setLocation(newLocation);
firePropertyChange(LOCATION_PROP, null, location);
}

public Point getBeanLocation() {
return location.getCopy();
}
Re: Problem with Local / absolute coordinates [message #167124 is a reply to message #167070] Sun, 06 February 2005 00:58 Go to previous messageGo to next message
Eclipse UserFriend
Your problem's not exactly clear to me. So, you want to place figure F2 in
container figure C2 based on F1's location in C1? Why is that? What are
you trying to do? Do C1 and C2 have the same coordinate system and same
parent? Do you have any figures that use relative coordinates?

Try: c1.translateToRelative(coordinates)


"Arnaud" <no@mail.please> wrote in message
news:cu2ndi$bql$1@www.eclipse.org...
> Hi !
>
> I need to place a figure inside a container based on the coordinates of
> another figure inside another container figure.
>
> My problem is that I get absolutes coordinates from my model and so
> cannot place the second figure correctly.
>
> I would like to translate these absolute coordinates in local
> coordinates relative to the parent figure, but I can't manage to do it
> using translateFromParent.
>
> How can I do it ?
>
> TIA
>
> --
> Arnaud
>
> the locations methods in my model classes look like that :
>
> /**
> * Set the Location of this bean.
> * @param newLocation a non-null Point instance
> * @throws IllegalArgumentException if the parameter is null
> */
> public void setBeanLocation(Point newLocation) {
> if (newLocation == null) {
> throw new IllegalArgumentException();
> }
> location.setLocation(newLocation);
> firePropertyChange(LOCATION_PROP, null, location);
> }
>
> public Point getBeanLocation() {
> return location.getCopy();
> }
Re: Problem with Local / absolute coordinates [message #167325 is a reply to message #167124] Mon, 07 February 2005 05:07 Go to previous message
Eclipse UserFriend
Originally posted by: no.mail.please

OK, I did it another way.

Thanks anyway for the response.

--
Arnaud
Previous Topic:why getHeight() returns top+bottom in class Insets?
Next Topic:Editing JavaBeans in GEF
Goto Forum:
  


Current Time: Thu Jun 12 18:23:05 EDT 2025

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

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

Back to the top