public class DefaultClusterRenderer<T extends ClusterItem> extends java.lang.Object implements ClusterRenderer<T>
| Constructor and Description |
|---|
DefaultClusterRenderer(android.content.Context context,
GoogleMap map,
ClusterManager<T> clusterManager) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
getBucket(Cluster<T> cluster)
Gets the "bucket" for a particular cluster.
|
Cluster<T> |
getCluster(Marker marker)
Get the Cluster from a marker
|
T |
getClusterItem(Marker marker)
Get the ClusterItem from a marker
|
protected java.lang.String |
getClusterText(int bucket) |
protected int |
getColor(int clusterSize) |
protected BitmapDescriptor |
getDescriptorForCluster(Cluster<T> cluster)
Gets a BitmapDescriptor for the given cluster that contains a rough count of the number of
items.
|
Marker |
getMarker(Cluster<T> cluster)
Get the marker from a Cluster
|
Marker |
getMarker(T clusterItem)
Get the marker from a ClusterItem
|
int |
getMinClusterSize() |
void |
onAdd()
Called when the view is added.
|
protected void |
onBeforeClusterItemRendered(T item,
MarkerOptions markerOptions)
Called before the marker for a ClusterItem is added to the map.
|
protected void |
onBeforeClusterRendered(Cluster<T> cluster,
MarkerOptions markerOptions)
Called before the marker for a Cluster is added to the map.
|
protected void |
onClusterItemRendered(T clusterItem,
Marker marker)
Called after the marker for a ClusterItem has been added to the map.
|
protected void |
onClusterItemUpdated(T item,
Marker marker)
Called when a cached marker for a ClusterItem already exists on the map so the marker may
be updated to the latest item values.
|
protected void |
onClusterRendered(Cluster<T> cluster,
Marker marker)
Called after the marker for a Cluster has been added to the map.
|
void |
onClustersChanged(java.util.Set<? extends Cluster<T>> clusters)
Called when the view needs to be updated because new clusters need to be displayed.
|
protected void |
onClusterUpdated(Cluster<T> cluster,
Marker marker)
Called when a cached marker for a Cluster already exists on the map so the marker may
be updated to the latest cluster values.
|
void |
onRemove()
Called when the view is removed.
|
void |
setAnimation(boolean animate)
Called to set animation on or off
|
void |
setMinClusterSize(int minClusterSize) |
void |
setOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener) |
void |
setOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener) |
void |
setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener) |
void |
setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener) |
protected boolean |
shouldRenderAsCluster(Cluster<T> cluster)
Determine whether the cluster should be rendered as individual markers or a cluster.
|
public DefaultClusterRenderer(android.content.Context context,
GoogleMap map,
ClusterManager<T> clusterManager)
public void onAdd()
ClusterRendereronAdd in interface ClusterRenderer<T extends ClusterItem>public void onRemove()
ClusterRendereronRemove in interface ClusterRenderer<T extends ClusterItem>protected int getColor(int clusterSize)
protected java.lang.String getClusterText(int bucket)
protected int getBucket(Cluster<T> cluster)
public int getMinClusterSize()
public void setMinClusterSize(int minClusterSize)
protected boolean shouldRenderAsCluster(Cluster<T> cluster)
public void onClustersChanged(java.util.Set<? extends Cluster<T>> clusters)
ClusterRendereronClustersChanged in interface ClusterRenderer<T extends ClusterItem>clusters - the clusters to be displayed.public void setOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener)
setOnClusterClickListener in interface ClusterRenderer<T extends ClusterItem>public void setOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener)
setOnClusterInfoWindowClickListener in interface ClusterRenderer<T extends ClusterItem>public void setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener)
setOnClusterItemClickListener in interface ClusterRenderer<T extends ClusterItem>public void setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener)
setOnClusterItemInfoWindowClickListener in interface ClusterRenderer<T extends ClusterItem>public void setAnimation(boolean animate)
ClusterRenderersetAnimation in interface ClusterRenderer<T extends ClusterItem>protected void onBeforeClusterItemRendered(T item, MarkerOptions markerOptions)
ClusterManager.cluster() is invoked on a set of items
onBeforeClusterItemRendered(ClusterItem, MarkerOptions) will be called and
onClusterItemUpdated(ClusterItem, Marker) will not be called.
If an item is removed and re-added (or updated) and ClusterManager.cluster() is
invoked again, then onClusterItemUpdated(ClusterItem, Marker) will be called and
onBeforeClusterItemRendered(ClusterItem, MarkerOptions) will not be called.item - item to be renderedmarkerOptions - the markerOptions representing the provided itemprotected void onClusterItemUpdated(T item, Marker marker)
ClusterManager.cluster() is invoked on a set of items
onBeforeClusterItemRendered(ClusterItem, MarkerOptions) will be called and
onClusterItemUpdated(ClusterItem, Marker) will not be called.
If an item is removed and re-added (or updated) and ClusterManager.cluster() is
invoked again, then onClusterItemUpdated(ClusterItem, Marker) will be called and
onBeforeClusterItemRendered(ClusterItem, MarkerOptions) will not be called.item - item being updatedmarker - cached marker that contains a potentially previous state of the item.protected void onBeforeClusterRendered(Cluster<T> cluster, MarkerOptions markerOptions)
ClusterManager.cluster() is invoked on a set of items
onBeforeClusterRendered(Cluster, MarkerOptions) will be called and
onClusterUpdated(Cluster, Marker) will not be called. If an item is removed and
re-added (or updated) and ClusterManager.cluster() is invoked
again, then onClusterUpdated(Cluster, Marker) will be called and
onBeforeClusterRendered(Cluster, MarkerOptions) will not be called.cluster - cluster to be renderedmarkerOptions - markerOptions representing the provided clusterprotected BitmapDescriptor getDescriptorForCluster(Cluster<T> cluster)
onBeforeClusterRendered(Cluster, MarkerOptions) and
onClusterUpdated(Cluster, Marker).cluster - cluster to get BitmapDescriptor forprotected void onClusterRendered(Cluster<T> cluster, Marker marker)
cluster - the cluster that was just added to the mapmarker - the marker representing the cluster that was just added to the mapprotected void onClusterUpdated(Cluster<T> cluster, Marker marker)
ClusterManager.cluster() is invoked on a set of items
onBeforeClusterRendered(Cluster, MarkerOptions) will be called and
onClusterUpdated(Cluster, Marker) will not be called. If an item is removed and
re-added (or updated) and ClusterManager.cluster() is invoked
again, then onClusterUpdated(Cluster, Marker) will be called and
onBeforeClusterRendered(Cluster, MarkerOptions) will not be called.cluster - cluster being updatedmarker - cached marker that contains a potentially previous state of the clusterprotected void onClusterItemRendered(T clusterItem, Marker marker)
clusterItem - the item that was just added to the mapmarker - the marker representing the item that was just added to the mappublic Marker getMarker(T clusterItem)
clusterItem - ClusterItem which you will obtain its markerpublic T getClusterItem(Marker marker)
marker - which you will obtain its ClusterItempublic Marker getMarker(Cluster<T> cluster)
cluster - which you will obtain its marker