Routing of connections [message #516362] |
Tue, 23 February 2010 17:43 |
Ben Wecker Messages: 4 Registered: February 2010 |
Junior Member |
|
|
I had based my editor on the Shapes Editor tutorial (http:// www.eclipse.org/articles/Article-GEF-diagram-editor/shape.ht ml). What made it especially interesting for me was that, when a new model element was set so that the connection would intersect with an exisiting model element, the connection would automatically be re-routed around the existing model element. In the next step for my editor I wanted to implement my own layouting algorithm for the connections. Now I realized that even the "move-around-model-elements" layouting is not working anymore since I added a new element in the hierarchy between the diagram and the shapes. So I have now the hierarchy Diagram->Root->Shape. I could not find how to restore the initial behaviour for connections nor could I implement a custom layouting. For what I have understood from some tutorials that I read, this has to do with Layout Managers. Both, the diagram figure and the root figure use a FreeformLayout as Layout Manager. However, I could not find how the FreeformLayout is related to re-rerouting the connections. To make it clearer what I mean with re-routing: before new connections looked like this: http://yfrog.com/1q62629423p
and now I get this result:
http://yfrog.com/jb45551815p
How can I first restore the original behaviour and second implement a custom routing behaviour?
[Updated on: Tue, 23 February 2010 17:43] Report message to a moderator
|
|
|
Re: Routing of connections [message #516455 is a reply to message #516362] |
Wed, 24 February 2010 04:33 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
Routing is done by routers which are set in the root figure...
In shapes DiagramEditpart class
/* (non-Javadoc)
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
protected IFigure createFigure() {
Figure f = new FreeformLayer();
f.setBorder(new MarginBorder(3));
f.setLayoutManager(new FreeformLayout());
// Create the static router for the connection layer
>ConnectionLayer connLayer =
>(ConnectionLayer)getLayer
>(LayerConstants.CONNECTION_LAYER);
> connLayer.setConnectionRouter(new >ShortestPathConnectionRouter(f));
return f;
}
may be what you added has negated that router setting..
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
[Updated on: Wed, 24 February 2010 04:40] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02711 seconds