zigzag connection shape [message #857145] |
Thu, 26 April 2012 05:25  |
Eclipse User |
|
|
|
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 #871566 is a reply to message #857349] |
Mon, 14 May 2012 08:31   |
Eclipse User |
|
|
|
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?
|
|
|
|
Powered by
FUDForum. Page generated in 0.04158 seconds