On Apr 20, 11:34 pm, "[email protected]" <[email protected]>
wrote:
> On Apr 20, 2:04 pm, Steve <[email protected]> wrote:
>
> > I haven't worked with gmaps for about a year now and I am recycling an
> > old script. Maybe it is just getting late but I expected the following
> > to draw a line in steps of 100m but nothing is drawn until the while
> > statement is finished. Why is that?
>
> > function getProfile(marker, endPoint, spoke) {
> > spoke = spoke+1
> > var mark = 0
> > var diskm = dis*1000
> > var start=marker.getPoint();
> > var end=endPoint;
> > var dLat = end.lat()-start.lat();
> > var dLng = end.lng()-start.lng();
> > while(mark < diskm) {
> > var latPoints = start.lat() + dLat*mark/diskm;
> > var lngPoints = start.lng() + dLng*mark/diskm;
> > var point= new GLatLng(latPoints,lngPoints);
>
> > getElevationInter(point.lat(),point.lng());
> > myLine = new GPolyline([marker.getPoint(), point]);
> > map.addOverlay(myLine);
> > window.alert(point) ; //just to slow it down to find
> > problem
>
> > var percentDone=100*mark/diskm;
>
> > var percentDoneFix= percentDone.toFixed(0);
>
> > var text="getting height data for spoke " + spoke + "... " +
> > percentDoneFix + "%";
>
> > document.getElementById('chart').innerHTML = text;
> > mark += 100;
>
> > }
>
> > };
>
> > If you want to see the whole script it is at
>
> http://members.chello.at/stephen.joung/testsite/indexLOSRadar.html
> andhttp://members.chello.at/stephen.joung/testsite/losradar_jslint5.js
>
> > but it is nowhere near ready yet. After clicking the alert box forty
> > times the polylines are drawn, but I imagined that a polyline would be
> > drawn after each click.
>
> > Thanks for any assistance.
> > Steve.
>
> The browser has to do work to display the polyline. The alert stops
> all processing. You have to use a setTimeout to allow the processor
> to do other things.
>
> However, I don't get an alert at the link you provided.
>
> -- Larry
Thanks for the reply. I checked the links and the alert is there in
FireFox and IE6 (IE4Linux), you have to click on the map to set a
marker and then click on the marker. But I noticed something
interesting, after the first forty clicks the lines are drawn but if I
then click on the map to set another marker and then click on that
marker everything works like I thought it would. That is after each
alert the line increases by 100m. It's too late now but I will check
it out tomorrow.
Steve.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---