themronion / Maui.GoogleMaps

Map library for MAUI using Google maps API
https://www.nuget.org/packages/Onion.Maui.GoogleMaps/
MIT License
79 stars 35 forks source link

[Clustering] Do not group one or more pins #62

Open andersonvieiragomeslopes opened 2 months ago

andersonvieiragomeslopes commented 2 months ago

SUMMARY

Add some criteria so that a given pin is not grouped with the others.

I will work on this item in the next few days, but I still don't know if it is technically possible, if you have information, please share it.

DETAILS

The idea is to group all of them, except the item in red, for example. The use case for this is a little clearer in my example because it's my user's location, so somehow I shouldn't group that pin. image

PLATFORMS

kramer-e commented 2 months ago

I've added a second ClusterManager and ClusterRenderer, so I could set the color of clusters for 2 different pin categories. You can set the PinType of the pin to Place for example, and add a pin to a certain ClusterManager based on the PinType in ClusterLogic. To show the pin without clustering you can set MinimumClusterSize to 10 (or higher) for the ClusterManager that contains your user's location.

andersonvieiragomeslopes commented 2 months ago

I've added a second ClusterManager and ClusterRenderer, so I could set the color of clusters for 2 different pin categories. You can set the PinType of the pin to Place for example, and add a pin to a certain ClusterManager based on the PinType in ClusterLogic. To show the pin without clustering you can set MinimumClusterSize to 10 (or higher) for the ClusterManager that contains your user's location.

The cluster color I will also do, if you have this ready, please share or make a PR.

Well, I imagine that the Pin must have some property like 'IsIgnoreClustering' or another criterion, since I want to ignore just one or a few items among many. I don't see much point in creating another ClusterManager.

kramer-e commented 1 month ago

I don't think there is an IgnoreClustering property. The easiest way would be to add your own logic and call the native Map.AddMarker() directly for that single pin. To set the color of a cluster you can set the BucketColors in the ClusterOptions