1

我想使用 Google 地球进行演示。我想从旋转地球开始,然后放大到某个位置。旋转的东西有效,但不知何故缩放不起作用。我有以下代码

var ge;
google.load("earth", "1");

function init() {
  google.earth.createInstance('map', initCB, failureCB);
}

function initCB(instance) {
  ge = instance;
  ge.getWindow().setVisibility(true);
  ge.getNavigationControl().setVisibility(ge.VISIBILITY_HIDE);

  var oldFlyToSpeed = ge.getOptions().getFlyToSpeed();
  ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
}

var moveCamera = function(count) {
  var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
  lookAt.setLatitude(lookAt.getLatitude() + .1);
  lookAt.setLongitude(lookAt.getLongitude() + 5);
  ge.getView().setAbstractView(lookAt);

  if (count < 215) {
    setTimeout(function() {
    moveCamera(count + 1);
    }, 150);
  } else {
    ge.getOptions().setFlyToSpeed(oldFlyToSpeed);
    loadRoute();
  }
}

var loadRoute = function(){
  ge.getOptions().setFlyToSpeed(0.1); 
  var la = ge.createLookAt('');
  la.set(12, -84, 5000, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 750000);
  ge.getView().setAbstractView(la);
}

moveCamera(0);
document.getElementById('installed-plugin-version').innerHTML = ge.getPluginVersion();

function failureCB(errorCode){}

我知道代码在loadRoute();工作中的平静,因为我之前测试过。

有人知道这里出了什么问题吗?

4

1 回答 1

0

您的代码有多个错误,即 loadroute 函数是 moveCamera 函数的一部分,因为缺少右括号。我已经在您的帖子中对其进行了编辑,因此希望它可以工作。

于 2011-02-25T17:56:48.210 回答