[英]How can I determine the area currently visible in a scrollview and determine the center?
[英]How can I determine if the current position is within a KML-defined area?
我有一些KML數據,它們定義了地圖上的區域,例如:
131.0764742247829,-15.80786022929951,0 132.6357700620065,-16.54895727734661,0
134.1119108999971,-17.28040233069844,0 135.8545033459996,-18.1298170074137,0
137.7396886168202,-19.07860187595016,0 140.011948401144,-20.18462043802856,0
142.3114600417346,-21.19369381963822,0 144.1566045495202,-22.15731684591415,0
我想確定我的iOS應用程序中用戶的當前位置是否在此定義區域內。 我怎樣才能做到這一點?
如果您知道圓的中心和半徑,則非常簡單。
CLRegion *circle = [CLRegion initCircularRegionWithCenter:centerCoordinate radius:circleRadius identifier:@"myCircle"];
BOOL doesItContainMyPoint = [circle containsCoordinate:myLocation];
根據修改后的問題進行更新
我從來沒有嘗試過,但是您不能用您的點創建UIBezierPath(您不必實際繪制貝塞爾曲線),然后使用UIBezierPath的- (BOOL)containsPoint:(CGPoint)point
來測試包含性嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.