Skip to content

Commit

Permalink
Add shape to RoadObjectLocation.subgraph (#3301)
Browse files Browse the repository at this point in the history
* Add shape to RoadObjectLocation.subgraph

* Update CHANGELOG
  • Loading branch information
bamx23 committed Aug 26, 2021
1 parent a419868 commit 3fcadcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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

0 comments on commit 3fcadcd

Please sign in to comment.