1
我已经在使用方法GMSGeometryContainsLocation
来确定坐标(来自抽头用户)是否在GMSPolygon内,但是我无法使它适用于GMSPolyline。如果抽头点是不完全的多线则GMSGeometryIsLocationOnPath
条件将永远不会返回trueiOS - 确定坐标是否在GMSPolyline内
-(void) mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate
{
if (_myMarker)
_myMarker.map = nil;
[self didTapOnPolygon:coordinate andMap:mapView];
[self didTapOnPolyline:coordinate andMap:mapView];
}
如果您的'didTapOnPolyline'委托触发,那么用户正在点击'多段线'权利?那么为什么检查点是否在线? – Subramanian
这是我的自定义方法。查看编辑 – Balanced
如果分接点不完全在多义线上,那么它将不起作用。你可以通过使用'GMSGeometryIsLocationOnPathTolerance'来检查点在多边线上还是附近。 – Subramanian