Skip to content

feat(clustering): add SuperCluster algorithm demo and configurable popup menu controls - #1017

Open
dkhawk wants to merge 1 commit into
mainfrom
test/supercluster-compose
Open

dkhawk wants to merge 1 commit into
mainfrom
test/supercluster-compose

Conversation

@dkhawk

@dkhawk dkhawk commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

This draft PR integrates the new high-performance SuperClusterAlgorithm into the Maps Compose sample demo app (maps-app), replacing horizontal chip bars with an elegant floating Material 3 control bar featuring popup menus and configurable dataset sizes up to 100,000 markers.

Note: This PR is currently in Draft state for integration testing and benchmarking against the upcoming android-maps-utils-clustering release containing SuperClusterAlgorithm (PR googlemaps/android-maps-utils#1799).

Key Additions & Improvements

  1. SuperCluster Integration:

    • Added SuperClusterNative mode: leverages SuperClusterAlgorithm with DefaultClusterRenderer, compact SI unit notation (k/m), and cached bitmap badges for 60fps pan/zoom across tens of thousands of markers.
    • Added SuperClusterCompose mode: uses Compose UI cluster badges while using native marker rendering for unclustered pins (clusterItemContent = null) to avoid allocating thousands of ComposeView hierarchies on the UI thread.
  2. 50K & 100K Dataset Buckets:

    • Added 50,000 (50K) and 100,000 (100K) marker buckets alongside 10, 500, 2,500, 10,000, and 25,000.
    • Tuned regional coordinate dispersion (spread = 4.0) for realistic multi-level hierarchical clustering across Singapore and neighboring regions.
  3. Floating Control Bar with Popup Menus (ClusteringControlBar):

    • Replaced clunky horizontal chip rows with a compact floating Material 3 Card pinned at TopCenter.
    • Algorithm Popup Menu: FilledTonalButton with ArrowDropDown to pick between all available clustering modes with selection checkmarks.
    • Dataset Size Popup Menu: FilledTonalButton with ArrowDropDown to pick marker counts from 10 to 100K.
    • Directly Visible Animation Toggle: A FilterChip labeled Anim ON / Anim OFF directly visible on the bar to evaluate the performance difference between 300ms frame interpolation and instant zero-overhead clustering.
  4. Heap Headroom:

    • Enabled android:largeHeap="true" in maps-app/src/main/AndroidManifest.xml for smooth mega-scale testing.

@dkhawk
dkhawk force-pushed the test/supercluster-compose branch from cec7d48 to f89bead Compare October 1, 2026 21:07
…pup menu controls

- Integrate SuperClusterAlgorithm from android-maps-utils-clustering:5.2.0 into Maps Compose demo app.
- Add SuperClusterNative (high-performance native markers with compact badge formatting) and SuperClusterCompose modes.
- Replace scrolling chip bars with a floating Material 3 ClusteringControlBar featuring popup menus for algorithm and dataset selection.
- Add 50,000 (50K) and 100,000 (100K) dataset buckets with realistic regional point spread.
- Add directly visible Anim: ON / Anim: OFF toggle to compare 300ms marker transition animations against instant 60fps clustering.
- Enable largeHeap in maps-app/src/main/AndroidManifest.xml for mega-scale marker headroom.
@dkhawk
dkhawk marked this pull request as ready for review November 13, 2026 23:04
@dkhawk
dkhawk force-pushed the test/supercluster-compose branch from f89bead to 32b36cc Compare November 13, 2026 23:04
onClick = { onClusteringTypeClick(it) },
fun SuperClusterNativeClustering(items: List<MyItem>, enableAnimation: Boolean) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
fun SuperClusterNativeClustering(items: List<MyItem>, enableAnimation: Boolean) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
val screenWidth = configuration.screenWidthDp.dp
@Composable
fun SuperClusterComposeClustering(items: List<MyItem>, enableAnimation: Boolean) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
fun SuperClusterComposeClustering(items: List<MyItem>, enableAnimation: Boolean) {
val configuration = LocalConfiguration.current
val screenHeight = configuration.screenHeightDp.dp
val screenWidth = configuration.screenWidthDp.dp
val items = remember { mutableStateListOf<MyItem>() }
LaunchedEffect(Unit) {
for (i in 1..10) {
var itemCount by remember { mutableStateOf(50000) }
@github-actions

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 1fc2bbb on main (#1083).

Module Line % Change Branch % Change
maps-compose 15.27% no change 3.75% no change
maps-compose-utils 26.29% no change 12.70% no change
maps-compose-widgets 3.87% no change 0.00% no change
TOTAL 17.35% no change 5.46% no change

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants