如何在mapbox ios sdk中的MGLFillStyleLayer中添加linewidth属性? [英] How to add linewidth property to MGLFillStyleLayer in mapbox ios sdk?

查看:107
本文介绍了如何在mapbox ios sdk中的MGLFillStyleLayer中添加linewidth属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在带有'MGLPolygonFeature'的'MGLFillStyleLayer'中添加多边形要素,但是问题是我无法更改轮廓宽度.

I have to add polygon features in the 'MGLFillStyleLayer' with 'MGLPolygonFeature' but the problem is I can't change the outline width.

推荐答案

当前无法更改MGLFillStyleLayer的线宽.建议的解决方法是使用相同的源来创建 MGLLineStyleLayer ,然后在填充层上方插入线层.

The line width for a MGLFillStyleLayer currently cannot be changed. The suggested workaround is to use the same source to create a MGLLineStyleLayer, then insert the line layer above the fill layer.

我可以在此示例中添加线层以下代码:

I can add a line layer to this example with the following code:

    let lineLayer = MGLLineStyleLayer(identifier: "line-layer", source: source)
    lineLayer.lineWidth = MGLStyleValue(rawValue: 5)
    lineLayer.sourceLayerIdentifier = "drone-restrictions-3f6lsg"

    if let cityLabels = style.layer(withIdentifier: "place-city-sm") {
        style.insertLayer(layer, below: cityLabels)
        style.insertLayer(lineLayer, above: layer)
    }

这篇关于如何在mapbox ios sdk中的MGLFillStyleLayer中添加linewidth属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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