Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Moving shapes and bendpoints
Moving shapes and bendpoints [message #1060858] Tue, 28 May 2013 16:54 Go to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
In the current implementation DefaultMoveShapeFeature moves also the bendpoints of those FreeFormConnections that originate from the current moving shape and terminates in another selected shape (and hence is presumably part of the same movement).

This seems quite ugly to me, on several levels:
- it couples the DefaultMoveShapeFeature to a particular connections implementation
- it must resort to an ugly hack to guess if that connection is to be "moved", asking, (inside a MoveShapeFeature) the editor for its current selected shapes so as to guess the full set of shapes that are being moved
- the related utility methods are private, so it's difficult to alter the behaviour by overriding
- the bendpoints movement is done directly, not via the MoveBendpointsFeature - so, if (as it was my case) we have the connections with its bendpoints as part of the bussiness model, and relied on MoveBendpointsFeature to keep that in sync, we are rather screwed

I call the attention to this issue, in case the Graphiti developers (supposing they agree) can think on something better - I'm not sure if this has some simple solution. In retrospect, I think it would have been more convenient to specify BendPoints in relative coordinates, with respect to the connection start, but I guess it's too late to change this.

[Updated on: Tue, 28 May 2013 16:57]

Report message to a moderator

Re: Moving shapes and bendpoints [message #1060863 is a reply to message #1060858] Tue, 28 May 2013 18:10 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
A related observation:

Both MOVE and RESIZE features are single oriented, they work one shape at a time. The upper/internal Graphiti layer is the only who knows if several shapes are being moved/resized (for example, canMove() is called for each shape separatedly, and when the upper layer get a "no" for one of the shapes, and only then, the movement is disabled). This is rather a limitation (and the above is an example), because sometimes one wants to change the behaviour (or the enablement-disablement) according to some "global" criteria: for example, allow only to resize one shape at a time.

Perhaps the ResizeShapeContext could add some "global" context info, eg the total list of shapes involved?

[Updated on: Tue, 28 May 2013 18:16]

Report message to a moderator

Re: Moving shapes and bendpoints [message #1060885 is a reply to message #1060858] Tue, 28 May 2013 20:31 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
BTW: I noticed this in DefaultMoveShapeFeature:

Point point = points.get(i);
 int oldX = point.getX();
 int oldY = point.getY();
 points.set(i, Graphiti.getGaCreateService().createPoint(oldX + deltaX, oldY + deltaY));


I wonder why it's necessary to recreate the point, instead of simply changing its coordinates?

 point.setX(oldX+deltaX);
 point.setY(oldY+deltaY);

Re: Moving shapes and bendpoints [message #1060933 is a reply to message #1060858] Wed, 29 May 2013 08:28 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hernan,

these are valid points and we should have a look into those issue,
especially your 3rd and 4th point. Would you file a Bugzilla to track this?

Changing the bendpoint coordinates to be relative would have solved this
from the beginning, but I also think that it's too late for changing this
(might be an option for new connection types though).

Michael
Re: Moving shapes and bendpoints [message #1061262 is a reply to message #1060858] Thu, 30 May 2013 20:46 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 181
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Thinking more about it, there seems to be a bunch of problems related to the "local" nature of Graphiti features: Move, Resize, Delete, etc, always deal with single PE, while actually the action involves a group of selected PEs. The makes too difficult to take actions that are related to the whole, be during, before ("canExecute") or after the action. See for example here, how difficult it gets to forbid a group movement that produces overlapping.

I wonder: Wouldn't it be convenient to add group corresponding features, for example a "MoveShapesFeature" which gets, in its context, all the affect PE, and that, in the default implementation, just calls a "MoveShapeFeature" one by one (same about its canExecute() method )? This seems to be backwards compatible, and could lead to a more clean implementation of the current "move bendpoints of FreeFormConnections if both ends correspond to moved shapes" function, and would allow for better extensibility.

[Updated on: Thu, 30 May 2013 20:48]

Report message to a moderator

Re: Moving shapes and bendpoints [message #1061837 is a reply to message #1061262] Tue, 04 June 2013 10:20 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hernan,

that sounds like a really good idea and would really helpt to ease those
scenarios. Would you please file that as an enhancement Bugzilla?

Thanks,
Michael
Re: Moving shapes and bendpoints [message #1070763 is a reply to message #1061837] Thu, 18 July 2013 15:55 Go to previous messageGo to next message
anudeep arya is currently offline anudeep aryaFriend
Messages: 36
Registered: March 2013
Member
Hi Hernan and hello michael,

I want to know if it possible to perform the action pointed by hernen(below) now .If so can you please guide me in the direction of how to proceed
the bendpoints movement is done directly, not via the MoveBendpointsFeature - so, if (as it was my case) we have the connections with its bendpoints as part of the bussiness model, and relied on MoveBendpointsFeature to keep that in sync, we are rather screwed

Regards,
Anudeep
Re: Moving shapes and bendpoints [message #1073271 is a reply to message #1070763] Wed, 24 July 2013 12:47 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Anudep,

not sure if that is your point, but you can of course adapt the bendpoints
from any of your features, like move shape feature or update features; it's
not restricted to the MoveBendpointsFeature.

Michael
Re: Moving shapes and bendpoints [message #1075276 is a reply to message #1073271] Mon, 29 July 2013 07:02 Go to previous messageGo to next message
anudeep arya is currently offline anudeep aryaFriend
Messages: 36
Registered: March 2013
Member
Hi Michael,

Thanks for the response,I have implemented it in Update Feature and it is working fine.but It doesn't work in the Move Shape Feature..I couldn't Figure Out the reason for this one.


Regards,
Anudeep
Re: Moving shapes and bendpoints [message #1075351 is a reply to message #1075276] Mon, 29 July 2013 09:12 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Anudeep,

can you provide more details on the issue in move?

Michael
Re: Moving shapes and bendpoints [message #1075920 is a reply to message #1075351] Tue, 30 July 2013 10:26 Go to previous messageGo to next message
anudeep arya is currently offline anudeep aryaFriend
Messages: 36
Registered: March 2013
Member
Hi Michael,

In My case,
I have a Diagram and i am saving the diagram Information in a model.i want my model to be updated as soon as i move a Connection(Create a bendPoint)(NOT ON SAVE).I can't do it When i move a connection in getMoveShapeFeature method as my debug pointer doesn't go inside this when i try to move a connection..It goes to getMoveBendpoint method but my context object connection is null to change my model here.Hope you got the Problem..
Please Revert Back for any Clarifications. Smile
Regards,
Anudeep
Re: Moving shapes and bendpoints [message #1077928 is a reply to message #1075920] Fri, 02 August 2013 10:24 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Anudeep,

this appears to be a bug, please file a Bugzilla for this and provide the
stack trace for the call to getMoveBendpointFeature().

Michael
Previous Topic:Manhattan Connection routing
Next Topic:Problem with MultiText in Graphiti
Goto Forum:
  


Current Time: Thu Nov 27 06:59:17 GMT 2014

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

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