CentroidNonHierarchicalDistanceBasedAlgorithm

A variant of NonHierarchicalDistanceBasedAlgorithm that clusters items based on distance but assigns cluster positions at the centroid of their items, instead of using the position of a single item as the cluster position.

This algorithm overrides getClusters to compute a geographic centroid for each cluster and creates StaticCluster instances positioned at these centroids. This can provide a more accurate visual representation of the cluster location.

Parameters

<T>

the type of cluster item

Constructors

constructor()

Functions

Link copied to clipboard
open fun addItem(item: T): Boolean
Adds an item to the algorithm
Link copied to clipboard
open fun addItems(items: Collection<T>): Boolean
Adds a collection of items to the algorithm
Link copied to clipboard
open fun clearItems()
Link copied to clipboard
open fun getClusters(zoom: Float): Set<out Cluster<T>>
Returns clusters of items for the given zoom level, with cluster positions set to the centroid of their constituent items rather than the position of any single item.
Link copied to clipboard
open fun getItems(): Collection<T>
Link copied to clipboard
open fun lock()
Link copied to clipboard
open fun removeItem(item: T): Boolean
Removes an item from the algorithm
Link copied to clipboard
open fun removeItems(items: Collection<T>): Boolean
Removes a collection of items from the algorithm
Link copied to clipboard
Link copied to clipboard
open fun unlock()
Link copied to clipboard
open fun updateItem(item: T): Boolean
Updates the provided item in the algorithm