-
- 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.
-
-
Field Summary
Fields Modifier and Type Field Description private IntegermaxDistanceBetweenClusteredItemsprivate final Collection<T>items
-
Constructor Summary
Constructors Constructor Description CentroidNonHierarchicalDistanceBasedAlgorithm()
-
Method Summary
Modifier and Type Method Description IntegergetMaxDistanceBetweenClusteredItems()UnitsetMaxDistanceBetweenClusteredItems(Integer maxDistanceBetweenClusteredItems)Collection<T>getItems()Set<Cluster<T>>getClusters(Float zoom)Returns clusters of items for the given zoom level, with cluster positions set to the centroid of their constituent items rather than the position of any single item. -
Methods inherited from class com.google.maps.android.clustering.algo.CentroidNonHierarchicalDistanceBasedAlgorithm
addItem, addItems, clearItems, removeItem, removeItems, updateItem -
Methods inherited from class com.google.maps.android.clustering.algo.NonHierarchicalDistanceBasedAlgorithm
lock, unlock -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getMaxDistanceBetweenClusteredItems
Integer getMaxDistanceBetweenClusteredItems()
-
setMaxDistanceBetweenClusteredItems
Unit setMaxDistanceBetweenClusteredItems(Integer maxDistanceBetweenClusteredItems)
-
getItems
Collection<T> getItems()
-
getClusters
Set<Cluster<T>> getClusters(Float zoom)
Returns clusters of items for the given zoom level, with cluster positions set to the centroid of their constituent items rather than the position of any single item.
- Parameters:
zoom- the current zoom level
-
-
-
-