-
- All Implemented Interfaces:
-
com.google.android.gms.maps.GoogleMap.OnCameraIdleListener,com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener,com.google.android.gms.maps.GoogleMap.OnMarkerClickListener
public final class ClusterManager<T extends ClusterItem> implements GoogleMap.OnCameraIdleListener, GoogleMap.OnMarkerClickListener, GoogleMap.OnInfoWindowClickListenerGroups many items on a map based on zoom level.
ClusterManager should be added to the map as an: * com.google.android.gms.maps.GoogleMap.OnCameraIdleListener
com.google.android.gms.maps.GoogleMap.OnMarkerClickListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceClusterManager.OnClusterClickListenerCalled when a Cluster is clicked.
public interfaceClusterManager.OnClusterInfoWindowClickListenerCalled when a Cluster's Info Window is clicked.
public interfaceClusterManager.OnClusterInfoWindowLongClickListenerCalled when a Cluster's Info Window is long clicked.
public interfaceClusterManager.OnClusterItemClickListenerCalled when an individual ClusterItem is clicked.
public interfaceClusterManager.OnClusterItemInfoWindowClickListenerCalled when an individual ClusterItem's Info Window is clicked.
public interfaceClusterManager.OnClusterItemInfoWindowLongClickListenerCalled when an individual ClusterItem's Info Window is long clicked.
-
Field Summary
Fields Modifier and Type Field Description private final MarkerManager.CollectionmarkerCollectionprivate final MarkerManager.CollectionclusterMarkerCollectionprivate ClusterRenderer<T>rendererprivate Algorithm<T>algorithmprivate final MarkerManagermarkerManager
-
Constructor Summary
Constructors Constructor Description ClusterManager(Context context, GoogleMap mMap, MarkerManager markerManager)ClusterManager(Context context, GoogleMap mMap)
-
Method Summary
Modifier and Type Method Description final MarkerManager.CollectiongetMarkerCollection()final MarkerManager.CollectiongetClusterMarkerCollection()final ClusterRenderer<T>getRenderer()final UnitsetRenderer(ClusterRenderer<T> renderer)final Algorithm<T>getAlgorithm()final UnitsetAlgorithm(Algorithm<T> algorithm)final MarkerManagergetMarkerManager()final UnitsetAlgorithm(ScreenBasedAlgorithm<T> algorithm)final UnitsetAnimation(Boolean animate)final UnitclearItems()Removes all items from the cluster manager. final BooleanaddItems(Collection<T> items)Adds items to clusters. final BooleanaddItem(T myItem)Adds an item to a cluster. final Unitdiff(Collection<T> add, Collection<T> remove, Collection<T> modify)final BooleanremoveItems(Collection<T> items)Removes items from clusters. final BooleanremoveItem(T item)Removes an item from clusters. final BooleanupdateItem(T item)Updates an item in clusters. final Unitcluster()Force a re-cluster on the map. UnitonCameraIdle()Might re-cluster. BooleanonMarkerClick(Marker marker)UnitonInfoWindowClick(Marker marker)final UnitsetOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)Sets a callback that's invoked when a Cluster is tapped. final UnitsetOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)Sets a callback that's invoked when a Cluster info window is tapped. final UnitsetOnClusterInfoWindowLongClickListener(ClusterManager.OnClusterInfoWindowLongClickListener<T> listener)Sets a callback that's invoked when a Cluster info window is long-pressed. final UnitsetOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem is tapped. final UnitsetOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem's Info Window is tapped. final UnitsetOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem's Info Window is long-pressed. -
-
Method Detail
-
getMarkerCollection
final MarkerManager.Collection getMarkerCollection()
-
getClusterMarkerCollection
final MarkerManager.Collection getClusterMarkerCollection()
-
getRenderer
final ClusterRenderer<T> getRenderer()
-
setRenderer
final Unit setRenderer(ClusterRenderer<T> renderer)
-
getAlgorithm
final Algorithm<T> getAlgorithm()
-
setAlgorithm
final Unit setAlgorithm(Algorithm<T> algorithm)
-
getMarkerManager
final MarkerManager getMarkerManager()
-
setAlgorithm
final Unit setAlgorithm(ScreenBasedAlgorithm<T> algorithm)
-
setAnimation
final Unit setAnimation(Boolean animate)
-
clearItems
final Unit clearItems()
Removes all items from the cluster manager. After calling this method you must invoke .cluster for the map to be cleared.
-
addItems
final Boolean addItems(Collection<T> items)
Adds items to clusters. After calling this method you must invoke .cluster for the state of the clusters to be updated on the map.
- Parameters:
items- items to add to clusters
-
addItem
final Boolean addItem(T myItem)
Adds an item to a cluster. After calling this method you must invoke .cluster for the state of the clusters to be updated on the map.
- Parameters:
myItem- item to add to clusters
-
diff
final Unit diff(Collection<T> add, Collection<T> remove, Collection<T> modify)
-
removeItems
final Boolean removeItems(Collection<T> items)
Removes items from clusters. After calling this method you must invoke .cluster for the state of the clusters to be updated on the map.
- Parameters:
items- items to remove from clusters
-
removeItem
final Boolean removeItem(T item)
Removes an item from clusters. After calling this method you must invoke .cluster for the state of the clusters to be updated on the map.
- Parameters:
item- item to remove from clusters
-
updateItem
final Boolean updateItem(T item)
Updates an item in clusters. After calling this method you must invoke .cluster for the state of the clusters to be updated on the map.
- Parameters:
item- item to update in clusters
-
cluster
final Unit cluster()
Force a re-cluster on the map. You should call this after adding, removing, updating, or clearing item(s).
-
onCameraIdle
Unit onCameraIdle()
Might re-cluster.
-
onMarkerClick
Boolean onMarkerClick(Marker marker)
-
onInfoWindowClick
Unit onInfoWindowClick(Marker marker)
-
setOnClusterClickListener
final Unit setOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)
Sets a callback that's invoked when a Cluster is tapped. Note: For this listener to function, the ClusterManager must be added as a click listener to the map.
-
setOnClusterInfoWindowClickListener
final Unit setOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)
Sets a callback that's invoked when a Cluster info window is tapped. Note: For this listener to function, the ClusterManager must be added as a info window click listener to the map.
-
setOnClusterInfoWindowLongClickListener
final Unit setOnClusterInfoWindowLongClickListener(ClusterManager.OnClusterInfoWindowLongClickListener<T> listener)
Sets a callback that's invoked when a Cluster info window is long-pressed. Note: For this listener to function, the ClusterManager must be added as a info window click listener to the map.
-
setOnClusterItemClickListener
final Unit setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem is tapped. Note: For this listener to function, the ClusterManager must be added as a click listener to the map.
-
setOnClusterItemInfoWindowClickListener
final Unit setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem's Info Window is tapped. Note: For this listener to function, the ClusterManager must be added as a info window click listener to the map.
-
setOnClusterItemInfoWindowLongClickListener
final Unit setOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem's Info Window is long-pressed. Note: For this listener to function, the ClusterManager must be added as a info window click listener to the map.
-
-
-
-