ios - 如何在ios swift中绘制以折线为半径的多边形

标签 ios swift core-graphics polygon google-polyline

我在围绕折线绘制多边形时遇到问题((我有所有坐标折线,我想缓冲坐标以获取该折线周围的多边形坐标。

我有类似这个的东西:enter image description here .

但我想做一些像这个这样的东西:

enter image description here

请帮忙...

最佳答案

您可以只绘制具有相同路径的 2 条折线。

假设您创建了一个带有缓冲坐标的变量thePath。 您已经使用此路径创建了一条折线。

let redPolyline = GMSPolyline()
redPolyline.path = thePath
redPolyline.map = mapview

创建另一个。

let redPolyline = GMSPolyline()
redPolyline.path = thePath
redPolyline.strokeWidth = 6.0 // Change it accordingly 
redPolyline.strokeWidth = UIColor.redColor().colorWithAlphaComponent(0.5) // Change it accordingly

redPolyline.map = mapview

请记住,redPolyline 的 zIndex 应高于 bluePolyline,因为正如我在您提供的图像中看到的那样,redPolyline 位于另一条线的顶部。

关于ios - 如何在ios swift中绘制以折线为半径的多边形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39640714/

相关文章:

ios - 这些动画通常是如何在 Swift/iOS 中完成的 - 请参见图片

ios - “Safari cannot open the page because the address is invalid” 在卸载应用程序的情况下访问 Branch 链接时出现

objective-c - 为数组中的每个项目添加单独的 UIImageViews

objective-c - 如果将自动释放对象标记为自动释放会发生什么

ios - 无法禁用 UIBarButtonItem

iOS绘图到屏幕

ios - Swift 3 HTTPS GET 请求

ios - 如何按修改日期对 CloudKit 结果进行排序?

ios - 以编程方式退出 AVPlayerViewController 全屏?

cocoa - 如何在 Mac OS X 10.9 上检测 NaN 传递给 CoreGraphics API 的位置