【发布时间】:2014-12-18 06:38:28
【问题描述】:
我想使用 google maps ios sdk 在 ios 中像 google map app 一样绘制多段线。为了更清楚地理解我正在上传来自谷歌地图应用程序(ios。)的图像
【问题讨论】:
-
只有两个点(丢针和当前位置),圆圈是折线样式,在应用程序中显示。
我想使用 google maps ios sdk 在 ios 中像 google map app 一样绘制多段线。为了更清楚地理解我正在上传来自谷歌地图应用程序(ios。)的图像
【问题讨论】:
你是问如何实现虚线折线效果?如果是这样,我认为 SDK 不支持。
您可以使用 GMSCircles 手动创建类似的效果。
for(int x = 0; x < [self.path count]; x++)
{
CLLocationCoordinate2D coord = [self.path coordinateAtIndex:x];
//draw circle coord
GMSCircle *circle = [GMSCircle circleWithPosition:coord radius:20];
circle.fillColor = [UIColor blueColor];
circle.strokeColor = [UIColor blackColor];
circle.strokeWidth = 2;
circle.map = mapView;
}
要使这个看起来像原始示例,您可能需要在线上添加额外的点,以使圆圈均匀分布。为此,您可以这样做。
for(all the points in the path)
{
if(the distance from pointA to pointB is > some distance)
{
centerPtr = center point of pointA and pointB
insert centerPt in path
}
}
你可以把它变成一个简单的递归函数,它应该给你类似于你正在寻找的东西。
【讨论】: