Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Connection with given point array
Connection with given point array [message #1080756] Tue, 06 August 2013 06:47 Go to next message
John Cole is currently offline John Cole
Messages: 21
Registered: June 2013
Junior Member
Hello everyone,

I am trying to add a connection, which runs through some predefined points, which are stored in an array.

So actually I am trying to do this in the AddConnectionFeature. My code looks like this:

@Override
public PictogramElement add(IAddContext context, int[] points) {
	IAddConnectionContext addConContext = (IAddConnectionContext) context;
	IPeCreateService peCreateService = Graphiti.getPeCreateService();
	IGaService gaService = Graphiti.getGaService();

	ConnectClause clause = (ConnectClause) context.getNewObject();
	
	Connection connection = peCreateService.createFreeFormConnection((Diagram) context.getTargetContainer());
	connection.setStart(addConContext.getSourceAnchor());
	connection.setEnd(addConContext.getTargetAnchor());

	Polyline polyline = gaService.createPolyline(connection, points);
	
	polyline.setLineWidth(3);

	return connection;
}


Although I assign the array with the points to the method createPolyline, it has no effect and the break points are not visible.

What am I doing wrong?

Thanks in advance!

[Updated on: Wed, 07 August 2013 05:21]

Report message to a moderator

Re: Connection with given point array [message #1081616 is a reply to message #1080756] Wed, 07 August 2013 09:14 Go to previous messageGo to next message
Robert Brodt is currently offline Robert Brodt
Messages: 542
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

John,

You need to set the bendpoints in the FreeFormConnection using getBendpoints().add(Point) - no need for a Polyline here

HTH,
Bob
Re: Connection with given point array [message #1082234 is a reply to message #1081616] Thu, 08 August 2013 05:24 Go to previous message
John Cole is currently offline John Cole
Messages: 21
Registered: June 2013
Junior Member
Bob,

thank you very much! Now it works!
Previous Topic:Connections inside ContainerShapes
Next Topic:are context buttons available for connections?
Goto Forum:
  


Current Time: Fri Apr 25 02:57:54 EDT 2014

Powered by FUDForum. Page generated in 0.02213 seconds