有什么问题?他说没有找到游览,但我检查了包含我的游览的变量游览 kml 文件。你能帮我吗?
var ge;
var la;
var tour = null;
var placemark;
google.load("earth", "1");
var control = 1;
var href;
function init() {
google.earth.createInstance('map3d', initCallback, failureCallback);
}
function initCallback(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
// IMPORTAZIONE FILE KML REGIONI
var url = 'http://web.uniparthenope.it/~0124000489/tw-2013/place.kml';
google.earth.fetchKml(ge, url, finished);
// ZOOM ITALIA
look();
// add a navigation control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// DISABILITO I LAYERS
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, false);
ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, false);
// CARICO IL TOUR DELLA CAMPANIA
href = 'http://web.uniparthenope.it/~0124000489/tw-2013/campania.kml';
google.earth.fetchKml(ge, href, function (kmlObject) {
if (!kmlObject) {
// wrap alerts in API callbacks and event handlers
// in a setTimeout to prevent deadlock in some browsers
setTimeout(function () {
alert('Bad or null KML.');
}, 0);
return;
}
// Show the entire KML file in the plugin.
ge.getFeatures().appendChild(kmlObject);
// Walk the DOM looking for a KmlTour
walkKmlDom(kmlObject, function () {
if (this.getType() == 'KmlTour') {
tour = this;
return false;
}
});
});
// ATTENDO UN EVENTO
google.earth.addEventListener(ge.getWindow(), 'click', function (e) {
// VERIFICO SE E' STATO CLICCATO UN PLACEMARK
var target = e.getTarget();
if (target.getType() == 'KmlPlacemark') {
//CANCELLO L'AZIONE DI DEFAULT
e.preventDefault();
// ESEGUO IL TOUR
playTour();
}
});
document.getElementById('installed-plugin-version').innerHTML =
ge.getPluginVersion().toString();
}
function failureCallback(errorCode) {}
function playTour() {
if (control == 1) {
addSampleButton('Exit Tour', exitTour);
control++;
}
if (!tour) {
alert('No tour found!');
return;
}
ge.getTourPlayer().setTour(tour);
ge.getTourPlayer().play();
}
function exitTour() {
ge.getTourPlayer().setTour(null);
look();
}
function look() {
var la = ge.createLookAt('');
la.set(42.5, 12.5,
0, // altitude
ge.ALTITUDE_RELATIVE_TO_GROUND,
0, // heading
0, // straight-down tilt
1500000 // range (inverse of zoom)
);
ge.getView().setAbstractView(la);
}
function finished(object) {
if (!object) {
// wrap alerts in API callbacks and event handlers
// in a setTimeout to prevent deadlock in some browsers
setTimeout(function () {
alert('Bad or null KML.');
}, 0);
return;
}
ge.getFeatures().appendChild(object);
}