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

User should see an upcoming maneuver arrow on the route line #604

Closed
ericrwolfe opened this issue Dec 15, 2017 · 7 comments
Closed

User should see an upcoming maneuver arrow on the route line #604

ericrwolfe opened this issue Dec 15, 2017 · 7 comments
Assignees
Labels
feature New feature request. platform parity Required to keep on par with iOS.
Milestone

Comments

@ericrwolfe
Copy link
Contributor

Similar to the one on iOS:
img_0420

iOS creates a line segment 30m before and after the maneuver point, and then adds this arrow shaft as a runtime styling layer.

The arrowhead is a white triangle that is add as a symbol layer and rotated based on the bearing of the maneuver.

cc @mapbox/navigation-android @frederoni @bsudekum

@ericrwolfe ericrwolfe added feature New feature request. topic: cartography labels Dec 15, 2017
@ericrwolfe ericrwolfe added this to the v0.9.0 milestone Dec 15, 2017
@danesfeder danesfeder modified the milestones: v0.9.0, v0.10.0 Jan 23, 2018
@akitchen akitchen changed the title Add maneuver arrow to route line User should see an upcoming maneuver arrow on the route line Mar 26, 2018
@akitchen akitchen added the platform parity Required to keep on par with iOS. label Apr 9, 2018
@Guardiola31337
Copy link
Contributor

@Guardiola31337
Copy link
Contributor

@Guardiola31337
Copy link
Contributor

Capturing @1ec5 comment

We only draw it on the upcoming step, but yeah. The arrow consists of a shaft (line feature + line layer) and an arrowhead (point feature + symbol layer), plus a shaft casing (line feature + line layer) and arrowhead casing (point feature + symbol layer). The geometry code there ensures the arrow hugs the intersection.
The casing layer is slightly thinner than the route line, yes.

@Guardiola31337
Copy link
Contributor

As pointed in mapbox/mapbox-navigation-ios#1298 we should also make the arrow’s color styleable instead of always white.

@akitchen
Copy link

Note the relationship to #704 -- further refactoring is probably needed in order to address these two tickets.

@Guardiola31337
Copy link
Contributor

Capturing @frederoni's comments

the shaft is sliced 30 meters before and 30 meters after the RouteStep’s maneuverCoordinate using turf’s trimmed() function https://github.com/mapbox/turf-swift/blob/master/Sources/Turf/Turf.swift#L210

the direction is calculated from the second last to the very last coordinate in the shaft using turf’s direction(to:) https://github.com/mapbox/turf-swift/blob/master/Sources/Turf/Turf.swift#L36

symbol.coordinate = shaft.coordinates.last

the arrow is a static image, anchored horizontally and vertically center on the shaft.coordinates.last

@Guardiola31337
Copy link
Contributor

Equivalent Android Turf methods:

For reference, here’s the magic decoder ring 👉 https://github.com/mapbox/turf-swift#available-functionality (thanks @1ec5 🙏)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request. platform parity Required to keep on par with iOS.
Projects
None yet
Development

No branches or pull requests

4 participants