Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Text rotation on connection
Text rotation on connection [message #1064532] Wed, 19 June 2013 17:57
Stefano Rando is currently offline Stefano Rando
Messages: 1
Registered: June 2013
Junior Member
Hello,
I need to decorate a connection with a text, but the text should be parallel to the connection (or the first part of the connection).
Basically I would like to calculate the angle of the connection (or polyline) in the first point and then apply it to text, but I do not know how to do.

you have any suggestions?

Thank you.

Here's the code
public PictogramElement add(IAddContext context) {
	IAddConnectionContext addConContext = (IAddConnectionContext) context;
	EReference addedEReference = (EReference) 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(E_REFERENCE_FOREGROUND));
	link(connection, addedEReference);

	ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.1, true);
	Text text = gaService.createDefaultText(getDiagram(), textDecorator);
	int textAngle = ???????;
	text.setAngle(textAngle );

....
...
....
}
Previous Topic:connection decorator rotation on move
Next Topic:Graphiti and CDO integration
Goto Forum:
  


Current Time: Sun Oct 26 05:15:47 GMT 2014

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

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