Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » zigzag connection shape
zigzag connection shape [message #857145] Thu, 26 April 2012 09:25 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
I need to connect two nodes by a zigzag line...
If the nodes are moved the zigzag line must not be stretched to fill the distance, instead, it must "continue" or a part of it must be repeated to fill the new gap...

Is this supported?

See attachment as an example
Re: zigzag connection shape [message #857349 is a reply to message #857145] Thu, 26 April 2012 13:22 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
That should be possible by hooking into the move feature for your shape.
There you can modify the connection as well and add more bendpoints to it.
So, you should use a FreeformConnection for your connections.

Michael
Re: zigzag connection shape [message #871566 is a reply to message #857349] Mon, 14 May 2012 12:31 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
I tried to use this:

{
FreeFormConnection ffc = peCreateService
					.createFreeFormConnection(getDiagram());
			connection = ffc;
			connection.setStart(addConContext.getSourceAnchor());
			connection.setEnd(addConContext.getTargetAnchor());
			ffc.getBendpoints().addAll(
					calcBendPoints((IAddConnectionContext) context));
			ffc.setActive(false);

			Polyline polyline = gaService.createPlainPolyline(connection);
			polyline.setStyle(StyleUtil.getStyleForEClass(getDiagram()));
}

private Collection<? extends Point> calcBendPoints(
			IAddConnectionContext context) {
		List<Point> points = new ArrayList<Point>();
		IGaService gaService = Graphiti.getGaService();

		int x = 0;
		int y = 0;
		points.add(gaService.createPoint(x + 10, y + 10));
		points.add(gaService.createPoint(x + 20, y + -10));
		points.add(gaService.createPoint(x + 30, y + 10));
		points.add(gaService.createPoint(x + 40, y + -10));
		points.add(gaService.createPoint(x + 50, y + 10));
		points.add(gaService.createPoint(x + 60, y + -10));
		points.add(gaService.createPoint(x + 70, y + 10));
		points.add(gaService.createPoint(x + 80, y + -10));
		points.add(gaService.createPoint(x + 90, y + 10));
		return points;
	}


The x and y of the IAddConnectionContext are both -1, so, how do I get the origin coord of the connection's start?

Re: zigzag connection shape [message #875137 is a reply to message #871566] Tue, 22 May 2012 07:57 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1640
Registered: July 2009
Location: Walldorf, Germany
Senior Member
The source and target anchors (or rather their GAs) should provide the
coordinates.

Michael
Previous Topic:Direct Editing field size
Next Topic:Dynamic locations/points
Goto Forum:
  


Current Time: Sun Dec 21 08:35:47 GMT 2014

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

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