Class DefaultClusterRenderer<T extends ClusterItem>

  • All Implemented Interfaces:
    ClusterRenderer<T>

    public class DefaultClusterRenderer<T extends ClusterItem>
    extends java.lang.Object
    implements ClusterRenderer<T>
    The default view for a ClusterManager. Markers are animated in and out of clusters.
    • Constructor Detail

      • DefaultClusterRenderer

        public DefaultClusterRenderer​(android.content.Context context,
                                      com.google.android.gms.maps.GoogleMap map,
                                      ClusterManager<T> clusterManager)
    • Method Detail

      • getMinClusterSize

        public int getMinClusterSize()
        Gets the minimum cluster size used to render clusters. For example, if "4" is returned, then for any clusters of size 3 or less the items will be rendered as individual markers instead of as a single cluster marker.
        Returns:
        the minimum cluster size used to render clusters. For example, if "4" is returned, then for any clusters of size 3 or less the items will be rendered as individual markers instead of as a single cluster marker.
      • setMinClusterSize

        public void setMinClusterSize​(int minClusterSize)
        Sets the minimum cluster size used to render clusters. For example, if "4" is provided, then for any clusters of size 3 or less the items will be rendered as individual markers instead of as a single cluster marker.
        Parameters:
        minClusterSize - the minimum cluster size used to render clusters. For example, if "4" is provided, then for any clusters of size 3 or less the items will be rendered as individual markers instead of as a single cluster marker.
      • onClustersChanged

        public void onClustersChanged​(java.util.Set<? extends Cluster<T>> clusters)
        Description copied from interface: ClusterRenderer
        Called when the view needs to be updated because new clusters need to be displayed.
        Specified by:
        onClustersChanged in interface ClusterRenderer<T extends ClusterItem>
        Parameters:
        clusters - the clusters to be displayed.
      • setAnimationDuration

        public void setAnimationDuration​(long animationDurationMs)
        Sets the length of the animation in milliseconds. The default duration is 300 milliseconds.
        Specified by:
        setAnimationDuration in interface ClusterRenderer<T extends ClusterItem>
        Parameters:
        animationDurationMs - long: The length of the animation, in milliseconds. This value cannot be negative.
      • getMarker

        public com.google.android.gms.maps.model.Marker getMarker​(T clusterItem)
        Get the marker from a ClusterItem
        Parameters:
        clusterItem - ClusterItem which you will obtain its marker
        Returns:
        a marker from a ClusterItem or null if it does not exists
      • getClusterItem

        public T getClusterItem​(com.google.android.gms.maps.model.Marker marker)
        Get the ClusterItem from a marker
        Parameters:
        marker - which you will obtain its ClusterItem
        Returns:
        a ClusterItem from a marker or null if it does not exists
      • getMarker

        public com.google.android.gms.maps.model.Marker getMarker​(Cluster<T> cluster)
        Get the marker from a Cluster
        Parameters:
        cluster - which you will obtain its marker
        Returns:
        a marker from a cluster or null if it does not exists
      • getCluster

        public Cluster<T> getCluster​(com.google.android.gms.maps.model.Marker marker)
        Get the Cluster from a marker
        Parameters:
        marker - which you will obtain its Cluster
        Returns:
        a Cluster from a marker or null if it does not exists