Skip to content

Commit fc2e940

Browse files
authoredJun 20, 2024··
fix: updated docs for Clustering algorithms (#1297)
1 parent babd50c commit fc2e940

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed
 

‎library/src/main/java/com/google/maps/android/clustering/algo/GridBasedAlgorithm.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013 Google Inc.
2+
* Copyright 2024 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,15 @@
2929
import androidx.collection.LongSparseArray;
3030

3131
/**
32-
* Groups markers into a grid.
32+
* Groups markers into a grid for clustering. This algorithm organizes items into a two-dimensional grid,
33+
* facilitating the formation of clusters based on proximity within each grid cell. The grid size determines
34+
* the spatial granularity of clustering, and clusters are created by aggregating items within the same grid cell.
35+
* <p>
36+
* The effectiveness of clustering is influenced by the specified grid size, which determines the spatial resolution of the grid.
37+
* Smaller grid sizes result in more localized clusters, whereas larger grid sizes lead to broader clusters covering larger areas.
38+
* <p>
39+
*
40+
* @param <T> The type of {@link ClusterItem} to be clustered.
3341
*/
3442
public class GridBasedAlgorithm<T extends ClusterItem> extends AbstractAlgorithm<T> {
3543
private static final int DEFAULT_GRID_SIZE = 100;

‎library/src/main/java/com/google/maps/android/clustering/algo/NonHierarchicalViewBasedAlgorithm.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 Google Inc.
2+
* Copyright 2024 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,10 +28,11 @@
2828
import java.util.Collection;
2929

3030
/**
31-
* This algorithm works the same way as {@link NonHierarchicalDistanceBasedAlgorithm} but works, only in
32-
* visible area. It requires to be reclustered on camera movement because clustering is done only for visible area.
31+
* Algorithm that can be used for managing large numbers of items (>1000 markers). This algorithm works the same way as {@link NonHierarchicalDistanceBasedAlgorithm}
32+
* but works, only in visible area. It requires {@link #shouldReclusterOnMapMovement()} to be true in order to re-render clustering
33+
* when camera movement changes the visible area.
3334
*
34-
* @param <T>
35+
* @param <T> The {@link ClusterItem} type
3536
*/
3637
public class NonHierarchicalViewBasedAlgorithm<T extends ClusterItem>
3738
extends NonHierarchicalDistanceBasedAlgorithm<T> implements ScreenBasedAlgorithm<T> {

‎library/src/main/java/com/google/maps/android/clustering/algo/ScreenBasedAlgorithm.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 Google Inc.
2+
* Copyright 2024 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,9 +20,11 @@
2020
import com.google.maps.android.clustering.ClusterItem;
2121

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

2830
public interface ScreenBasedAlgorithm<T extends ClusterItem> extends Algorithm<T> {

0 commit comments

Comments
 (0)
Please sign in to comment.