Skip to content

Commit

Permalink
Added feature to mask the primary route line in order to give the app…
Browse files Browse the repository at this point in the history
…earance the active leg is above the inactive legs for multi-leg routes.
  • Loading branch information
Seth Bourget authored and cafesilencio committed Jan 17, 2023
1 parent a3da3ba commit 5e8ac7b
Show file tree
Hide file tree
Showing 26 changed files with 2,648 additions and 353 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Mapbox welcomes participation and contributions from everyone.
- Fixed approaches list update in `RouteOptionsUpdater`(uses for reroute). It was putting to the origin approach corresponding approach from legacy approach list. [#6540](https://github.com/mapbox/mapbox-navigation-android/pull/6540)
- Updated the `MapboxRestAreaApi` logic to load a SAPA map only if the upcoming rest stop is at the current step of the route leg. [#6695](https://github.com/mapbox/mapbox-navigation-android/pull/6695)
- Fixed an issue where `MapboxRerouteController` could deliver a delayed interruption state notifications. Now, the interruption state is always delivered synchronously, as soon as it's available. [#6718](https://github.com/mapbox/mapbox-navigation-android/pull/6718)
- Modified the route line implementation so that for multi-leg routes the active leg appears above inactive route legs. [#6742](https://github.com/mapbox/mapbox-navigation-android/pull/6742)

## Mapbox Navigation SDK 2.9.5 - 13 December, 2022
### Changelog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,84 +98,102 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
"background"
)
)

assertEquals(
"mapbox-layerGroup-1-restricted",
style.styleLayers[topLevelRouteLayerIndex - 1].id
)
assertEquals(
"mapbox-layerGroup-1-traffic",
"mapbox-masking-layer-traffic",
style.styleLayers[topLevelRouteLayerIndex - 2].id
)
assertEquals(
"mapbox-layerGroup-1-main",
"mapbox-masking-layer-main",
style.styleLayers[topLevelRouteLayerIndex - 3].id
)
assertEquals(
"mapbox-layerGroup-1-casing",
"mapbox-masking-layer-casing",
style.styleLayers[topLevelRouteLayerIndex - 4].id
)
assertEquals(
"mapbox-layerGroup-1-trail",
"mapbox-masking-layer-trail",
style.styleLayers[topLevelRouteLayerIndex - 5].id
)
assertEquals(
"mapbox-layerGroup-1-trailCasing",
"mapbox-masking-layer-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 6].id
)

assertEquals(
"mapbox-layerGroup-2-restricted",
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
"mapbox-layerGroup-1-main",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-2-main",
"mapbox-layerGroup-1-casing",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
"mapbox-layerGroup-1-trail",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
"mapbox-layerGroup-1-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
"mapbox-layerGroup-2-restricted",
style.styleLayers[topLevelRouteLayerIndex - 12].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
style.styleLayers[topLevelRouteLayerIndex - 13].id
)
assertEquals(
"mapbox-layerGroup-2-main",
style.styleLayers[topLevelRouteLayerIndex - 14].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
style.styleLayers[topLevelRouteLayerIndex - 15].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
style.styleLayers[topLevelRouteLayerIndex - 16].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 17].id
)

assertEquals(
"mapbox-layerGroup-3-restricted",
style.styleLayers[topLevelRouteLayerIndex - 13].id
style.styleLayers[topLevelRouteLayerIndex - 18].id
)
assertEquals(
"mapbox-layerGroup-3-traffic",
style.styleLayers[topLevelRouteLayerIndex - 14].id
style.styleLayers[topLevelRouteLayerIndex - 19].id
)
assertEquals(
"mapbox-layerGroup-3-main",
style.styleLayers[topLevelRouteLayerIndex - 15].id
style.styleLayers[topLevelRouteLayerIndex - 20].id
)
assertEquals(
"mapbox-layerGroup-3-casing",
style.styleLayers[topLevelRouteLayerIndex - 16].id
style.styleLayers[topLevelRouteLayerIndex - 21].id
)
assertEquals(
"mapbox-layerGroup-3-trail",
style.styleLayers[topLevelRouteLayerIndex - 17].id
style.styleLayers[topLevelRouteLayerIndex - 22].id
)
assertEquals(
"mapbox-layerGroup-3-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 18].id
style.styleLayers[topLevelRouteLayerIndex - 23].id
)
assertEquals(
"mapbox-bottom-level-route-layer",
style.styleLayers[topLevelRouteLayerIndex - 19].id
style.styleLayers[topLevelRouteLayerIndex - 24].id
)
}
}
Expand Down Expand Up @@ -216,25 +234,45 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
style.styleLayers[topLevelRouteLayerIndex - 1].id
)
assertEquals(
"mapbox-layerGroup-1-traffic",
"mapbox-masking-layer-traffic",
style.styleLayers[topLevelRouteLayerIndex - 2].id
)
assertEquals(
"mapbox-layerGroup-1-main",
"mapbox-masking-layer-main",
style.styleLayers[topLevelRouteLayerIndex - 3].id
)
assertEquals(
"mapbox-layerGroup-1-casing",
"mapbox-masking-layer-casing",
style.styleLayers[topLevelRouteLayerIndex - 4].id
)
assertEquals(
"mapbox-layerGroup-1-trail",
"mapbox-masking-layer-trail",
style.styleLayers[topLevelRouteLayerIndex - 5].id
)
assertEquals(
"mapbox-layerGroup-1-trailCasing",
"mapbox-masking-layer-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 6].id
)
assertEquals(
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-1-main",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-1-casing",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-1-trail",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-1-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
// This mimics selecting an alternative route by making the first
// alternative the primary route and the original primary route one
// of the alternatives.
Expand All @@ -257,25 +295,45 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
style.styleLayers[topLevelRouteLayerIndex - 1].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
"mapbox-masking-layer-traffic",
style.styleLayers[topLevelRouteLayerIndex - 2].id
)
assertEquals(
"mapbox-layerGroup-2-main",
"mapbox-masking-layer-main",
style.styleLayers[topLevelRouteLayerIndex - 3].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
"mapbox-masking-layer-casing",
style.styleLayers[topLevelRouteLayerIndex - 4].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
"mapbox-masking-layer-trail",
style.styleLayers[topLevelRouteLayerIndex - 5].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
"mapbox-masking-layer-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 6].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-2-main",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
countDownLatch.countDown()
}

Expand Down Expand Up @@ -332,9 +390,13 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
)?.visibility
)
assertEquals(
"mapbox-layerGroup-1-traffic",
"mapbox-masking-layer-traffic",
style.styleLayers[topLevelRouteLayerIndex - 1].id
)
assertEquals(
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 6].id
)
// This mimics selecting an alternative route by making the first
// alternative the primary route and the original primary route one
// of the alternatives.
Expand All @@ -354,24 +416,34 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
override fun onFinish() {
// Primary route group is now 2 and not visible
assertEquals(
"mapbox-layerGroup-2-traffic",
"mapbox-masking-layer-traffic",
style.styleLayers[topLevelRouteLayerIndex - 1].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
style.styleLayers[topLevelRouteLayerIndex - 6].id
)
assertEquals(
Visibility.NONE,
style.getLayer(
style.styleLayers[topLevelRouteLayerIndex - 1].id
)?.visibility
)
assertEquals(
Visibility.NONE,
style.getLayer(
style.styleLayers[topLevelRouteLayerIndex - 6].id
)?.visibility
)
// Previously primary route group is 1 and is now visible
assertEquals(
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 6].id
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
assertEquals(
Visibility.VISIBLE,
style.getLayer(
style.styleLayers[topLevelRouteLayerIndex - 6].id
style.styleLayers[topLevelRouteLayerIndex - 11].id
)?.visibility
)
countDownLatch.countDown()
Expand Down
Loading

0 comments on commit 5e8ac7b

Please sign in to comment.