|
|
Re: connection decorator rotation on move [message #855496 is a reply to message #853630] |
Tue, 24 April 2012 21:54 |
Josef Pohl Messages: 82 Registered: January 2012 |
Member |
|
|
Hi Matthias,
Sorry it has taken me a bit to get back to this.
Here is the code snippet for creating the arrow head:
private Polyline createArrow(GraphicsAlgorithmContainer gaContainer) {
IGaService gaService = Graphiti.getGaService();
Polygon polygon =
gaService.createPolygon(gaContainer, new int[] { -15, 10, 1, 0, -15,
-10 });
polygon.setForeground(manageColor(IColorConstant.BLACK));
polygon.setBackground(manageColor(IColorConstant.BLACK));
polygon.setLineWidth(2);
polygon.setFilled(true);
return polygon;
}
It is called from:
public PictogramElement add(IAddContext context) {
IAddConnectionContext addConContext = (IAddConnectionContext) context;
IsSolvedBy addedIsSolvedBy = (IsSolvedBy) context.getNewObject();
IPeCreateService peCreateService = Graphiti.getPeCreateService();
Connection connection = peCreateService
.createFreeFormConnection(getDiagram());
connection.setStart(addConContext.getSourceAnchor());
connection.setEnd(addConContext.getTargetAnchor());
IGaService gaService = Graphiti.getGaService();
Polyline polyline = gaService.createPolyline(connection);
polyline.setLineWidth(2);
polyline.setForeground(manageColor(IColorConstant.BLACK));
link(connection, addedIsSolvedBy);
ConnectionDecorator cd;
cd = peCreateService
.createConnectionDecorator(connection, false, 1.0, true);
createArrow(cd);
return connection;
}
Here are the images you requested.
The straight instance:
The crooked version. This was a user reported issue and I still cannot, completely, convince myself that it is not just my eyes playing tricks on me. But I don't drink at work...
Thanks for all your help,
Joe
-
Attachment: straight.png
(Size: 10.77KB, Downloaded 900 times) -
Attachment: crooked.png
(Size: 9.67KB, Downloaded 877 times)
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02868 seconds