开发者

Draw on map and and search by or get coordinates from graphic

I have an app that uses mapkit and I have the annotations and everything going.

I would like some functionality that allows the users to draw, either freehand or draw out a box, on the map. After the user creates this graphic (for lack of a better term) i would like to query my annotations for those that intersect with this graphic. If this is inherent or easy to do great, otherwise if i can get开发者_如何学C the geometry of the graphic and can do searching with the min/max x/y through coordinates i have stored in a db. I have looked into openGL/GLPaint but cannot quite connect the dots (so to speak). Thanks.


The first thing that comes to mind would be to "display" a transparant view on top of your map to intercept the touch events. This view could then add overlays and annotations to the map as it receives touch events. You can then do your logic once all of your geometry is in the same coordinate space.

You would need a way to switch between "browse" and "draw" modes so that:

  • when you are in "browse" mode, the map operates as usual.. swiping moves the map, etc.

  • when you are in "draw" mode, the same gestures will draw on the map

This way you can enable the transparant view when in "draw" mode and hide/remove it in "browse" mode. You'll need to convert your view points to coordinates or MapPoints which could be tricky but you should find all the methods to help you acheive this here: http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKitFunctionsReference/Reference/reference.html

I haven't tried this, but it might be worth trying. Let us know how you end up doing it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜