Skip to main content



      Home
Home » Modeling » Graphiti » zigzag connection shape
zigzag connection shape [message #857145] Thu, 26 April 2012 05:25 Go to next message
Eclipse UserFriend
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 09:22 Go to previous messageGo to next message
Eclipse UserFriend
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 08:31 Go to previous messageGo to next message
Eclipse UserFriend
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 03:57 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 07:58:55 EDT 2025

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

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

Back to the top