Cluster Manager
Groups nearby markers into clusters that show their count. Clusters are computed again when the map stops at a new integer zoom level.
The manager is the map's camera idle and marker click listener:
val clusterManager = ClusterManager<Shop>(context, mapView)
mapView.setOnCameraIdleListener(clusterManager)
mapView.setOnMarkerClickListener(clusterManager)
clusterManager.addItems(shops)
clusterManager.cluster()Tapping a cluster zooms in to show its items, unless an OnClusterClickListener returns true.
Parameters
Context for the screen density
The map to draw the markers on
Type Parameters
The type of the items
Types
Provides the icon of a cluster marker, e.g. to draw clusters in your own style.
Provides the icon of an item's marker, or null for the default marker.
Called when a cluster marker is tapped.
Called when the marker of a single item is tapped.
Properties
Draws the cluster markers, or null for circles with the count.
Draws the item markers, or null for the default marker.
How close items must be to share a cluster, in dp on the screen. Default is 100.
The smallest group drawn as a cluster; smaller groups show their items' markers. Default is 4.
Functions
Removes all items. Call cluster to update the map.
Returns the items of the manager.
Clusters again when the camera stops at another integer zoom level.
Handles taps on the manager's markers; returns false for other markers.
Removes an item. Call cluster to update the map.
Removes items. Call cluster to update the map.
Sets a listener called when a cluster is tapped.
Sets a listener called when the marker of a single item is tapped.