Class ClusteredVectorLayer


public class ClusteredVectorLayer extends VectorLayer
A vector layer that supports clustering point-type features.
A Pairwise centroid hierarchical clustering algorithm is used internally.
  • Constructor Details

    • ClusteredVectorLayer

      public ClusteredVectorLayer(LocalVectorDataSource dataSource, ClusterElementBuilder clusterElementBuilder)
      Constructs a new ClusteredVectorLayer instance from data source and a special callback.
      Parameters:
      dataSource - The local data source that contains the elements for clustering.
      clusterElementBuilder - The callback for creating and customizing cluster elements.
  • Method Details

    • getClusterElementBuilder

      public ClusterElementBuilder getClusterElementBuilder()
      Returns the current callback used for creating cluster elements.
      Returns:
      The associated callback.
    • getMinimumClusterDistance

      public float getMinimumClusterDistance()
      Returns the current minimum distance between clusters (in device-independent pixels).
      Returns:
      The current minimum clustering distance.
    • setMinimumClusterDistance

      public void setMinimumClusterDistance(float px)
      Sets the minimum distance between clusters (in device-independent pixels).
      Parameters:
      px - The new value in device-independent pixels. The default is 100.
    • getMaximumClusterZoom

      public float getMaximumClusterZoom()
      Returns the maximum zoom level when clusters are shown. If zoom level is greater, then
      clusters are replaced with individual elements. Default is 24.
      Returns:
      The maximum clustering zoom level.
    • setMaximumClusterZoom

      public void setMaximumClusterZoom(float maxZoom)
      Sets the maximum zoom level when clusters are shown. If zoom level is greater, then
      clusters are replaced with individual elements.
      Parameters:
      maxZoom - The new maximum clustering zoom level.
    • isAnimatedClusters

      public boolean isAnimatedClusters()
      Returns the cluster animation flag value.
      Returns:
      True if animation is enabled, false otherwise.
    • setAnimatedClusters

      public void setAnimatedClusters(boolean animated)
      Enables or disables the animation of clusters. By default animations are enabled.
      Parameters:
      animated - The animated flag.
    • expandCluster

      public boolean expandCluster(VectorElement clusterElement, float px)
      Expands or shrinks the given cluster element. In expanded state,
      all elements of the cluster are placed at specified distance from the cluster center.
      Parameters:
      clusterElement - The cluster element to expand or shrink.
      px - The distance (in device-independent pixels) between cluster center and expanded elements. Use 0 to shrink already expanded cluster.
      Returns:
      True if the element was found and expanded/shrunk. False otherwise.
    • refresh

      public void refresh()
      Description copied from class: Layer
      Refreshes the layer using old stored visibility information. This method might be called if some of the layer data
      changes.
      Overrides:
      refresh in class Layer