-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add rotary and use lane types #93
Conversation
This fixes #79. |
We’ll need to add support for the |
For integrating osrm-text-instructions it will be more useful to have direct access to the |
Direct equivalence to JSON properties is a non-goal for this library, but #60 would keep the original serialized JSON around for anyone who finds it useful. The tradeoff in that case is higher memory usage. Once #91 lands, the logic I’m proposing for RouteStep would look something like this: if maneuverType == .rotary {
destinations = road.names ?? road.destinations
names = road.rotaryNames
} else {
destinations = road.destinations
names = road.rotaryNames
} I don’t consider this to be “mangling”, since you can easily reverse this logic: if maneuverType == .rotary {
rotaryName = step.names.componentsJoined(by: ";")
name = step.destinations.componentsJoined(by: ";")
} else {
destination = step.destinations.componentsJoined(by: ";")
name = step.names.componentsJoined(by: ";")
} The only problematic case would be for a rotary tagged with You’ll probably have a lot more difficulty reversing the logic in #91 that deals with |
d7c0af0
to
56f2107
Compare
This will be problematic for instructions, since we loose semantic if
Take this example: {
"rotary_name": "Dupont Circle",
"name": "6th Avenue",
} If we only expose |
As I pointed out in #93 (comment), I think you can safely ignore the destination for rotary instructions and interpret the |
An alternative would be to put |
@1ec5 This sounds good to me, since all information is carried through and no semantics are lost. To paraphrase: if type == .rotary || type == .roundabout {
step.name = json.rotary_name
step.destinations = json.destinations
step.exitName = json.name // empty on .roundabout
} |
Yes, that’s the idea. My only reservation is that there’s already a proliferation of road attribute properties on RouteStep. Ideally we’d shunt them all into a struct, but that won’t bridge to Objective-C; meanwhile, an Objective-C class would be overkill. But if it helps us rationalize our naming logic, then so be it. I’m assuming we don’t want this behavior for |
bcca7e0 implements the approach described in #93 (comment). Ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 i can't approve my own PR, but let's get this out
*/ | ||
case TakeRoundabout | ||
|
||
/** | ||
The step requires the user to enter, traverse, and exit a large, named roundabout (traffic circle or rotary). | ||
|
||
The step’s name is the name of the road to take after exiting the roundabout. The exit index indicates the number of rotary exits up to and including the exit that the user must take. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is different now with exitNames
.
The step's name is the name of the rotary itself. The exit name is the name of the road to take after exiting the roundabout.
It isn’t just one of your holiday games; You may think at first I’m as mad as a hatter When I tell you, a roundabout maneuver must have two different names.
These two types were not present yet.
@1ec5 What other changes are required to bring these types in?