marker = new GMarker(map.getCenter(),{dragCrossMove:false,draggable:true,title:"增加标记"}); map.addOverlay(marker);
删除标记:
map.clearOverlays();
theron 留言(2010年8月25日 03:14 ):
请教,使用v3怎么实现多tab的infowindow?
张映 留言(2010年8月25日 07:31 ):
function createTabbedMarker(point,htmls,labels) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
// adjust the width so that the info window is large enough for this many tabs
if (htmls.length > 2) {
htmls[0] = '' + htmls[0] + '';
}
var tabs = [];
for (var i=0; i<htmls.length; i++) {
tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
}
marker.openInfoWindowTabsHtml(tabs);
});
return marker;
}
var point = new GLatLng(31.22572,-79.8);
var marker = createTabbedMarker(point, ["Tab 1", "Tab 2","Tab 3","Tab 4"],["One","Two","Three","Four"]);
map.addOverlay(marker);
var map;
var markersArray = [];
var f_CrystalBall_a;
var f_CrystalBall_b;
function initialize() {
var haightAshbury = new google.maps.LatLng(23.760796,120.987731);
var mapOptions = {
zoom: 7,
center: haightAshbury,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
function failureCB(object) {
alert('load failed');
}
function go(lat,lon,alt,heading,tilt,range){
var la = ge.createLookAt('');
la.set(lat, lon, alt, ge.ALTITUDE_RELATIVE_TO_GROUND, heading,tilt,range);
ge.getView().setAbstractView(la);
}
function getNL(kmlURL){
var nl = ge.createNetworkLink("");
var link = ge.createLink("");
link.setHref(kmlURL);
nl.setLink(link);
ge.getGlobe().getFeatures().appendChild(nl);
return nl;
}
function gebid(e) { return document.getElementById(e); }
function toggleOptions() {
var options = ge.getOptions();
var root = ge.getLayerRoot();
var form = gebid("options");
f_CrystalBall_a.setVisibility(form.crystal_a.checked);
f_CrystalBall_c.setVisibility(form.crystal_c.checked);
添加标记:
marker = new GMarker(map.getCenter(),{dragCrossMove:false,draggable:true,title:"增加标记"}); map.addOverlay(marker);
删除标记:
map.clearOverlays();
请教,使用v3怎么实现多tab的infowindow?
function createTabbedMarker(point,htmls,labels) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
// adjust the width so that the info window is large enough for this many tabs
if (htmls.length > 2) {
htmls[0] = '' + htmls[0] + '';
}
var tabs = [];
for (var i=0; i<htmls.length; i++) {
tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
}
marker.openInfoWindowTabsHtml(tabs);
});
return marker;
}
var point = new GLatLng(31.22572,-79.8);
var marker = createTabbedMarker(point, ["Tab 1", "Tab 2","Tab 3","Tab 4"],["One","Two","Three","Four"]);
map.addOverlay(marker);
不是说V3嘛 怎么还是给V2的方法~~~
版主你好:
我用API v3做一個按鍵的程式,可是按下去不會顯示我要的東西
可否請版主幫忙!!~謝謝
玉寶之地
var map;
var markersArray = [];
var f_CrystalBall_a;
var f_CrystalBall_b;
function initialize() {
var haightAshbury = new google.maps.LatLng(23.760796,120.987731);
var mapOptions = {
zoom: 7,
center: haightAshbury,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
google.maps.event.addListener(map, 'click', function(event) {
addMarker(event.latLng);
});
}
function initCB(object) {
ge = object;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
//ge.enableLayerById(ge.LAYER_TERRAIN, true);
ge.getOptions().setAtmosphereVisibility(true);
f_CrystalBall_a = getNL('http://gemvg.com/ge/kml/imagery/resolution.kml');
f_CrystalBall_b = getNL('http://gemvg.com/ge/overlay/Map.kml');
toggleOptions();
go(23.5832, 120.5825, 0,0,0,500000);
}
function failureCB(object) {
alert('load failed');
}
function go(lat,lon,alt,heading,tilt,range){
var la = ge.createLookAt('');
la.set(lat, lon, alt, ge.ALTITUDE_RELATIVE_TO_GROUND, heading,tilt,range);
ge.getView().setAbstractView(la);
}
function getNL(kmlURL){
var nl = ge.createNetworkLink("");
var link = ge.createLink("");
link.setHref(kmlURL);
nl.setLink(link);
ge.getGlobe().getFeatures().appendChild(nl);
return nl;
}
function gebid(e) { return document.getElementById(e); }
function toggleOptions() {
var options = ge.getOptions();
var root = ge.getLayerRoot();
var form = gebid("options");
f_CrystalBall_a.setVisibility(form.crystal_a.checked);
f_CrystalBall_c.setVisibility(form.crystal_c.checked);
}
GOOGLE EARTH與GOOGLE MAP導覽
按鍵01
按鍵02