Skip to content

Commit 8300e2f

Browse files
Seth BourgetSeth Bourget
andauthored
NAVAND-302 Refactored methodology for calculating restricted road expressions using the intersections of a DirectionsRoute rather than the distance array. (#6399)
Co-authored-by: Seth Bourget <seth@cafesilencio.net>
1 parent 73339c0 commit 8300e2f

File tree

15 files changed

+646
-536
lines changed

15 files changed

+646
-536
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Mapbox welcomes participation and contributions from everyone.
1010
- :warning: Restructured the package system of Drop-In UI into feature verticals. [#6430](https://github.com/mapbox/mapbox-navigation-android/pull/6430)
1111
- [TileStoreService] Use shared memory for marshaling large types and improve error handling. [#6422](https://github.com/mapbox/mapbox-navigation-android/pull/6422)
1212
- [TileStoreService] Fixed an issue that prevented callbacks to be invoked if an operation had to be retried because of a loss of connection to the service process. [#6422](https://github.com/mapbox/mapbox-navigation-android/pull/6422)
13+
- Fixed an issue with restricted road visualization on the route line that occurred during route refreshes. [#6399](https://github.com/mapbox/mapbox-navigation-android/pull/6399)
14+
- Improved precision of restricted sections visualization, especially for long routes. [#6399](https://github.com/mapbox/mapbox-navigation-android/pull/6399)
15+
- Fixed a rare issue where alternative route would not be vanished until deviation point for `MapboxRouteLineApi#setNavigationRoutes(routes, metadata)` when the route's geometry contained duplicate points. [#6399](https://github.com/mapbox/mapbox-navigation-android/pull/6399)
1316

1417
## Mapbox Navigation SDK 2.9.0-alpha.4 - 30 September, 2022
1518
### Changelog
@@ -134,7 +137,6 @@ This release depends on, and has been tested with, the following Mapbox dependen
134137
- Mapbox Android Core `v5.0.2` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/core-5.0.2))
135138
- Mapbox Android Telemetry `v8.1.5` ([release notes](https://github.com/mapbox/mapbox-events-android/releases/tag/telem-8.1.5-core-5.0.2))
136139

137-
138140
## Mapbox Navigation SDK 2.9.0-alpha.3 - 23 September, 2022
139141
### Changelog
140142
[Changes between v2.9.0-alpha.2 and v2.9.0-alpha.3](https://github.com/mapbox/mapbox-navigation-android/compare/v2.9.0-alpha.2...v2.9.0-alpha.3)

instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/ui/routeline/RouteLineLayersTest.kt

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import com.mapbox.navigation.base.route.RouterOrigin
1717
import com.mapbox.navigation.base.route.toNavigationRoute
1818
import com.mapbox.navigation.base.utils.DecodeUtils.completeGeometryToPoints
1919
import com.mapbox.navigation.core.MapboxNavigationProvider
20-
import com.mapbox.navigation.core.routealternatives.AlternativeRouteIntersection
21-
import com.mapbox.navigation.core.routealternatives.AlternativeRouteMetadata
2220
import com.mapbox.navigation.instrumentation_tests.R
2321
import com.mapbox.navigation.instrumentation_tests.activity.BasicNavigationViewActivity
2422
import com.mapbox.navigation.instrumentation_tests.utils.MapboxNavigationRule
@@ -393,16 +391,39 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
393391
/**
394392
* This test ensures that we're not crashing when parsing alternative routes metadata
395393
* in a specific case (caught by crashlytics) that involved
396-
* Nav Native reporting the [AlternativeRouteIntersection.geometryIndexInRoute] of
397-
* [AlternativeRouteMetadata.forkIntersectionOfAlternativeRoute] to be out of bounds
398-
* for the shape points collection of that particular route.
394+
* Directions API returning a route which contains a duplicate point in a step.
399395
*/
400396
@Test
401-
fun should_not_crash_when_fork_intersection_out_of_bounds_NAVAND_692() = sdkTest {
397+
fun should_provide_valid_offset_when_route_contains_duplicate_points_NAVAND_692() = sdkTest {
402398
val primaryRoute = createRoute(
403399
responseJson = R.raw.route_response_japan_1,
404400
requestUrlJson = R.raw.route_response_japan_1_url,
405401
).first()
402+
403+
/**
404+
* this route contains a duplicate point somewhere in the middle of the first step.
405+
* Inspecting a decoded portion of the `LineString` presents this:
406+
* ```
407+
* ...
408+
* [
409+
* 140.9184,
410+
* 37.718443
411+
* ],
412+
* [
413+
* 140.918069,
414+
* 37.719383
415+
* ],
416+
* [
417+
* 140.918069,
418+
* 37.719383
419+
* ],
420+
* [
421+
* 140.917924,
422+
* 37.719839
423+
* ],
424+
* ...
425+
* ```
426+
*/
406427
val alternativeRoute = createRoute(
407428
responseJson = R.raw.route_response_japan_2,
408429
requestUrlJson = R.raw.route_response_japan_2_url,
@@ -432,10 +453,10 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
432453
alternativeRoutesMetadata = mapboxNavigation.getAlternativeMetadataFor(routesUpdate)
433454
)
434455

435-
// we're expecting to ignore the attempt to hide the alternative until the deviation point,
436-
// hence the cleared offset
456+
// the alternative route turns out to fully overlaps with the original route,
457+
// hence the 1.0 offset
437458
assertEquals(
438-
0.0,
459+
1.0,
439460
result.value!!.alternativeRouteLinesData[0].dynamicData.trimOffset!!.offset,
440461
0.0000000001
441462
)

0 commit comments

Comments
 (0)