Length of PolylineConnection ? [message #161740] |
Thu, 16 December 2004 13:48 |
Eclipse User |
|
|
|
Originally posted by: ssc.acentic.net
Hi
How do I get the length of the connection line ?
PolylineConnection c = new PolylineConnection();
ChopboxAnchor sourceAnchor = new ChopboxAnchor(f1);
ChopboxAnchor targetAnchor = new ChopboxAnchor(f2);
c.setSourceAnchor(sourceAnchor);
c.setTargetAnchor(targetAnchor);
System.out.println("lenght ? : " + c.getSize() ); // <-- problem,
getSize is not correct
-Sebastian
|
|
|
|
Re: Length of PolylineConnection ? [message #161883 is a reply to message #161844] |
Fri, 17 December 2004 08:39 |
Eclipse User |
|
|
|
Originally posted by: ssc.acentic.net
Well, I have no problem calculating anything to get the length, but my
problem here is that I do not have any start or end point.
How would I get the sourceAnchor coordinates ?
|
|
|
Re: Length of PolylineConnection ? [message #161923 is a reply to message #161883] |
Fri, 17 December 2004 15:03 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
The endpoints get set when a layout occurs. The connection does not move
immediately when you call setSourceAnchor, etc. What are you trying to do?
"Sebastian Scholz" <ssc@acentic.net> wrote in message
news:cpu5vo$nah$1@www.eclipse.org...
> Well, I have no problem calculating anything to get the length, but my
> problem here is that I do not have any start or end point.
>
> How would I get the sourceAnchor coordinates ?
>
>
>
|
|
|
Re: Length of PolylineConnection ? [message #162147 is a reply to message #161923] |
Mon, 20 December 2004 07:24 |
Eclipse User |
|
|
|
Originally posted by: ssc.acentic.net
Well, basically I want to do 2 things :
1. I want to create a more dynamic method to add a line between 2 Figures
to add a Label in the exact middle and
2. I want to make the Figures dragable (which I was not able to achieve
yet) and update the line between it.
From my understanding I need 2 things, the coordinates of a start and a
end point of the line to know whats between it. Right now I have a very
dirty solution, take the starting point of Figure 1, get the size, get the
middle point of the closest line to the next Figure,... do the same with
the Figure 2 and then calculate the distance between the 2 poings, BUT I
kinda thought since the line is drawn by this "PolylineConnection" it
should knows these 2 points.
|
|
|
Powered by
FUDForum. Page generated in 0.02893 seconds