-
- 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 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.
-
Constructor Summary
Constructors Constructor Description ClusterManager(Context context, GoogleMap map)ClusterManager(Context context, GoogleMap map, MarkerManager markerManager)
-
Method Summary
Modifier and Type Method Description MarkerManager.CollectiongetMarkerCollection()MarkerManager.CollectiongetClusterMarkerCollection()MarkerManagergetMarkerManager()voidsetRenderer(ClusterRenderer<T> renderer)voidsetAlgorithm(Algorithm<T> algorithm)voidsetAlgorithm(ScreenBasedAlgorithm<T> algorithm)voidsetAnimation(boolean animate)ClusterRenderer<T>getRenderer()Algorithm<T>getAlgorithm()voidclearItems()Removes all items from the cluster manager. booleanaddItems(Collection<T> items)Adds items to clusters. booleanaddItem(T myItem)Adds an item to a cluster. voiddiff(@Nullable() Collection<T> add, @Nullable() Collection<T> remove, @Nullable() Collection<T> modify)booleanremoveItems(Collection<T> items)Removes items from clusters. booleanremoveItem(T item)Removes an item from clusters. booleanupdateItem(T item)Updates an item in clusters. voidcluster()Force a re-cluster on the map. voidonCameraIdle()Might re-cluster. booleanonMarkerClick(@NonNull() Marker marker)voidonInfoWindowClick(@NonNull() Marker marker)voidsetOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)Sets a callback that's invoked when a Cluster is tapped. voidsetOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)Sets a callback that's invoked when a Cluster info window is tapped. voidsetOnClusterInfoWindowLongClickListener(ClusterManager.OnClusterInfoWindowLongClickListener<T> listener)Sets a callback that's invoked when a Cluster info window is long-pressed. voidsetOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem is tapped. voidsetOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem's Info Window is tapped. voidsetOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)Sets a callback that's invoked when an individual ClusterItem's Info Window is long-pressed. -
Methods inherited from class com.google.android.gms.maps.GoogleMap.OnCameraIdleListener
onCameraIdle -
Methods inherited from class com.google.android.gms.maps.GoogleMap.OnMarkerClickListener
onMarkerClick -
Methods inherited from class com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener
onInfoWindowClick -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ClusterManager
ClusterManager(Context context, GoogleMap map)
-
ClusterManager
ClusterManager(Context context, GoogleMap map, MarkerManager markerManager)
-
-
Method Detail
-
getMarkerCollection
MarkerManager.Collection getMarkerCollection()
-
getClusterMarkerCollection
MarkerManager.Collection getClusterMarkerCollection()
-
getMarkerManager
MarkerManager getMarkerManager()
-
setRenderer
void setRenderer(ClusterRenderer<T> renderer)
-
setAlgorithm
void setAlgorithm(Algorithm<T> algorithm)
-
setAlgorithm
void setAlgorithm(ScreenBasedAlgorithm<T> algorithm)
-
setAnimation
void setAnimation(boolean animate)
-
getRenderer
ClusterRenderer<T> getRenderer()
-
getAlgorithm
Algorithm<T> getAlgorithm()
-
clearItems
void clearItems()
Removes all items from the cluster manager. After calling this method you must invoke cluster for the map to be cleared.
-
addItems
boolean addItems(Collection<T> items)
Adds items to clusters. After calling this method you must invoke cluster for thestate of the clusters to be updated on the map.
- Parameters:
items- items to add to clusters
-
addItem
boolean addItem(T myItem)
Adds an item to a cluster. After calling this method you must invoke cluster forthe state of the clusters to be updated on the map.
- Parameters:
myItem- item to add to clusters
-
diff
void diff(@Nullable() Collection<T> add, @Nullable() Collection<T> remove, @Nullable() Collection<T> modify)
-
removeItems
boolean removeItems(Collection<T> items)
Removes items from clusters. After calling this method you must invoke cluster forthe state of the clusters to be updated on the map.
- Parameters:
items- items to remove from clusters
-
removeItem
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
boolean updateItem(T item)
Updates an item in clusters. After calling this method you must invoke cluster forthe state of the clusters to be updated on the map.
- Parameters:
item- item to update in clusters
-
cluster
void cluster()
Force a re-cluster on the map. You should call this after adding, removing, updating,or clearing item(s).
-
onCameraIdle
void onCameraIdle()
Might re-cluster.
-
onMarkerClick
boolean onMarkerClick(@NonNull() Marker marker)
-
onInfoWindowClick
void onInfoWindowClick(@NonNull() Marker marker)
-
setOnClusterClickListener
void 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
void 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
void 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
void setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem is tapped. Note: For thislistener to function, the ClusterManager must be added as a click listener to the map.
-
setOnClusterItemInfoWindowClickListener
void setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem's Info Window is tapped. Note: For thislistener to function, the ClusterManager must be added as a info window click listener to the map.
-
setOnClusterItemInfoWindowLongClickListener
void setOnClusterItemInfoWindowLongClickListener(ClusterManager.OnClusterItemInfoWindowLongClickListener<T> listener)
Sets a callback that's invoked when an individual ClusterItem's Info Window is long-pressed. Note: For thislistener to function, the ClusterManager must be added as a info window click listener to the map.
-
-
-
-