我对这个主题进行了广泛的研究,但没有取得多大成功。我必须指出,我是谷歌地图和 javascript 的真正初学者。我试图在询问方向时删除出现在谷歌地图上的 A 和 B 图标。
我正在为一个很棒的教程中的方向创建自定义布局,但我正在努力从地图本身中删除 A 和 B 符号。当我将头撞在砖墙上时,任何帮助都会受到赞赏。
目前的守则
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
var dirn = new GDirections(map);
//var dirn = new GDirections(map).setOptions( { suppressMarkers: true } );
GEvent.addListener(dirn,"error", function() {
alert("Directions Failed: "+dirn.getStatus().code);
});
dirn.load("from: <% Response.Write homlat %>,<% Response.Write homlng %> to: "+Slat+","+Slongtit+"", {getSteps:true});
function customPanel(map,mapname,dirn,div) {
var html = "";
function waypoint(point, type, address) {
var target = '"' + mapname+".showMapBlowup(new GLatLng("+point.toUrlValue(6)+"))" +'"';
html += '<table style="border: 3px solid silver; margin: 10px 0px; background-color: rgb(238, 238, 238); border-collapse: collapse; color: rgb(0, 0, 0);">';
html += ' <tr style="cursor: pointer;" onclick='+target+'>';
html += ' <td style="padding: 4px 15px 0px 5px; vertical-align: middle; width: 20px;">';
html += ' <img src="http://www.google.com/intl/en_ALL/mapfiles/icon-dd-' +type+ '-trans.png">'
html += type;
html += ' <\/td>';
html += ' <td style="vertical-align: middle; width: 100%;">';
html += address;
html += ' <\/td>';
html += ' <\/tr>';
html += '<\/table>';
}
function routeDistance(dist) {
html += '<div style="text-align: right; padding-bottom: 0.3em;">' + dist + '<\/div>';
}
function detail(point, num, description, dist) {
var target = '"' + mapname+".showMapBlowup(new GLatLng("+point.toUrlValue(6)+"))" +'"';
html += '<table style="margin: 0px; padding: 0px; border-collapse: collapse;">';
html += ' <tr style="cursor: pointer;" onclick='+target+'>';
html += ' <td style="border-top: 1px solid rgb(205, 205, 205); margin: 0px; padding: 0.3em 3px; vertical-align: top; text-align: right;">';
html += ' <a href="javascript:void(0)"> '+num+'. <\/a>';
html += ' <\/td>';
html += ' <td style="border-top: 1px solid rgb(205, 205, 205); margin: 0px; padding: 0.3em 3px; vertical-align: top; width: 100%;">';
html += description;
html += ' <\/td>';
html += ' <td style="border-top: 1px solid rgb(205, 205, 205); margin: 0px; padding: 0.3em 3px 0.3em 0.5em; vertical-align: top; text-align: right;">';
html += dist;
html += ' <\/td>';
html += ' <\/tr>';
html += '<\/table>';
}
function copyright(text) {
html += '<div style="font-size: 0.86em;">' + text + "<\/div>";
}
for (var i=0; i<dirn.getNumRoutes(); i++) {
if (i==0) {
// var type="play";
var type="<img src='map_images/man_image.png'>";
} else {
var type="pause";
}
var route = dirn.getRoute(i);
var geocode = route.getStartGeocode();
var point = route.getStep(0).getLatLng();
waypoint(point, type, addsrch);
routeDistance(route.getDistance().html+" (about "+route.getDuration().html+")");
for (var j=0; j<route.getNumSteps(); j++) {
var step = route.getStep(j);
detail(step.getLatLng(), j+1, step.getDescriptionHtml(), step.getDistance().html);
}
}
var geocode = route.getEndGeocode();
var point = route.getEndLatLng();
waypoint(point, stopIcons[Sicon], Sbuild);
copyright(dirn.getCopyrightsHtml());
div.innerHTML = html;
}
GEvent.addListener(dirn,"load", function() {
setTimeout('customPanel(map,"map",dirn,document.getElementById("path"))', 1);
});
}
我正在使用 Google 地图 API 版本 2.*。非常感谢任何帮助的人。