-
- All Implemented Interfaces:
-
com.google.maps.android.clustering.algo.Algorithm
public class CentroidNonHierarchicalDistanceBasedAlgorithm<T extends ClusterItem> extends NonHierarchicalDistanceBasedAlgorithm<T>
A variant of NonHierarchicalDistanceBasedAlgorithm that clusters items based on distance but assigns cluster positions at the centroid of their items, instead of using the position of a single item as the cluster position.
This algorithm overrides getClusters to compute a geographic centroid for each cluster and creates StaticCluster instances positioned at these centroids. This can provide a more accurate visual representation of the cluster location.
-
-
Method Summary
Modifier and Type Method Description Set<out Cluster<T>>getClusters(float zoom)Returns clusters of items for the given zoom level, with cluster positionsset to the centroid of their constituent items rather than the position ofany single item. -
Methods inherited from class com.google.maps.android.clustering.algo.NonHierarchicalDistanceBasedAlgorithm
addItem, addItems, clearItems, getItems, getMaxDistanceBetweenClusteredItems, removeItem, removeItems, setMaxDistanceBetweenClusteredItems, updateItem -
Methods inherited from class com.google.maps.android.clustering.algo.AbstractAlgorithm
lock, unlock -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getClusters
Set<out Cluster<T>> getClusters(float zoom)
Returns clusters of items for the given zoom level, with cluster positionsset to the centroid of their constituent items rather than the position ofany single item.
- Parameters:
zoom- the current zoom level
-
-
-
-