Friday, October 29, 2010

Re: Route animation in google maps with GWT

Hi B,

Thanks for your answers.

I tried it like this:

In the class shipAnimation in the method onSuccess(), which is called
after successful rpc callback, i wrote the following code:

LatLng[] animationPoints = new LatLng[1];
animationPoints[0]=start;
Polyline animatedWay = new Polyline(animationPoints,
getPolylineColor(), polylineWidth, 1);
map.addOverlay(animatedWay);
ShipAnimationTimer timer = new ShipAnimationTimer(animatedWay,
gpsDataLatLng, map);
timer.schedule(30);

The variable start is the first point of the polyline

In the class ShipAnimationTimer, which extends the gwt timer, i wrote
the following code:

public void run() {
animatedWay.insertVertex(counter, gpsDataLatLng[counter]);
counter++;
if(counter==gpsDataLatLng.length){
this.cancel();
}
}

So far so good, but when i try to run my app, nothing happens. That
means, start and endmarker of the polyline are coming, but not the
polyline..

Do you see an error?

Thanks for your help.

Jan

On 29 Okt., 14:00, Blagoja Chavkoski <baze...@gmail.com> wrote:
> I just want to say that for the statment (and no way that can be done) im
> wrong :) there is a GWT gear lib witch start multiple threads in a browser
> but this is totally diff then what is a real thread in a programming
> language :) but in any case it has the same mining..
>
> On Fri, Oct 29, 2010 at 1:56 PM, Blagoja Chavkoski <baze...@gmail.com>wrote:
>
> > hi,
>
> > This is the scenario u need to do..I implement this in a program used for a
> > vehicle tracking...
>
> > 1. get all the data u need to animate(all LatlLon positions) and store them
> > in a arraylist
>
> > 2. start one timer (gwt timer ) let me say witch will fire on every 100ms
> > (U have to test what will be the real time, dependes on the
> > power of the browser, for IE i had the biggest and foer opera and chrome
> > and safari the lowest, they have the best JS engins)
>
> > 3.when the timer fires the event(u take by some logic couple of the Lotlng
> > (3-4) from the list, and till the next firing of the timer u make a paint of
> > this positions)
>
> > 4. the timer pasts 100ms and fires again (by this time u have finished with
> > the paitn of the first 3-4 Latlon) so you move again to point (3) when the
> > timer fires again (4) you soposed to be finished with (3) and u move again
> > to (3) and u do this move (3)-(4)-(3) while the list is not empty..when the
> > list is empty u just terminate(stop) the timer...
>
> > This is the scenario...u have to make a testing on the timing for sleep of
> > the timer...(when new event is fired for the timer, u have to be finished
> > with show of the latlon-s, what i want to say is that the combination of
> > timer fire time and the number of the events u take is something u need to
> > calculate by performanse(on what u do with the positions and how much time
> > takes to handle this)
>
> > Hope I help,
>
> > Regards from Germany:)
> > B
>
> > p.s u cant use thread sleep and so on...because u dont have threds in the
> > browser side..browser screepts(JS, FLEX, FLESH, SILVERLITE) are single
> > thread so there is no logic(and no way that can be done) for GWT to emulate
> > this libs.
>
> > On Fri, Oct 29, 2010 at 1:08 PM, Jan <jan.widm...@gmx.ch> wrote:
>
> >> Hi Brian,
>
> >> Thanks for your answer. I tried some things with the array and timer
> >> and that staff. I tried with wait(), sleep() and also with a timer
> >> object. But everytime, there comes an error, that these things are not
> >> supported by gwt..
>
> >> The easiest way would be to have the normal callback, which gets the
> >> latlng array. Then in the "onSuccess()" Method changing the marker
> >> positions with a for loop and a delay. I tried that, but i couldn't
> >> find a possibility to make this delay
>
> >> Is it possible to do that like that, or do i have to make already the
> >> callback with the delay? Does that mean, that i have to make two
> >> callbacks, one which gets the array and the secon in a for loop?
>
> >> Thanks and best regards from switzerland.
>
> >> Jan
>
> >> On 11 Okt., 18:04, Brian <hibr...@gmail.com> wrote:
> >> > GWT is Javascript, at least what the user sees on the website.
>
> >> > One idea, is to get all the data from your server for a ship's route
> >> > as an array of lat/lng objects, then set up a Timer() object that
> >> > calls your callback  every 30ms or so, and you just set the map marker
> >> > position to the next entry in the lat/lng pair.  For faster animation,
> >> > jump further in your array, or decrease the 30ms to 15ms, etc.
>
> >> > On Oct 9, 8:53 am, Jan <jan.widm...@gmx.ch> wrote:
>
> >> > > Hi all,
>
> >> > > For an actual project, we need to evaluate movements of motor-ships.
> >> > > The position datas are sent from a gps router on the ships and are
> >> > > saved in a database on our server. One of our goals is to show the
> >> > > driven way of one or more ships between a specified time as an
> >> > > animation. Our Application is written in Java with GWT. What we have
> >> > > already is, that the driven way get's drafted like a normal route in
> >> > > google maps. What we want is, to show for example all ship movements
> >> > > for one day in fast motion.
>
> >> > > My actual problem is, how to animate the driven way. Is it possible to
> >> > > do the animation in GWT, or do we need to use javascript?
>
> >> > > I hope, someone can give me some ideas.
>
> >> > > Thanks a lot.
>
> >> > > Jan
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google Web Toolkit" group.
> >> To post to this group, send email to google-web-toolkit@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment