CoreLocation:一次仅监控某些区域
在我的 iPhone 应用程序中,我想监控用户是否一次进入某些特定的地理区域并采取相应的行动。 我现在看到,在新的 iOS 4 中,可以将一些兴趣区域 (CLRegion) 注册到 CLLocationManager,因此它可以为我做一些工作,但是......我还需要动态更改区域集(从而在某个时间仅向用户发出某些区域的信号)但似乎只能添加区域。 在注意到 iOS 4 中的这一变化之前,我计划使用 R 树来索引所有区域(作为 2d 空间中的矩形)并按需查询,显然是我自己添加/删除节点。 这是我的问题: - 有人知道 CLLocationManager 是否使用类似于 R 树的东西吗? - 效率非常高吗? (我可以将所有区域在某个时刻注册并应用过滤器,例如查看当时可用场景的 NSSet) - 我想至少删除CL中所有的监控区域,可行吗?如何?
In my iPhone app I'd like to monitor if the user enters some particular geographycal regions at a time and act consequently.
I now saw that with the new iOS 4 it is possible to register some interest regions (CLRegion) to a CLLocationManager, so it would do some job for me, but... I'd also need to dynamically change the set of the regions (thus signaling the user only some region at some time) but it seems that Regions can only be added.
Before noticing this change in iOS 4 I was planning on using an R-Tree to index all the regions (as rectangles in a 2d space) and query it on demand obviously adding/removing nodes by myself.
Here are my questions:
- Anyone knows if the CLLocationManager uses something similar to an R-Tree?
- Is it extreamly efficient ? (I could put all my regions as registered at some point and the apply a filter such as looking in an NSSet of available-at-that-moment scenes)
- I'd like to delete, at least, all the monitored regions in the CL, is it feasible? How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
-[CLLocationManager stopMonitoringForRegion:]
有什么问题吗?What's wrong with
-[CLLocationManager stopMonitoringForRegion:]
?