javascript-如何在Google Earth中设置kml文件的动画范围

发布于 2024-12-26 05:37:17 字数 338 浏览 3 评论 0原文

目前,如果我单击该按钮,地图将开始动画。但它永远不会停止,它无限地活跃。如果有一个地图/文件是 2004-2008 年的,我只想让它自动停止在 2008 年 12 月 31 日。我怎样才能做到这一点?

我尝试过

var timeSpan = ge.createTimeSpan('');
timeSpan.getBegin().set('2004');
timeSpan.getEnd().set('2008');
ge.getTime().setTimePrimitive(timeSpan);

但它不起作用,我认为它可能无法达到我的目的。 所以请帮助我,我很挣扎......

Currently, if I click the button, the map will start to animate. But it never stops, it animates infinitely. If there is a map/file is from 2004-2008, I just want that it stops on 2008-12-31 automatically. How can I do that?

I tried

var timeSpan = ge.createTimeSpan('');
timeSpan.getBegin().set('2004');
timeSpan.getEnd().set('2008');
ge.getTime().setTimePrimitive(timeSpan);

But it does not work, I think it may not work for my purpose.
So please help me, I am so strugling....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年里的时光 2025-01-02 05:37:17

您可以做一些事情,但如果不了解您要构建的内容,就很难知道该推荐什么。一个建议:

  • 不要使用默认的时间滑块 UI,而是将其隐藏起来并创建自己的按钮
  • 单击按钮时,将插件的时间设置为 2004 年。
  • 决定您想要的任何虚拟时钟频率(例如虚拟一个月)每真实秒或其他)
  • 计算到达 2008 年需要多长时间(以真实秒为
  • 单位)执行 setTimeout,在经过适当的实时时间后(例如,当虚拟插件时钟使其到2008)

这样,用户可能会以干扰您可能试图讲述的故事的方式摆弄 UI(例如拖动滑块)...

您可以在以下位置查看上面提到的大部分代码的示例http://code.google.com/apis/ajax/playground/#internal_clock_rate 以及 http://code.google.com/apis/earth/documentation/time.html

There's a few things you can do, and it's hard to know what to recommend without know more what you are trying to build. One suggestion:

  • Don't use the default time slider UI, but rather hide it away and create your own button
  • On clicking the button, set the time for the plugin to 2004.
  • Decide upon whatever virtual clock rate you want (e.g. one virtual month per real second, or whatever)
  • Calculate how long it would take, in real seconds, to get to 2008
  • do a setTimeout that sets the clock rate to 0 after the appropriate amount of real time has passed (e.g. when the virtual plugin clock makes it to 2008)

This way a user can'd be fiddling with the UI (e.g. dragging the slider around) in a way that interferes with the story you are probably trying to tell...

You can see examples of much of the code mentioned above at http://code.google.com/apis/ajax/playground/#internal_clock_rate and some additional documentation at http://code.google.com/apis/earth/documentation/time.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文