Google Map Kit,像Google Map iOS一样绘制多义线以供步行 [英] Google Map Kit, draw polylines for walk like google map ios

查看:93
本文介绍了Google Map Kit,像Google Map iOS一样绘制多义线以供步行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用google maps ios sdk在ios中绘制类似于Google map app的步行折线.为了更清楚地了解,我正在上传来自Google地图应用程序的图像(ios.)

I wants to draw polyline for walk like google map app in ios using google maps ios sdk. For more clear understanding i am uploading image that is from google map app(ios.)

推荐答案

您在问如何实现虚线折线效果吗?如果是这样,我认为SDK不支持该功能.

Are you asking how to achieve the dotted polyline effect? If so, I don't believe that is supported in the SDK.

您可以使用GMSCircles手动创建类似的效果.

You can manually create a similar effect with 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 this to really look like the original example you will probably need to add additional points onto the line in order for the circles to be evenly spaced out. For that you could do something like this.

    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
        }
    }

您可以将其变成一个简单的递归函数,该函数应该可以为您提供与您所寻找的功能相似的功能.

You can turn this into a simple recursive function that should give you something similar to what you are looking for.

这篇关于Google Map Kit,像Google Map iOS一样绘制多义线以供步行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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