Skip to main content


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 10:47 Go to next message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013
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 09:21]

Report message to a moderator

Re: Connection with given point array [message #1081616 is a reply to message #1080756] Wed, 07 August 2013 13:14 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
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 09:24 Go to previous message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013
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: Sat Apr 20 02:56:42 GMT 2024

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

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

Back to the top