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

Add shape to RoadObjectLocation.subgraph #3301

Merged
merged 2 commits into from
Aug 26, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
* Removed `Alert` enum, and `alert`, `distance`, `length`, `beginCoordinate`, `endCoordinate`, `beginSegmentIndex`, and `endSegmentIndex` properties from `RouteAlerts`. ([#2991](https://github.com/mapbox/mapbox-navigation-ios/pull/2991))
* Added the `RouteAlerts.roadObject` property. ([#2991](https://github.com/mapbox/mapbox-navigation-ios/pull/2991))
* Added the `RoadObjectLocation.subgraph` enum case and the corresponding `RoadGraph.SubgraphEdge` structure represeting edges in the subgraph. ([#3250](https://github.com/mapbox/mapbox-navigation-ios/pull/3250))
* Added the `shape` value to the `RoadObjectLocation.subgraph` enum case. ([#3301](https://github.com/mapbox/mapbox-navigation-ios/pull/3301))

### Camera

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ public enum RoadObjectLocation {
Location of an object represented as a subgraph.
- parameter enters: Positions of the subgraph enters.
- parameter exits: Positions of the subgraph exits.
- parameter shape: Shape of a subgraph.
- parameter edges: Edges of the subgraph associated by id.
*/
case subgraph(enters: [RoadObjectPosition], exits: [RoadObjectPosition], edges: [RoadGraph.SubgraphEdge.Identifier: RoadGraph.SubgraphEdge])
case subgraph(enters: [RoadObjectPosition], exits: [RoadObjectPosition], shape: Turf.Geometry, edges: [RoadGraph.SubgraphEdge.Identifier: RoadGraph.SubgraphEdge])

/**
Location of an object represented as an OpenLR line.
Expand Down Expand Up @@ -98,6 +99,7 @@ public enum RoadObjectLocation {
.map { (id, edge) in (UInt(truncating: id), RoadGraph.SubgraphEdge(edge)) }
self = .subgraph(enters: location.getEnters().map(RoadObjectPosition.init),
exits: location.getExits().map(RoadObjectPosition.init),
shape: Geometry(location.getShape()),
edges: .init(uniqueKeysWithValues: edges))
} else {
preconditionFailure("RoadObjectLocation can't be constructed. Unknown type.")
Expand Down