日期:2014-05-16 浏览次数:20494 次
//调用部分
function makeLine() {
for (var i = 0; i <= Array.length - 1; i += 2) {//偶数索引存经度,奇数存维度
var gpsPoint=new BMap.Point(Array[i], Array[i + 1]);
//GPS转百度
BMap.Convertor.translate(gpsPoint,0,translateCallback);
}
}
translateCallback = function (point){
PointArr.push(point);
setTimeout("makepoly()", 1000);
}
function makepoly() {
//大于总数,返回
if(num>=total_num){
return;
}
//第一个点不画线只描点
if(num==0){
//alert(num);
var markergps = new BMap.Marker(PointArr[0]);
map.addOverlay(markergps);
num++;
}
else{
//alert(num);
var polyline = new BMap.Polyline([PointArr[num - 1], PointArr[num]], { strokeColor: "blue", strokeWeight: 3, strokeOpacity: 0.5 }); //定义折线
map.addOverlay(polyline); //添加折线到地图上
var markergps = new BMap.Marker(PointArr[num]);
map.addOverlay(markergps);
num++;
}
}