-
- All Implemented Interfaces:
-
com.google.maps.android.clustering.algo.Algorithm
public final class GridBasedAlgorithm<T extends ClusterItem> extends AbstractAlgorithm<T>
Groups markers into a grid for clustering. This algorithm organizes items into a two-dimensional grid, facilitating the formation of clusters based on proximity within each grid cell. The grid size determines the spatial granularity of clustering, and clusters are created by aggregating items within the same grid cell.
The effectiveness of clustering is influenced by the specified grid size, which determines the spatial resolution of the grid. Smaller grid sizes result in more localized clusters, whereas larger grid sizes lead to broader clusters covering larger areas.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classGridBasedAlgorithm.Companion
-
Field Summary
Fields Modifier and Type Field Description private IntegermaxDistanceBetweenClusteredItemsprivate final Collection<T>items
-
Constructor Summary
Constructors Constructor Description GridBasedAlgorithm()
-
Method Summary
Modifier and Type Method Description IntegergetMaxDistanceBetweenClusteredItems()UnitsetMaxDistanceBetweenClusteredItems(Integer maxDistanceBetweenClusteredItems)Collection<T>getItems()BooleanaddItem(T item)Adds an item to the algorithm BooleanaddItems(Collection<T> items)Adds a collection of items to the algorithm UnitclearItems()BooleanremoveItem(T item)Removes an item from the algorithm BooleanremoveItems(Collection<T> items)Removes a collection of items from the algorithm BooleanupdateItem(T item)Updates the provided item in the algorithm Set<Cluster<T>>getClusters(Float zoom)-
-
Method Detail
-
getMaxDistanceBetweenClusteredItems
Integer getMaxDistanceBetweenClusteredItems()
-
setMaxDistanceBetweenClusteredItems
Unit setMaxDistanceBetweenClusteredItems(Integer maxDistanceBetweenClusteredItems)
-
getItems
Collection<T> getItems()
-
addItem
Boolean addItem(T item)
Adds an item to the algorithm
- Parameters:
item- the item to be added
-
addItems
Boolean addItems(Collection<T> items)
Adds a collection of items to the algorithm
- Parameters:
items- the items to be added
-
clearItems
Unit clearItems()
-
removeItem
Boolean removeItem(T item)
Removes an item from the algorithm
- Parameters:
item- the item to be removed
-
removeItems
Boolean removeItems(Collection<T> items)
Removes a collection of items from the algorithm
- Parameters:
items- the items to be removed
-
updateItem
Boolean updateItem(T item)
Updates the provided item in the algorithm
- Parameters:
item- the item to be updated
-
getClusters
Set<Cluster<T>> getClusters(Float zoom)
-
-
-
-