ios - 如何设置填充颜色取决于多边形特征的属性值?
问题描述
这就是我定义多边形特征的方式:
let polygon = MGLPolygonFeature(coordinates: &coordinates, count: UInt(coordinates.count))
polygon.attributes = ["name": card.name, "identifier": card.identifier, "color": card.set.colorMode] //UIColor
let cardSource = MGLShapeSource(identifier: "cards", features: [polygon], options: [:])
let polygonLayer = MGLFillStyleLayer(identifier: "polygon-level", source: cardSource)
polygonLayer.fillColor = MGLStyleValue(rawValue: "{color}")
polygonLayer.fillOpacity = MGLStyleValue(rawValue: 0.4)
但这不起作用。如何设置填充颜色取决于属性?
解决方案
推荐阅读
- bash - 在保留列的同时将 Bash 输出到同一行
- javascript - SocketIO 离开房间功能不工作
- csv - 试图在 NEO4J 中加载 csv 关系
- node.js - 如何将表单中的数据加载到请求正文中
- c++ - 延长Windows服务停止时间
- pandas - 如何选择和替换 pandas 字符串列中的主要关键字?
- javascript - 在 userPrefs 中设置什么以在 puppeteer-extra 的底部打开 devtools?
- java - sbt - 在 Jdk 1.7 中执行时,不支持的 major.minor 版本 52.0 错误
- express - Express js - 查找不是函数
- sql - 以高成本合并笛卡尔连接