Skip to main content



      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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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
Eclipse UserFriend
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: Thu Jul 17 09:57:36 EDT 2025

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

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

Back to the top