Skip to content

MapLibre: implement the adjacency route-badge layer (parity with Google, #1827)#1930

Merged
bmander merged 1 commit into
mainfrom
fix/1913-maplibre-route-badge
Jul 17, 2026
Merged

MapLibre: implement the adjacency route-badge layer (parity with Google, #1827)#1930
bmander merged 1 commit into
mainfrom
fix/1913-maplibre-route-badge

Conversation

@bmander

@bmander bmander commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements the focused-stop adjacency route-badge layer (RouteBadge, Adjacency focus: on stop tap, draw the routes serving it, dim other stops, badge routes to tap into #1827) in MapLibreRenderer, previously rendered only by GoogleMapRenderer.
  • renderRouteBadges() mirrors the Google flavor: a routeBadgeByMarker tap-target map, drawn last (no z-index in maplibre's classic annotation API, so draw order is the ordering mechanism), reusing the shared ContinuationBadgeBitmaps.badge(...) bitmap generator via iconFactory.fromBitmap(...). No .anchor() call is needed since maplibre's classic Marker centers its icon by default.
  • Wires the tap in MapLibreComposeAdapter's marker-click listener to ObaMapCallbacks.onRouteBadgeClick(...), same callback the Google flavor already fires — no changes needed to the shared callback interface or MapFeature's handler.
  • Cleans up doc comments in MapRenderState.kt, GoogleMapRenderer.kt, and RouteViewGeometry.kt that described this as a Google-only / MapLibre-deferred layer, since both flavors now render it.

Closes #1913.

Test plan

  • ./gradlew :onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true — clean
  • ./gradlew :onebusaway-android:compileObaMaplibreDebugKotlin -PwarningsAsErrors=true — clean
  • ./gradlew :onebusaway-android:testObaGoogleDebugUnitTest :onebusaway-android:testObaMaplibreDebugUnitTest — pass
  • Manual verification on device (focused-stop adjacency view, MapLibre flavor): badges render at the correct route line midpoints and tapping one enters route mode on that route's direction

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added route badges to MapLibre maps, including light and dark theme support.
    • Route badge taps now open the corresponding route and direction.
  • Documentation

    • Updated map rendering documentation to accurately describe route badge behavior across supported map types.

Mirrors GoogleMapRenderer's route-badge rendering (#1827): a routeBadgeByMarker
map tracks tap targets, renderRouteBadges() draws each badge as a classic
Marker with a bitmap icon reused from the shared ContinuationBadgeBitmaps
generator, and the compose adapter's click listener routes a badge tap to
ObaMapCallbacks.onRouteBadgeClick(), same as the Google flavor. No anchor call
is needed (maplibre centers a classic Marker's icon by default) and there's no
z-index equivalent, so badges are simply drawn last to stay on top.

Also updates the doc comments across MapRenderState.kt, GoogleMapRenderer.kt,
and RouteViewGeometry.kt that described this as a Google-only / MapLibre-
deferred layer, since both flavors now render it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c48219d9-8912-4cf8-b467-5b3e69ee0aa5

📥 Commits

Reviewing files that changed from the base of the PR and between 6c71ddd and 58b639f.

📒 Files selected for processing (5)
  • onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/GoogleMapRenderer.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/map/RouteViewGeometry.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/map/render/MapRenderState.kt
  • onebusaway-android/src/maplibre/java/org/onebusaway/android/map/maplibre/MapLibreRenderer.kt
  • onebusaway-android/src/maplibre/java/org/onebusaway/android/map/maplibre/compose/MapLibreComposeAdapter.kt

📝 Walkthrough

Walkthrough

MapLibre now renders adjacency route badges as themed markers, retains marker-to-badge associations, exposes badge lookup, and routes badge taps to callbacks. Related KDoc comments now describe badge rendering across both map flavors.

Changes

Route-badge rendering parity

Layer / File(s) Summary
Render and manage badge markers
onebusaway-android/src/maplibre/.../MapLibreRenderer.kt, onebusaway-android/src/main/java/.../RouteViewGeometry.kt, onebusaway-android/src/main/java/.../MapRenderState.kt, onebusaway-android/src/google/.../GoogleMapRenderer.kt
MapLibre renders themed route-badge markers, tracks their associated RouteBadge values, clears them during redraw and disposal, and related KDoc describes both map flavors.
Route badge taps
onebusaway-android/src/maplibre/.../MapLibreRenderer.kt, onebusaway-android/src/maplibre/.../compose/MapLibreComposeAdapter.kt
The adapter identifies tapped badge markers, invokes onRouteBadgeClick with badge details, and consumes the tap.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MapLibreComposeAdapter
  participant MapLibreRenderer
  participant RouteBadge
  participant Callback
  MapLibreComposeAdapter->>MapLibreRenderer: routeBadgeForMarker(marker)
  MapLibreRenderer-->>MapLibreComposeAdapter: RouteBadge or null
  MapLibreComposeAdapter->>RouteBadge: read routeId, routeShortName, directionId
  MapLibreComposeAdapter->>Callback: onRouteBadgeClick(...)
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding the adjacency route-badge layer in MapLibre for parity with Google.
Linked Issues check ✅ Passed The PR implements the tracked MapLibre route-badge layer, including rendering and tap handling, matching issue #1913.
Out of Scope Changes check ✅ Passed The changes stay within the requested MapLibre parity work and related documentation updates, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1913-maplibre-route-badge

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bmander
bmander merged commit 193365b into main Jul 17, 2026
3 checks passed
@bmander
bmander deleted the fix/1913-maplibre-route-badge branch July 17, 2026 04:27
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.

MapLibre: implement the adjacency route-badge layer (parity with Google, #1827)

1 participant