Check if MKPolyline intersects MKPolygon

て烟熏妆下的殇ゞ 提交于 2019-12-08 11:24:27

问题


I'm trying to figure out if a MKPolyline intersects an MKPolygon on map. Currently the only idea I have about this is to go through the line and test on every point if it is located in polygon. More exactly, I'm trying to test if there aren't any MKPolygon between MKUserLocation and an objective on map (so MKUserLocation can see that objective).

Any more practical idea about how to do this? If not, how to transform the MKPolyLine into a lot of points?


回答1:


They both conform to the MKOverlay protocol. You can use the property defined on the protocol called boundingMapRect, and use it on a protocol-defined method called intersectsMapRect. More info here:

http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKOverlay_protocol/Reference/Reference.html



来源:https://stackoverflow.com/questions/12076547/check-if-mkpolyline-intersects-mkpolygon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!