Javascript 有没有办法重新加载主GEPlugin数据库?
所以我想做的是在web浏览器中替换加载到Google Earth GEPlugin实例中的主数据库。如果我去代码操场: 然后我得到了一个加载新数据库的示例。但是,如果我尝试多次调用CreateInstance,我会一直得到相同的数据库(我猜这是因为后台运行的GEPlugin.exe仍然使用第一个数据库。如果我通过停止GEPlugin.exe进程删除该实例,那么加载就会起作用) 在这个示例的代码页上编辑HTML,我使用了下面的HTML/脚本组合Javascript 有没有办法重新加载主GEPlugin数据库?,javascript,html,google-earth,google-earth-plugin,Javascript,Html,Google Earth,Google Earth Plugin,所以我想做的是在web浏览器中替换加载到Google Earth GEPlugin实例中的主数据库。如果我去代码操场: 然后我得到了一个加载新数据库的示例。但是,如果我尝试多次调用CreateInstance,我会一直得到相同的数据库(我猜这是因为后台运行的GEPlugin.exe仍然使用第一个数据库。如果我通过停止GEPlugin.exe进程删除该实例,那么加载就会起作用) 在这个示例的代码页上编辑HTML,我使用了下面的HTML/脚本组合 <!-- You are free t
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Earth API Sample</title>
<script src="http://www.google.com/jsapi?key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCallback, failureCallback,
{ database: 'http://khmdb.google.com/?db=mars' });
}
function initCallback(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
// add a navigation control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
document.getElementById('installed-plugin-version').innerHTML =
ge.getPluginVersion().toString();
}
function failureCallback(errorCode) {
}
function loadmoon()
{
delete ge;
google.earth.createInstance('map3d', initCallback, failureCallback, { database: 'http://khmdb.google.com/?db=moon' });
//http://khmdb.google.com/?db=moon
}
</script>
</head>
<body onload="init()" style="font-family: arial, sans-serif; font-size: 13px; border: 0;">
<div id="map3d" style="width: 500px; height: 380px;"></div>
<br>
<a href="" onclick="loadmoon()">LOAD THE MOON</a>
<div>Installed Plugin Version: <span id="installed-plugin-version" style="font-weight: bold;">Loading...</span></div>
</body>
</html>
谷歌地球API示例
var-ge;
谷歌加载(“地球”,“1”);
函数init(){
google.earth.createInstance('map3d',initCallback,failureCallback,
{数据库:'http://khmdb.google.com/?db=mars' });
}
函数initCallback(实例){
ge=实例;
ge.getWindow().setVisibility(true);
//添加导航控件
ge.getNavigationControl().setVisibility(ge.VISIBILITY\u AUTO);
document.getElementById('installed-plugin-version').innerHTML=
ge.getPluginVersion().toString();
}
函数故障回调(错误代码){
}
函数loadmoon()
{
删除通用电气;
createInstance('map3d',initCallback,failureCallback,{database:'http://khmdb.google.com/?db=moon' });
//http://khmdb.google.com/?db=moon
}
已安装插件版本:正在加载。。。
它的工作原理是重新加载实例,但不会更改数据库
我应该说,我知道添加侧面数据库的选项,但是如果我尝试加载侧面数据库,地形仍然映射到第一个数据库的地形。对我来说,这是不可接受的。在再次创建实例之前,请将“map3d”的innerHTML设置为空字符串
function loadmoon(){
document.getElementById('map3d').innerHTML = '';
google.earth.createInstance('map3d', initCallback, failureCallback, { database: 'http://khmdb.google.com/?db=moon' });
}
看看这个例子,这正是你需要的