Skip to main content

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 RandoFriend
Messages: 1
Registered: June 2013
Junior Member
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());

	IGaService gaService = Graphiti.getGaService();
	Polyline polyline = gaService.createPolyline(connection);
	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: Fri Jun 18 04:14:32 GMT 2021

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

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

Back to the top