2012-08-01 90 views
2

所以我想要做的是在Web瀏覽器中替換加載到Google Earth GEPlugin實例中的主數據庫。如果我去Code Playground:Here http://code.google.com/apis/ajax/playground/#mars/alternate_server_connectivity有沒有辦法重新加載主GEPlugin數據庫?

然後我得到一個加載新數據庫的例子。但是,如果我嘗試多次執行CreateInstance調用,我仍然得到相同的數據庫(我猜這是由於在後臺運行的GEPlugin.exe仍然使用第一個數據庫引起的),如果我通過殺死geplugin然後.EXE工序的負荷作品)

在該代碼頁爲例編輯HTML和我用下面的HTML /腳本組合

<!-- 
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> 

這工作,因爲它重新加載實例,但它確實不要更改數據庫。

我應該說我知道添加邊數據庫的選項,但是如果我嘗試加載邊數據庫,地形仍然映射到第一個數據庫的地形。對我來說這是不可接受的。

回答

相關問題