检查MKPolyline是否与MKPolygon相交 [英] Check if MKPolyline intersects MKPolygon

查看:122
本文介绍了检查MKPolyline是否与MKPolygon相交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出MKPolyline在地图上是否与MKPolygon相交.目前,我对此的唯一想法是通过直线并在每个点上进行测试(如果它位于多边形中).更确切地说,我正在尝试测试MKUserLocation和地图上的目标之间是否没有任何MKPolygon(因此MKUserLocation可以看到该目标).

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).

关于如何执行此操作的任何更实际的想法?如果没有,如何将MKPolyLine转换成很多点?

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

推荐答案

它们都符合MKOverlay协议.您可以使用在名为boundingMapRect的协议上定义的属性,并在称为intersectsMapRect的协议定义的方法上使用.这里有更多信息:

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

这篇关于检查MKPolyline是否与MKPolygon相交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆