-
- All Implemented Interfaces:
-
com.google.maps.android.clustering.algo.Algorithm
public 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.
-
-
Method Summary
Modifier and Type Method Description boolean
addItem(T item)
Adds an item to the algorithm boolean
addItems(Collection<T> items)
Adds a collection of items to the algorithm void
clearItems()
boolean
removeItem(T item)
Removes an item from the algorithm boolean
removeItems(Collection<T> items)
Removes a collection of items from the algorithm boolean
updateItem(T item)
Updates the provided item in the algorithm void
setMaxDistanceBetweenClusteredItems(int maxDistance)
int
getMaxDistanceBetweenClusteredItems()
Set<out Cluster<T>>
getClusters(float zoom)
Collection<T>
getItems()
-
-
Method Detail
-
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
void 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
-
setMaxDistanceBetweenClusteredItems
void setMaxDistanceBetweenClusteredItems(int maxDistance)
-
getMaxDistanceBetweenClusteredItems
int getMaxDistanceBetweenClusteredItems()
-
getClusters
Set<out Cluster<T>> getClusters(float zoom)
-
getItems
Collection<T> getItems()
-
-
-
-