Is there any workaround for disabling the “auto tilt when zooming” feature of the Google Earth plugin?

試著忘記壹切 提交于 2019-12-10 18:13:11

问题


Recent versions of Google Earth are shipping with a feature called "Auto tilt when zooming". If enabled, Google earth automatically tilts the camera towards the horizon as you zoom closer to the surface. This feature can be disabled from within the GUI (Preferences -> Navigation tab). Unfortunately, I have so far not found a way to disable it for the Google Earth plugin.

Aseemingly the client setting corresponds to a registry key (HKCU\Software\Google\Google Earth Plus\SwoopEnabled). There exists a key of the same name inside the Google Earth Plugin registry branch (HKCU\Software\Google\GoogleEarthPlugin\SwoopEnabled), however, assigning the value "false" to it has no effect at all. It seems the plugin does not evaluate the setting, unlike the client.

There is an API method for disabling the ground level auto transition (void GEOptions.setAutoGroundLevelViewEnabled(bool)), however this does not disable the auto tilt behavior. There is no such method as "GEOptions.setSwoopEnabled(bool)", even though it seems to me that it would make a lot of sense to have one.

The Google Earth API Issue Tracker lists this problem as an issue:

http://code.google.com/p/earth-api-samples/issues/detail?id=23

However, the entry is from August 2008 and it seems unlikely to me that Google will fix it any time soon. Therefore, my question is: Is there any sort of workaround/hack/tweak.. to force the plugin to disable the annoying auto-tilt feature?

Any help will be greatly appreciated!


回答1:


No, AFAIK it is not possible to disable this behaviour.

...That said you could possibly use some events and conditional logic to set the tilt programmatically if the view altitude is below a certain height. However this could introduce other issues, like not being able to tilt the view at all below a certain altitude. Although maybe that is acceptable for your implementation...

Anyhow, something like the following might work for you, although it is written here and is untested.

google.earth.addEventListener(ge, 'frameend', setView);

var setView = function() {
  var camera = ge.getView().copyAsCamera(ge.ALTITUDE_RELATIVE_TO_GROUND);
  if(camera.getAltitude() < BASE_ALTITUDE && camera.getTilt() >= AUTO_TILT_AMMOUNT) {
     var speed = ge.getOptions().getFlyToSpeed();
     ge.getOptions().setFlyToSpeed(ge.SPEED_TELEPORT);
     camera.setTilt(0);
     ge.getView().setAbstractView(camera);
     ge.getOptions().setFlyToSpeed(speed);
  }
}

Where BASE_ALTITUDE is the height at which 'swoop' kicks in and AUTO_TILT_AMMOUNT is the tilt value once the 'swoop' has, err, swooped.



来源:https://stackoverflow.com/questions/12054480/is-there-any-workaround-for-disabling-the-auto-tilt-when-zooming-feature-of-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!