Commit 08669180 authored by 黄奎's avatar 黄奎

页面修改

parent c0b56598
......@@ -157,7 +157,7 @@
var nextItem = waypoints[i + 1];
if (currentItem && currentItem.trafficType == 4) {
this.drawWalkRoute(currentItem.location, nextItem.location);
this.addMarker(currentItem, i+1),
this.addMarker(currentItem, i + 1),
this.addMarker(nextItem, i + 2);
} else {
var newArray = [];
......@@ -174,7 +174,7 @@
var form_loc = array[i].location.split(',');
var path = this.polyline.getPath(); //获取线条的坐标
path.push(new google.maps.LatLng(form_loc[0], form_loc[1])); //为线条添加标记坐标
this.addMarker(array[i], i+1);
this.addMarker(array[i], i + 1);
}
},
addMarker(obj, title) {
......@@ -268,6 +268,21 @@
renderer.setMap(null);
}
});
},
//计算两点之间的距离
CalcDistance(sX, sY, eX, eY) {
var lat = [sX, eX]
var lng = [sY, sY] //var R = 6371; // km (change this constant to get miles)
var R = 6378137; //地球半径
var dLat = (lat[1] - lat[0]) * Math.PI / 180;
var dLng = (lng[1] - lng[0]) * Math.PI / 180;
var dLat1 = lat[0] * Math.PI / 180;
var dLat2 = lat[1] * Math.PI / 180;
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(dLat1) * Math.cos(dLat1) * Math.sin(dLng /
2) * Math.sin(dLng / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return Math.round(d);
}
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment