私はこのサンプル コードを使用していますが、次の部分が何をするのか、どこから来たのかについて混乱しています。(\'red\')
onclick またはそのいずれかの部分がわかりません+ file +
。createNetworkLink
これを自分の tester.kmlに変更して使用しようとしています。変える+ file +
と壊れます。
var currentKmlObjects = {
'red': null,
};
addSampleUIHtml(
'<h2>Toggle KML Files:</h2>' +
'<input type="checkbox" id="kml-red-check" onclick="toggleKml(\'red\');"/><label for="kml-red-check">Red Placemarks</label><br/>'
);
function loadKml(file) {
var kmlUrl = 'http://earth-api-samples.googlecode.com/svn/trunk/' +
'examples/static/' + file + '.kml';
// fetch the KML
google.earth.fetchKml(ge, kmlUrl, function(kmlObject) {
// NOTE: we still have access to the 'file' variable (via JS closures)
if (kmlObject) {
// show it on Earth
currentKmlObjects[file] = kmlObject;
ge.getFeatures().appendChild(kmlObject);
} else {
// bad KML
currentKmlObjects[file] = null;