Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Getting a Polyline's endpoints without a visual refresh
Getting a Polyline's endpoints without a visual refresh [message #188523] Wed, 20 July 2005 23:59
Emerson Murphy-Hill is currently offline Emerson Murphy-HillFriend
Messages: 22
Registered: July 2009
Junior Member
I am trying to make my connections animate, which seems to be going
smoothly, except for one small problem. My intent is that when a
connection is first made visible, it will be drawn from source to target
in small steps (as if you were drawing it with a pencil).

However, just before the animation begins, the whole line flashes on the
screen. For the visual among us, at each step it is drawn like so:

-----
-
--
---
----
-----

The code:

public static void connect(PolylineConnection connection,
int iterations,
int stepMilliSeconds) {

//dilemma here...
connection.getUpdateManager().performUpdate();

// backup
Point trueEndPoint = connection.getEnd();
Point trueStartPoint = connection.getStart();

connection.setVisible(true);

//animate!
for (double count = 0; count < 1;
count = count + 1.0 / iterations) {

Point newEndPoint = trueEndPoint.getCopy().translate(
trueStartPoint.getCopy().negate());

newEndPoint.scale(count);
newEndPoint.translate(trueStartPoint);

connection.setEnd(newEndPoint);

connection.getUpdateManager().performUpdate();

sleep(stepMilliSeconds);
}

// restore
connection.setEnd(trueEndPoint);
connection.getUpdateManager().performUpdate();
}


The problem can be corrected if I remove the line marked "dilemma," but
I will not get the correct start and end points on the next two lines.
I have tried validate(), but the start and endpoints are relative to
thier parents, not absolute as they are after performUpdate(). Updating
the figure seems to be the only way to go.

So the question is: how do I either hide the first draw, or get the
absolute endpoints without updating?

Thanks!

e
Previous Topic:Modifying GEF examples
Next Topic:Gradient
Goto Forum:
  


Current Time: Thu Dec 12 17:18:39 GMT 2024

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

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

Back to the top