Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Compute absolute coordinates to store in the model
Compute absolute coordinates to store in the model [message #239747] Mon, 12 November 2007 13:10
Alexander NyÃ?en is currently offline Alexander NyÃ?enFriend
Messages: 38
Registered: July 2009
Member
Hallo,

I want to store only absolute coordinates in my model. Therefore I overrided
the translateToModelConstraint in my XYLayoutPolicy as follows:

@Override
protected Object translateToModelConstraint(Object figureConstraint) {
Rectangle constraint = ((Rectangle) figureConstraint).getCopy();
logger.info("called with constraint " + constraint);

// compute an absolute position
constraint = constraint.getTranslated(getLayoutOrigin());
logger.info("... translated by getLayoutOrigin: " + constraint);

getLayoutContainer().translateToAbsolute(constraint);
logger.info("... translated to absolute " + constraint);

return constraint;
}

Everything works fine, as long as the viewport of the GraphicalViewer does
not show scrolling bars. If it does, when I handle a Create or ChangeBounds
request, the translateToAbsolute on the layout container actually subtracts
the viewer's client area location instead of adding it (as I would expect
it). Is that a problem in Viewports translateToParent() method or am I using
it wrong? What could I do to always obtain the correct absolute position?

Regards,
Alexander
Previous Topic:ShortestPathConnectionRouter in Manhattan Style?
Next Topic:Adding context menu contributions for the model objects, not the edit parts
Goto Forum:
  


Current Time: Thu Apr 25 00:29:58 GMT 2024

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

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

Back to the top