Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How can I reverse the direction of the Y axis?
How can I reverse the direction of the Y axis? [message #208925] Thu, 09 February 2006 20:59 Go to next message
Eclipse UserFriend
Originally posted by: geoff_crowther.uk.ibm.com

BlankIn the GEF examples (e.g. Logic) the origin (0, 0) is at the top right
of the editor window. Positive Y values are below this origin, and negative
Y values are above. Is there any way to change this direction, so that
positive Y is upwards, preferably also changing the default location of the
origin to be the bottom left of the editor window? This would allow the
editor to match the conventional representation of an X,Y coordinate system.

Many thanks for your help.

Geoff Crowther
Re: How can I reverse the direction of the Y axis? [message #208959 is a reply to message #208925] Fri, 10 February 2006 00:53 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
GEF is consistent with SWT which is consistent with most OS windowing
systems which use the top left as a anchor for the point system. If you're
relying on some mathematic libraries or something that assumes different, it
should be a simple mapping to achieve the opposite (ViewPort extent - y
coordinate).

Regards,

Steve.

"geoffc" <geoff_crowther@uk.ibm.com> wrote in message
news:dsga83$pko$1@utils.eclipse.org...
> BlankIn the GEF examples (e.g. Logic) the origin (0, 0) is at the top
right
> of the editor window. Positive Y values are below this origin, and
negative
> Y values are above. Is there any way to change this direction, so that
> positive Y is upwards, preferably also changing the default location of
the
> origin to be the bottom left of the editor window? This would allow the
> editor to match the conventional representation of an X,Y coordinate
system.
>
> Many thanks for your help.
>
> Geoff Crowther
>
>
Re: How can I reverse the direction of the Y axis? [message #208982 is a reply to message #208959] Fri, 10 February 2006 09:03 Go to previous messageGo to next message
Tomáš Studva is currently offline Tomáš StudvaFriend
Messages: 9
Registered: July 2009
Junior Member
I think good solution is to create such conversion methods. Maybe you find a good class where to place these methods as static. But I think if you subclass yor root editpart, you can change it there and have these coordinates by default.
Tomas Studva
Re: How can I reverse the direction of the Y axis? [message #209045 is a reply to message #208925] Fri, 10 February 2006 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Rectangle rect = canvas.getClientArea();
Transform t = new Transform(Display.getCurrent());
t.translate(0f, (float)(rect.height - rect.y));
t.scale( 0f, -1f);
gc.setTransform(t);

"geoffc" <geoff_crowther@uk.ibm.com> wrote in message
news:dsga83$pko$1@utils.eclipse.org...
> BlankIn the GEF examples (e.g. Logic) the origin (0, 0) is at the top
> right
> of the editor window. Positive Y values are below this origin, and
> negative
> Y values are above. Is there any way to change this direction, so that
> positive Y is upwards, preferably also changing the default location of
> the
> origin to be the bottom left of the editor window? This would allow the
> editor to match the conventional representation of an X,Y coordinate
> system.
>
> Many thanks for your help.
>
> Geoff Crowther
Re: How can I reverse the direction of the Y axis? [message #210329 is a reply to message #209045] Sat, 25 February 2006 09:50 Go to previous message
Eclipse UserFriend
Originally posted by: geoff_crowther.uk.ibm.com

Randy

Many thanks for your suggestion. Unfortunately I am new to GEF, and cannot
see where to hook this in to my application which is currently loosly based
on the "Logic" example application. Could you provide a few pointers for
me.

Thanks again

Geoff
"Randy Hudson" <none@us.ibm.com> wrote in message
news:dsicl5$5ei$1@utils.eclipse.org...
> Rectangle rect = canvas.getClientArea();
> Transform t = new Transform(Display.getCurrent());
> t.translate(0f, (float)(rect.height - rect.y));
> t.scale( 0f, -1f);
> gc.setTransform(t);
>
> "geoffc" <geoff_crowther@uk.ibm.com> wrote in message
> news:dsga83$pko$1@utils.eclipse.org...
> > BlankIn the GEF examples (e.g. Logic) the origin (0, 0) is at the top
> > right
> > of the editor window. Positive Y values are below this origin, and
> > negative
> > Y values are above. Is there any way to change this direction, so that
> > positive Y is upwards, preferably also changing the default location of
> > the
> > origin to be the bottom left of the editor window? This would allow the
> > editor to match the conventional representation of an X,Y coordinate
> > system.
> >
> > Many thanks for your help.
> >
> > Geoff Crowther
>
>
Previous Topic:grid and background image
Next Topic:TextFlow doesn't return correct height from getPreferredSize()
Goto Forum:
  


Current Time: Wed Sep 25 12:26:40 GMT 2024

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

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

Back to the top