Javascript 使用外部按钮复制google earth插件导航功能

Javascript 使用外部按钮复制google earth插件导航功能,javascript,html,google-earth-plugin,Javascript,Html,Google Earth Plugin,在HTML页面中嵌入Google Earth javascript插件后,是否可以使用Google Earth插件下面的一系列HTML链接复制Google Earth导航 我只需要缩放按钮的功能,没有滑块,4个主要的移动方向(上,下,左,右)和上下的相机倾斜的外观按钮 旋转可以始终保持在北方。这是不必要的 按钮样本 <div id="map3d" style="height: 400px;"></div> <h3>Look</h3> <a

在HTML页面中嵌入Google Earth javascript插件后,是否可以使用Google Earth插件下面的一系列HTML链接复制Google Earth导航

我只需要缩放按钮的功能,没有滑块,4个主要的移动方向(上,下,左,右)和上下的相机倾斜的外观按钮

旋转可以始终保持在北方。这是不必要的

按钮样本

<div id="map3d" style="height: 400px;"></div>
<h3>Look</h3>
<a href="#" class="btn" id="up">up</a>
<a href="#" class="btn" id="right">right</a>
<a href="#" class="btn" id="down">down</a>
<a href="#" class="btn" id="left">left</a>
<h3>Move</h3>
<a href="#" class="btn" id="north">north</a>
<a href="#" class="btn" id="east">east</a>
<a href="#" class="btn" id="west">west</a>
<a href="#" class="btn" id="south">south</a>
<h3>Zoom</h3>
<a href="#" class="btn" id="zoomIn">Zoom In</a>
<a href="#" class="btn" id="zoomOut">Zoom Out</a>

看
移动
快速移动

是的,您可以只更改摄像头参数

见:

基本上,您可以获得当前视图,或者将其更改为新点,或者对其进行调整(即每次单击按钮时,移动X度或其他)

上面链接中的代码复制到此处,以防以后更改:

// Get the current view.
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);

// Add 25 degrees to the current latitude and longitude values.
lookAt.setLatitude(lookAt.getLatitude() + 25.0);
lookAt.setLongitude(lookAt.getLongitude() + 25.0);

// Update the view in Google Earth.
ge.getView().setAbstractView(lookAt);