Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » get the length of an arrow (association connector)
get the length of an arrow (association connector) [message #518911] Fri, 05 March 2010 12:23 Go to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
Hi,

I need the length of arrows that links the objects on the diagram. Is there a way to do that? My background is a scaled image of a map. With the exact scale, I wanted to know the real length of the linkEditPart. The arrows are drowned in the "Manhattan" mode.

Thanks,
Daniele
refresh the length of an arrow (association connector) [message #519796 is a reply to message #518911] Wed, 10 March 2010 01:32 Go to previous message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
ok, i calculate the lenght of an arrow in this way (this=linkEditPart)


Quote:
double length = 0;
PointList punti = this.getPrimaryShape().getPolygonPoints();
for (int i = 0; i < punti.size()-1; i++)
{length = length + (punti.getPoint(i).getDistanceOrthogonal(punti.getPoint(i+1) ));
// 28 pixel = 1 cm.
}
length = (length/28);
int temp = (int)(length*10);
length = (temp/10.0);
return (length);



I put the length returned in the label of the connection.
Where should I put this code, so that when I resize the arrow, its length is immediatly updated ?

[Updated on: Wed, 10 March 2010 01:34]

Report message to a moderator

Previous Topic:keep connections consistent
Next Topic:Starting nested Command from ViewProvider
Goto Forum:
  


Current Time: Wed Apr 24 15:00:29 GMT 2024

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

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

Back to the top