Skip to content

Commit

Permalink
fix: updated docs for Clustering algorithms (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
kikoso authored Jun 20, 2024
1 parent babd50c commit fc2e940
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 Google Inc.
* Copyright 2024 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,15 @@
import androidx.collection.LongSparseArray;

/**
* Groups markers into a grid.
* Groups markers into a grid for clustering. This algorithm organizes items into a two-dimensional grid,
* facilitating the formation of clusters based on proximity within each grid cell. The grid size determines
* the spatial granularity of clustering, and clusters are created by aggregating items within the same grid cell.
* <p>
* The effectiveness of clustering is influenced by the specified grid size, which determines the spatial resolution of the grid.
* Smaller grid sizes result in more localized clusters, whereas larger grid sizes lead to broader clusters covering larger areas.
* <p>
*
* @param <T> The type of {@link ClusterItem} to be clustered.
*/
public class GridBasedAlgorithm<T extends ClusterItem> extends AbstractAlgorithm<T> {
private static final int DEFAULT_GRID_SIZE = 100;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Google Inc.
* Copyright 2024 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,10 +28,11 @@
import java.util.Collection;

/**
* This algorithm works the same way as {@link NonHierarchicalDistanceBasedAlgorithm} but works, only in
* visible area. It requires to be reclustered on camera movement because clustering is done only for visible area.
* Algorithm that can be used for managing large numbers of items (>1000 markers). This algorithm works the same way as {@link NonHierarchicalDistanceBasedAlgorithm}
* but works, only in visible area. It requires {@link #shouldReclusterOnMapMovement()} to be true in order to re-render clustering
* when camera movement changes the visible area.
*
* @param <T>
* @param <T> The {@link ClusterItem} type
*/
public class NonHierarchicalViewBasedAlgorithm<T extends ClusterItem>
extends NonHierarchicalDistanceBasedAlgorithm<T> implements ScreenBasedAlgorithm<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Google Inc.
* Copyright 2024 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,9 +20,11 @@
import com.google.maps.android.clustering.ClusterItem;

/**
* This algorithm uses map position for clustering, and should be reclustered on map movement
* This abstract interface provides two methods: one to determine if the map should recluster when
* the map moves ({@link #shouldReclusterOnMapMovement()}), and another method to determine the
* behavior when the camera moves ({@link #onCameraChange(CameraPosition)} ()})
*
* @param <T>
* @param <T> The {@link ClusterItem} type
*/

public interface ScreenBasedAlgorithm<T extends ClusterItem> extends Algorithm<T> {
Expand Down

0 comments on commit fc2e940

Please sign in to comment.