3D 建筑物上的 Google 地球插件点击事件
我一直在四处寻找,但还没有找到这个问题的答案。是否可以使用 Google Earth 插件的 JavaScript 将点击事件添加到 3D 建筑层或自定义 3D 模型。
我的最终目标是能够让用户选择 3D 建筑物,并显示一个包含该建筑物详细信息的信息气泡。这不是 Google 显示的包含 3D 模型信息的默认气泡。
理想情况下,人们能够使用 3D 建筑层,而不是手动加载模型,尽管我对此不太抱有希望,因此通过手动上传的 3D 模型来实现这一点是一种可能。
我正在使用 google 地图 api V3 和 Google Earth 实用程序库来激活插件。
预先感谢您的任何答复。
I have been looking around and haven't found an answer to this yet. Is it possible to add click events to either the 3D building layer or custom 3D models using javascript for the google earth plugin.
My end goal is to be able to have a user select a 3d building and have an information bubble show up with details about that building. This is rather than the default bubble that Google shows with information about the 3D model.
Ideally one would be able to use the 3D buildings layer as opposed to loading the models manually, though I don't have high hopes of that being possible so doing it via manually uploaded 3D models would be a possibility.
I am using the google maps api V3 with the google earth utility library to activate the plugin.
Thanks in advance for any answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我第一次读过这篇文章。仔细一看,发现似乎仍然不可能(以这种简单的方式)
google Earth api
也许可以通过实现自定义交叉点“侦听器”来做到这一点
//编辑:
也许这不是漏洞的故事。更多研究表明,可以针对某些几何体进行命中测试。
ge 接口
有一个名为hitTest(...)
的函数API 文档
不幸的是 < code>GEHitTestModeEnum 仅适用于GEPlugin.HIT_TEST_GLOBE GEPlugin.HIT_TEST_TERRAIN
GEPlugin.HIT_TEST_BUILDINGS
因此您可以针对建筑物进行 hitTest,但不能针对自定义 3D 模型进行点击测试...
问题 使用其他“可事件”不可见地标来检测 点击。
命中测试的小代码excample
//EDIT2:
解决方案我在当前项目中使用的听起来像这样:
使用 多边形 用于每个“接收自定义 3D 模型的点击事件”
多边形可以接收点击事件
I think i've overread this the first time. After taking a closer look it reveals that it seems to be still not possible (in that easy way)
google earth api
Maybe its possible to do that by implementing a custom intersection 'listener'
//EDIT:
Maybe thats not the hole story. more research revealed that it is possible to make a hittest agaignst some geometry. the
ge interface
has a function namedhitTest(...)
api doc
unfortunately the
GEHitTestModeEnum
is only suitable forGEPlugin.HIT_TEST_GLOBE GEPlugin.HIT_TEST_TERRAIN
GEPlugin.HIT_TEST_BUILDINGS
so you can hitTest against buildings but not against custom 3D models...
a slightly useable solution to click custom 3D models could be the one described in this issue using other 'eventable' invisible placemarks to detect a click.
litte code excample of hittesting
//EDIT2:
The solution i use in my current project sounds like that:
create a bounding box with polygons for every 'click event recieving custom 3d model'
that polygons can receive click events