我正在嘗試使用DirectionsRenderer來顯示沒有路由列表的DirectionsResult。根據API版本3文檔,DirectionsRendererOptions對象的「hideRouteList」屬性設置爲true時應隱藏路由列表。我無法讓它工作。這是一個錯誤還是我只是沒有正確編碼?以下是我的代碼。谷歌地圖API DirectionsRendererOptions不工作?
<html>
<head>
<title>Driving Directions</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
<script type="text/javascript">
<!--
function initialize() {
var dirService = new google.maps.DirectionsService();
var dirRequest = {
origin: "350 5th Ave, New York, NY, 10118",
destination: "1 Wall St, New York, NY",
travelMode: google.maps.DirectionsTravelMode.DRIVING,
unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL,
provideTripAlternatives: true
};
dirService.route(dirRequest, showDirections);
}
function showDirections(dirResult, dirStatus) {
if (dirStatus != google.maps.DirectionsStatus.OK) {
alert('Directions failed: ' + dirStatus);
return;
}
var rendererOptions = {
hideRouteList: true
};
var dirRenderer = new google.maps.DirectionsRenderer(rendererOptions);
dirRenderer.setPanel(document.getElementById('dir-container'));
dirRenderer.setDirections(dirResult);
}
-->
</script>
</head>
<body onLoad="initialize();">
<div id="dir-container"></div>
</body>
</html>
在這裏登錄了一個問題 - > http://code.google.com/p/gmaps-api-issues/issues/detail?id=2247 – RedBlueThing 2010-03-17 23:49:31