ios - 如何在谷歌地图 Swift API 中实现颜色渐变?
问题描述
我想显示具有从绿色到红色的不同强度的数据点(Google Maps Swift)。地图上数据点的面积应保持不变。GMUWeightedLatLng 类将坐标作为参数以及强度。然而,后者表示该特定点的区域,它不会改变颜色。
let coords = GMUWeightedLatLng(coordinate: CLLocationCoordinate2DMake(latitude, longitude), intensity: 1)
heatmapLayer.weightedData.append(coords)
heatmapLayer.gradient 提供了更改渐变的可能性,但它使所有数据点都相同,而我希望每个点都显示从绿色到红色的自定义阴影,具有相同的区域。
let gradientColors: [UIColor] = [.green, .red]
heatmapLayer.gradient = GMUGradient(
colors: gradientColors,
startPoints: gradientStartPoints,
colorMapSize: 256)
我将非常感谢任何帮助!
解决方案
推荐阅读
- javascript - 使用 Mongoose 将数据推送到 MongoDB
- html - HTML:按屏幕大小选择一个类(引导程序)。固定页脚大小
- python - 无法打开设备“/dev/input/event14”。请确保您具有适当的权限
- javascript - 当我使用相同的电子邮件 ID 注册时,它会显示预期的警报并重置表单。但在那之后它不接受另一个条目
- css - 在 Angular 中,如何在指令中实现 button:focus outline: none
- r - 有没有办法在R中的某个字符串模式之前和之后提取单词,即“之前的单词”+“字符串模式”+“之后的单词”
- javascript - 我可以在我的网页上添加一个按钮或链接,让我查看该页面的源代码(例如在 URL 前添加 view-source:) 吗?
- ios - 发现的 UUID 与使用 nRFConnect 检查的 UUID 不匹配
- git - Azure Data Factory CI/CD - automatic publish after merge to master branch
- google-apps-script - How to list users of Google Admin Directory but exclude users in any sub OU