Skip to content

Unify route focus rendering#1892

Merged
bmander merged 1 commit into
mainfrom
agent/route-focus-rendering
Jul 16, 2026
Merged

Unify route focus rendering#1892
bmander merged 1 commit into
mainfrom
agent/route-focus-rendering

Conversation

@bmander

@bmander bmander commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • introduce reusable route-line width profiles that own thickness and zoom scaling
  • render single-route view with the same focused profile used when selecting a route from stop mode
  • apply the focused route-stop circle zoom ramp in route view across Google Maps and MapLibre
  • keep per-polyline native widths reconciled correctly as zoom changes
  • add focused tests for width profiles, route geometry, and route-stop scale state

Why

Single-route view used a thinner base line and kept route-stop circles at full size while a route focused from stop mode used a thicker, zoom-scaled presentation. This made equivalent route-focus states look inconsistent.

The rendering policy is now explicit and shared, so the line thickness, zoom endpoint, multiplier schedule, and stop-circle behavior remain aligned between both entry points.

Validation

  • ./gradlew :onebusaway-android:testObaGoogleDebugUnitTest --tests org.onebusaway.android.map.RouteViewGeometryTest --tests org.onebusaway.android.map.render.RouteLineWidthProfileTest --tests org.onebusaway.android.map.render.MapRenderStateRouteStopScaleTest --tests org.onebusaway.android.map.render.StopZoomBandTest --tests org.onebusaway.android.map.render.RoutePolylineRenderPipelineTest
  • ./gradlew :onebusaway-android:compileObaMaplibreDebugKotlin
  • git diff --check
  • installed and visually verified the Google debug build on a Pixel 7 Pro

Summary by CodeRabbit

  • Enhancements

    • Route lines now resize smoothly based on map zoom level.
    • Focused routes appear more prominent, while alternate routes are visually de-emphasized.
    • Route continuation lines now follow the same zoom-aware sizing.
    • Stop markers and circles now scale consistently during route-focused views and zoom changes.
  • Bug Fixes

    • Improved map rendering updates when zooming or changing route focus, reducing unnecessary visual refreshes.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Route rendering now uses zoom-dependent width profiles and per-polyline width caches. Route-stop layers receive explicit zoom-scaling state, while map state and controllers propagate that state across Google Maps and MapLibre. Selected-trip geometry and scheduled stop ordering are also integrated.

Changes

Zoom-aware route rendering

Layer / File(s) Summary
Width profiles and render-state contracts
onebusaway-android/src/main/java/org/onebusaway/android/map/render/*
Route polylines use configurable zoom-dependent width profiles, and snapshots track whether route stops scale with zoom.
Route geometry and presentation wiring
onebusaway-android/src/main/java/org/onebusaway/android/map/RouteMapController.kt, onebusaway-android/src/main/java/org/onebusaway/android/map/RouteViewGeometry.kt, onebusaway-android/src/main/java/org/onebusaway/android/map/RouteMapRepository.kt
Continuation, focused, emphasized, and de-emphasized route lines use width profiles; selected trips use exact shapes and scheduled stop ordering; route-mode stop scaling is published in render state.
Renderer width and stop-layer reconciliation
onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/*, onebusaway-android/src/maplibre/java/org/onebusaway/android/map/maplibre/*, onebusaway-android/src/*/compose/*
Google Maps and MapLibre recalculate individual route widths at render and camera-settled stages, and stop layers use explicit zoom-scaling state.
Profile and state validation
onebusaway-android/src/test/java/org/onebusaway/android/map/*
Tests cover width-profile interpolation, route geometry profile selection, route-stop scaling state, scheduled stop ordering, and updated rendering fixtures.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VehicleSelection
  participant RouteMapController
  participant MapRenderState
  participant MapRenderer
  participant RouteStopLayer
  VehicleSelection->>RouteMapController: select vehicle trip
  RouteMapController->>RouteMapController: load trip shape and schedule
  RouteMapController->>MapRenderState: publish selected geometry and stop scaling state
  MapRenderState->>MapRenderer: provide render snapshot
  MapRenderer->>MapRenderer: resolve profile widths at camera zoom
  MapRenderer->>RouteStopLayer: render stops with zoom scaling flag
  MapRenderer->>MapRenderer: update retained widths on camera settle
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.03% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: unifying route focus rendering across single-route and stop-based views.
✨ 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 agent/route-focus-rendering

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 marked this pull request as ready for review July 16, 2026 17:16
@bmander bmander changed the title Unify route focus rendering Unify route focus rendering around exact trip geometry Jul 16, 2026
@bmander
bmander force-pushed the agent/route-focus-rendering branch from 472ca7f to 42c3d35 Compare July 16, 2026 17:32
@bmander bmander changed the title Unify route focus rendering around exact trip geometry Unify route focus rendering Jul 16, 2026
@bmander
bmander merged commit dfb63c5 into main Jul 16, 2026
4 checks passed
@bmander
bmander deleted the agent/route-focus-rendering branch July 16, 2026 17:39
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.

1 participant