Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] geometry axis
[GEF4] geometry axis [message #1712265] Thu, 22 October 2015 13:39 Go to next message
Sylvain Bi is currently offline Sylvain BiFriend
Messages: 10
Registered: May 2015
Junior Member
I have 3 question about gef4 geometry display


  1. Y Axis : I would like to invert the Y axis, to make the Y axis start from the bottom to the top, and so invert all of my shapes... (c.f. image)
  2. Zoom : I would like to change the zoom by default to make my geometry bigger (c.f. image)
  3. shift the X and Y : I have found how to do :
    ViewportModel viewportModel = getViewer().getAdapter(ViewportModel.class);
    viewportModel.setTranslateX(x);
    viewportModel.setTranslateY(y);


Actual display -------------------------------------------------------------------> Needed Display
index.php/fa/23660/0/

For the moment I convert each of my points like that :
pointConverted = [ pointToConvert.x * zoom, - pointToConvert.y * zoom]

That makes my code more difficult to understand because I lost my right distances... is there a way to fix the #1 & #2 questions? thanks you

[Updated on: Fri, 23 October 2015 13:58]

Report message to a moderator

Re: GEF4 geometry axis [message #1712333 is a reply to message #1712265] Fri, 23 October 2015 07:02 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi,

the ViewportModel manages a "contentsTransform" additional to the "translateX" and "translateY" values that you already found.

The contentsTransform is a transformation matrix that is applied to all visuals. Therefore, you can set the contentsTransform to a scale that inverts the Y axis and zooms in: viewportModel.setContentsTransform(new AffineTransform().scale(2, -2));

The translateX and translateY values are applied to the transformed contents, therefore, you could compute them based on the viewer's bounds if you want to keep the origin in the center.

Best regards,
Matthias
Previous Topic:[GEF4] Is it possible to do multiline?
Next Topic:In eclipse rcp adding a new gef figure doesn't invoke selection change
Goto Forum:
  


Current Time: Wed Apr 24 20:11:13 GMT 2024

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

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

Back to the top