Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Moving bend points with source and target
Moving bend points with source and target [message #1403103] Mon, 21 July 2014 11:38 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 549
Registered: June 2011
Senior Member
In my application, i have used XYLayoutEditPolicy and i am moving the bend points when source or target of any connection is moved. On 100% zoom, every thing works fine but i change the zoom then the movement of bendpoints with source or target becomes problematic. I have also tried to scale the delta with zoom factor but still it is problematic. My question is how to handle the movement of bendspoints with source and target of connection?

Cheers
Re: Moving bend points with source and target [message #1403111 is a reply to message #1403103] Mon, 21 July 2014 12:20 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 549
Registered: June 2011
Senior Member
i have fixed this problem by using deltapoint.scale(1/zoomfactor)
Re: Moving bend points with source and target [message #1403156 is a reply to message #1403103] Mon, 21 July 2014 20:09 Go to previous messageGo to next message
Alexander Nyßen is currently offline Alexander NyßenFriend
Messages: 78
Registered: July 2009
Location: Lünen
Member
I have the impression you might be missing some coordinate system translations (the movement of source and target has to be translated into the coordinate system, in which the bendpoint locations are interpreted) and using the scale seems to be a hack which only compensates this partially. Have you checked what happens when you scroll?
Re: Moving bend points with source and target [message #1403196 is a reply to message #1403156] Tue, 22 July 2014 10:04 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 549
Registered: June 2011
Senior Member
i have tried moving source/target of any connection to get the scroll going then all bend points move smoothy with source/target. Now the problem is to create new bend point. Newly created bend point ends up in wrong position when zoom is not 100%. Do you have any idea how to handle this situation?
Re: Moving bend points with source and target [message #1403263 is a reply to message #1403196] Tue, 22 July 2014 16:33 Go to previous messageGo to next message
Alexander Nyßen is currently offline Alexander NyßenFriend
Messages: 78
Registered: July 2009
Location: Lünen
Member
Again, you will have to make sure all coordinates are interpreted in the same coordinate system (i.e. here in the one used by the connection). Its the same problem as with source and target (which you have up to now solved only with a dirty workaround, which will not cover all cases). Source and target nodes are located somewhere in the primary layer (probably within a parent that adds a local coordinate system), connections are located in the connection layer, the endpoint positions you use for creation are probably absolute (i.e. not affected by the scroll offset).

What you will have to do is to translate them all to be relative to the same coordinate system to be comparable. You can either use the absolute one for this, or the relative one of the connection (i.e. that of the connection layer). IFigure#translateToParent(), IFigure#translateFromParent(), IFigure#translateToAbsolute(), and IFigure#translateToRelative() are meant to accomplish this.
Re: Moving bend points with source and target [message #1403617 is a reply to message #1403263] Thu, 24 July 2014 15:22 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 549
Registered: June 2011
Senior Member
I have used IFigure#translateToRelative() in creating bend point and it seems to work fine however when i move any bend point with zoom!=100% then again bend point's new position is problematic.

I am following code to refresh bendpoints
for (Point p : getBendPoints()) {
figureConstraint.add(new AbsoluteBendpoint(p));
}

should i use RelativeBendpoint instead of AbsoluteBendpoint ?

Can you please explain the problem here?
Re: Moving bend points with source and target [message #1702138 is a reply to message #1403103] Mon, 20 July 2015 09:35 Go to previous message
Sathya Thirumalaisamy is currently offline Sathya ThirumalaisamyFriend
Messages: 1
Registered: July 2015
Junior Member
Hi,

I am also facing similar problem like this,
i.e whenever we try to place an figure in GEF editior say in a scrollable one, the figure is not placed in the pointed location, instead it is placed on the top.
I have tried your code to rectify my issue with few changes, but the thing is you are using swt graphics point but whereas i use 2d geometry point in my project.
Can you kindly provide me some input regarding this issue.


Previous Topic:Vertical alignment of text
Next Topic:How to calculate the cursor Position in a Eclipse graphical editor ??
Goto Forum:
  


Current Time: Sat Sep 05 12:21:18 GMT 2015

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

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