Android 自定义地图
我正在开发 Android 室内定位系统。我需要绘制建筑物的自定义平面图并在其上覆盖指针。
在这种情况下,我应该使用哪种软件/API 来绘制自定义平面图?
提前致谢。
I am developing an Indoor Positioning System for Android. I need to draw a custom floor plan of a building and overlay a pointer on it.
In this scenario, which software/API I should use to draw custom floor plan?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最近做了一个图书馆平面图的事情作为我硕士论文的一部分。我选择了一个简单的自定义
Drawable
,它只是缩放了Bitmap
(平面图)以适合屏幕,然后在其顶部绘制一些半透明矩形(书架)。我的布局有一个通用的View
和fill_parent
两个方向,并通过setBackgroundDrawable()
在 <代码>Activity.onCreate()。如果您有高分辨率地图(超过了应用程序内存的大小),想要缩放甚至旋转,这将是一项艰巨的工作。我尝试使用 Reno 在他的回答中提到的 Google IO 应用程序代码、自定义 Google 地图叠加层(无法放大得足够近)、离线
WebView
(用于“免费”缩放功能)以及甚至考虑了一个基于图块的自定义渲染系统——最终使用简单的位图是最不麻烦的,并且对于我的用例来说效果出奇地好。不过,我对可缩放、旋转、基于平铺渲染的解决方案非常感兴趣:)
I recently did a library floorplan thing as part of my master's thesis. I settled for a simple custom
Drawable
that just scaled aBitmap
(floorplan) to fit the screen and then draws some translucent rectangles (book shelves) on top of it. My layout has a genericView
withfill_parent
for both directions and gets the customDrawable
viasetBackgroundDrawable()
inActivity.onCreate()
.If you have high-resolution maps (more than fits into app memory in one piece), want zooming or even rotation, it's going to be a lot of work. I tried to use the Google IO app code mentioned by Reno in his answer, custom Google Maps overlays (can't zoom in close enough), an offline
WebView
(for the "free" zooming functionality) and even pondered a custom tile-based rendering system -- in the end using a simpleBitmap
was the least hassle and worked surprisingly well for my use case.I'd be very much interested in a solution that does zoomable, rotating, tiled-based rendering, though :)
Google 这样做了参加他们的 Google I/O 活动。太糟糕了,他们使用了 javascript :( 我不擅长。
他们将 map.js 加载到
MapFragment
中,其中包含一个WebView
。Google did this for their Google I/O event. Too bad they used javascript :( I'm no good at it.
They loaded the map.js in a
MapFragment
, which contains aWebView
.MapView 组件提供了一种非常灵活的方法,可以将任何类型的自定义元素添加到地图中,称为 MapOverlays。您可以实现 ItemizedOverlay 并向其中添加项目,并在此覆盖层上为覆盖项目定义可绘制对象。在 MapView 上注册 Overlay 后,视图会负责何时绘制 Items 以及在屏幕上的位置。
有关更多详细信息和教程,请参阅 http://developer.android.com /resources/tutorials/views/hello-mapview.html
The MapView component provides a very flexible method of adding custom elements of any kind to a map called MapOverlays. You can implement ItemizedOverlay and add items to it and define Drawables for Overlay Items on this overlay. After you've registered your Overlay at the MapView, the view takes care of when to draw your Items and where on the screen.
For more details and a tutorial, see http://developer.android.com/resources/tutorials/views/hello-mapview.html