On Nov 29, 9:47 am, evgen25rus <[EMAIL PROTECTED]> wrote:
> Почему в Opera 9.60 неверно отображается трек созданный вот таким
> кодом?:
>
> var points = new Array();
> var point;
>
> var LatArr = xmlRoot.getElementsByTagName("lat");
> var LonArr = xmlRoot.getElementsByTagName("lon");
> for (var i=0;i<LatArr.length;i++){
> var _lat = LatArr.item(i).firstChild.data;
> var _lon = LonArr.item(i).firstChild.data;
> if ((_lat==0) || (_lon==0)){
> continue;
> }
>
> point = new GLatLng(_lat, _lon);
> points.push(point);
> }
> polyline = new GPolyline(points, "#ff0000", 2, 0.8);
> map.addOverlay(polyline);
Using an array of (new GLatLng()) objects to build GPolys is very
slow. Using "push()" is also slow compared to direct access to the
array. Using "parseFloat(whatever)" can be avoided too.
Try:
var poly=[];
for (var i=0;LatArr[i]&LonArr[i];i++)
{
poly[i]={x:LonArr[i].childNodes[0].data-0,y:LatArr
[i].childNodes[0].data-0};
}
If "whatever" is a string, "whatever-0" will convert it to a number.
If "whatever" is already a number, "whatever-0" will do nothing.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---