2013-06-05 73 views
0

由於某些原因,使用帶有EXTJS的Google地球插件時,它只是給我一張白色地圖。使用Google地球插件爲我提供白色地圖

希望我可以發佈圖片,儘管我的聲譽需要一些工作。

我在加載我的應用程序時包含以下文件。

https://www.google.com/jsapi 
/location_of_file/googleearth/Ext.ux.GEarthPanel-1.3.js 
/location_of_file/googleearth/Ext.ux.GEarthPanel-1.3.css 
/location_of_file/GoogleEarthStartup.js 

啓動文件包含。

google.load("earth", "1"); 
google.load("maps", "2.xx"); 

我需要一個帶有jsapi的密鑰嗎?

請指教。

所有的瀏覽器都給我同樣的問題。

+0

我想實現這個插件而不使用GEarthPanel方法。專家組相當年長,而且由於沒有人真的在這方面工作了很多年,我想這不是強制性的。 – RiaanSA

回答

0

我們在GE ExtJs容器中加載了GE插件。 HTML看起來像:

<script type="text/javascript" src="scripts/globe/Globe.js"></script> 
<script type="text/javascript" src="scripts/ext/ext-all-debug.js"></script> 
<script type="text/javascript" src="https://www.google.com/jsapi"></script> 
<script type="text/javascript"> 
    google.load("earth", "1"); 
</script> 

<script type="text/javascript"> 
    Ext.onReady(function() { 
     Globe.initGlobe(); 
    }); 
</script> 
... 
<body><!--Globe Panel is inserted here from Globe.js by Ext--></body> 

的JavaScript類設置了一個div一個容器,我們可以針對:

this.globeContainingPanel = Ext.create('Ext.container.Container', { 
    ... 
    renderTo: Ext.getBody(), 
    items: [{ 
     { 
      xtype: 'panel', 
      region: 'center', 
      html: '<div id="map3d"></div>' 
     } 
    }] 
}); 

然後讓GE渲染到div面板:

window.google.loader.ApiKey = 'ABCDEFGHIJKLMNOPgoogle.earth.ex.key'; 
window.google.loader.KeyVerified = true; 
window.google.earth.allowUsageLogging = false; 

google.earth.createInstance('map3d', this.initCallback, this.failureCallback); 

另外,請確保您的瀏覽器中安裝了Google地球插件。

相關問題