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

Expose refs in modifier function #33

Merged
merged 2 commits into from
Aug 18, 2017
Merged

Expose refs in modifier function #33

merged 2 commits into from
Aug 18, 2017

Conversation

bsudekum
Copy link

This exposes the first ref to the modifier callback function.

/cc @1ec5

@@ -276,6 +276,7 @@ public class OSRMInstructionFormatter: Formatter {
if let tokenType = TokenType(description: token! as String) {
var replacement: String
switch tokenType {
case .code: replacement = step.codes?.first ?? ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that instructions coming from the .json never contain {code}. We’re inventing TokenType.code for the purpose of those format strings above that combine the way name and ref together into the wayName string, handled on the line below.

@@ -60,6 +63,8 @@ public enum TokenType: Int, CustomStringConvertible {
return "direction"
case .wayPoint:
return "nth"
case .code:
return "code"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we ever introduce the concept of a code into the JavaScript version of this library, the JavaScript code (and all the affected translated strings) would likely say {ref}, not {code}.

@bsudekum bsudekum merged commit f15f6b4 into master Aug 18, 2017
@bsudekum bsudekum deleted the codes branch August 18, 2017 00:33
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.

2 participants