Skip to main content



      Home
Home » Eclipse Projects » GEF » [GEF4] geometry axis
[GEF4] geometry axis [message #1712265] Thu, 22 October 2015 09:39 Go to next message
Eclipse UserFriend
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 09:58] by Moderator

Re: GEF4 geometry axis [message #1712333 is a reply to message #1712265] Fri, 23 October 2015 03:02 Go to previous message
Eclipse UserFriend
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: Sat Nov 08 09:48:47 EST 2025

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

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

Back to the top