Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Absolute coordinates to container relative coordinates
Absolute coordinates to container relative coordinates [message #909847] Fri, 07 September 2012 22:56 Go to next message
Rui Domingues is currently offline Rui Domingues
Messages: 193
Registered: October 2010
Senior Member
I am insisting in this question once in bugzilla (where I filed an enhancement https://bugs.eclipse.org/bugs/show_bug.cgi?id=389031), Michael answer suggests me that this is possible.

So given diagrameditor mouse coordinates how can I calculate the respective container relative coordinates at the moment of canMove/move invokation?


I've been watching to :
DiagramEditor#getMouseLocation
DiagramEditor#calculateRealMouseLocation(nativeLocation)
IPeLayoutService()#getLocationRelativeToDiagram()

But, or by my incompetence or something else I'm not figurering out how to do this.
Any hint??

Thanks in advance
Re: Absolute coordinates to container relative coordinates [message #910695 is a reply to message #909847] Mon, 10 September 2012 08:23 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1618
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Let's see:
1) diagramEditor.getMouseLocation() returns the mouse position relative to
the root of the current viewport
2) applying diagramEditor.calculateRealMouseLocation(...) on that location
from 1) returns the mouse location relative to the root of the diagram
3) context.getTargetContainer().getGraphicsAlgorithm().getX()/getY() returns
the location of the of the target container relative to the diagram root
4) substracting 3) from 2) should be what you are looking for.

Let me know if I'm wrong...

Michael
Re: Absolute coordinates to container relative coordinates [message #910755 is a reply to message #910695] Mon, 10 September 2012 10:40 Go to previous message
Rui Domingues is currently offline Rui Domingues
Messages: 193
Registered: October 2010
Senior Member
Hi. Thanks.

I adapted to my situation (multiple nested container shapes), summing up the successive (x,y) of each container until Diagram, and it is working.

Thanks again.
Previous Topic:Creating graphiti diagrams without file based resource
Next Topic:Saving Editor in a AbstractCustomFeature = UI Deadlock
Goto Forum:
  


Current Time: Sat Oct 25 19:18:22 GMT 2014

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

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