You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to display cluster images based on marker data on the cluster, able to update the cluster image but it applies to all the clusters. Please see the bellow screenshot.
func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) {
let zoom = Int(mapView.camera.zoom)
let clusteredItems = clusterManager.algorithm.clusters(atZoom: Float(zoom))
if let clusterItem = marker.userData as? GMUCluster {
for staticCluster in clusteredItems {
let movingItems = Double(staticCluster.items.filter { $0.title == "MapsMarkerGreen" }.count)
let idleItems = Double(staticCluster.items.filter { $0.title == "MapsMarkerBlue" }.count)
let stoppedLessThan60 = Double(staticCluster.items.filter { $0.title == "MapsMarkerYellow" }.count)
let stoppedGreaterThan60 = Double(staticCluster.items.filter { $0.title == "MapsMarkerRed" }.count)
let outOfRange = Double(staticCluster.items.filter { $0.title == "MapsMarkerGrey" }.count)
let totalItems = staticCluster.items.count
let multiColorBorderView = PercentageColorBorderView(frame: CGRect(x: 0, y: 0, width: 44, height: 44))
multiColorBorderView.updateBorderColors([(.green, movingItems), (.blue, idleItems), (.yellow, stoppedLessThan60), (.red, stoppedGreaterThan60), (.gray, outOfRange)])
let countLabel = UILabel(frame: CGRect(x: 2, y: 2, width: 40, height: 40))
countLabel.text = String(totalItems)
countLabel.textAlignment = .center
countLabel.font = UIFont(name: "", size: 15)
countLabel.textColor = .white
multiColorBorderView.addSubview(countLabel)
multiColorBorderView.setNeedsDisplay()
multiColorBorderView.backgroundColor = .clear
let clusterImage = multiColorBorderView.asImages()
marker.icon = clusterImage
}
}
}
The text was updated successfully, but these errors were encountered:
If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.
@VijaykumarPalakurthi Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:
Hi all,
I want to display cluster images based on marker data on the cluster, able to update the cluster image but it applies to all the clusters. Please see the bellow screenshot.
The text was updated successfully, but these errors were encountered: