How to add linewidth property to MGLFillStyleLayer in mapbox ios sdk?

夙愿已清 提交于 2019-12-14 02:17:57

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/48636433/how-to-add-linewidth-property-to-mglfillstylelayer-in-mapbox-ios-sdk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!