Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make active leg of route appear above inactive legs. #6742

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/bugfixes/6742.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Modified the route line implementation so that for multi-leg routes the active leg appears above inactive route legs.
Original file line number Diff line number Diff line change
Expand Up @@ -100,82 +100,105 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
)

assertEquals(
"mapbox-layerGroup-1-restricted",
"mapbox-masking-layer-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-restricted",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-2-main",
"mapbox-layerGroup-1-main",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
"mapbox-layerGroup-1-casing",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
"mapbox-layerGroup-1-trail",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
"mapbox-layerGroup-1-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 12].id
)
assertEquals(
"mapbox-layerGroup-2-restricted",
style.styleLayers[topLevelRouteLayerIndex - 13].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
style.styleLayers[topLevelRouteLayerIndex - 14].id
)
assertEquals(
"mapbox-layerGroup-2-main",
style.styleLayers[topLevelRouteLayerIndex - 15].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
style.styleLayers[topLevelRouteLayerIndex - 16].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
style.styleLayers[topLevelRouteLayerIndex - 17].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 18].id
)

assertEquals(
"mapbox-layerGroup-3-restricted",
style.styleLayers[topLevelRouteLayerIndex - 13].id
style.styleLayers[topLevelRouteLayerIndex - 19].id
)
assertEquals(
"mapbox-layerGroup-3-traffic",
style.styleLayers[topLevelRouteLayerIndex - 14].id
style.styleLayers[topLevelRouteLayerIndex - 20].id
)
assertEquals(
"mapbox-layerGroup-3-main",
style.styleLayers[topLevelRouteLayerIndex - 15].id
style.styleLayers[topLevelRouteLayerIndex - 21].id
)
assertEquals(
"mapbox-layerGroup-3-casing",
style.styleLayers[topLevelRouteLayerIndex - 16].id
style.styleLayers[topLevelRouteLayerIndex - 22].id
)
assertEquals(
"mapbox-layerGroup-3-trail",
style.styleLayers[topLevelRouteLayerIndex - 17].id
style.styleLayers[topLevelRouteLayerIndex - 23].id
)
assertEquals(
"mapbox-layerGroup-3-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 18].id
style.styleLayers[topLevelRouteLayerIndex - 24].id
)
assertEquals(
"mapbox-bottom-level-route-layer",
style.styleLayers[topLevelRouteLayerIndex - 19].id
style.styleLayers[topLevelRouteLayerIndex - 25].id
)
}
}
Expand Down Expand Up @@ -212,29 +235,53 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
)
)
assertEquals(
"mapbox-layerGroup-1-restricted",
"mapbox-masking-layer-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-1-restricted",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-1-traffic",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-1-main",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-1-casing",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-1-trail",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
assertEquals(
"mapbox-layerGroup-1-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 12].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 @@ -253,29 +300,53 @@ class RouteLineLayersTest : BaseTest<BasicNavigationViewActivity>(
object : CountDownTimer(1000, 1000) {
override fun onFinish() {
assertEquals(
"mapbox-layerGroup-2-restricted",
"mapbox-masking-layer-restricted",
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-restricted",
style.styleLayers[topLevelRouteLayerIndex - 7].id
)
assertEquals(
"mapbox-layerGroup-2-traffic",
style.styleLayers[topLevelRouteLayerIndex - 8].id
)
assertEquals(
"mapbox-layerGroup-2-main",
style.styleLayers[topLevelRouteLayerIndex - 9].id
)
assertEquals(
"mapbox-layerGroup-2-casing",
style.styleLayers[topLevelRouteLayerIndex - 10].id
)
assertEquals(
"mapbox-layerGroup-2-trail",
style.styleLayers[topLevelRouteLayerIndex - 11].id
)
assertEquals(
"mapbox-layerGroup-2-trailCasing",
style.styleLayers[topLevelRouteLayerIndex - 12].id
)
countDownLatch.countDown()
}

Expand Down Expand Up @@ -332,9 +403,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 +429,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