我正在使用方向服务通过谷歌地图 javascript api 获取方向。问题是我想获得单独的步骤,但让它们成为 mvc 对象的一部分,所以当你点击它们时,它们会在地图上呈现为默认值
directionsDisplay.setDirections(response);
做。一些代码:
var directionsService = new google.maps.DirectionsService();
directionsDisplay.setMap(map);
var request = {
origin : a,
destination : b,
travelMode : google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
//Instead of setting directions to a panel i want to
//set just one to a panel and yet have it link to the
//map like the above does.
}});