Skip to content

Commit

Permalink
Add missing maneuver types
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie committed Oct 9, 2023
1 parent f1cf846 commit cabf0d8
Show file tree
Hide file tree
Showing 8 changed files with 641 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if useLocalFramework {
path: "./common/target/ios/ferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.0.1"
let releaseChecksum = "c6392c5f5f2f45c46ea25a879eb633f5050e17d597277d0d35ac76bbf32f7d4c"
let releaseTag = "0.0.2"
let releaseChecksum = "06310a7385b30eaefacd641a7e67184ade63f6558ca424a67bd93d580a1412c8"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
url: "https://github.com/stadiamaps/ferrostar/releases/download/\(releaseTag)/ferrostar-rs.xcframework.zip",
Expand Down
74 changes: 64 additions & 10 deletions apple/Sources/UniFFI/ferrostar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1227,12 +1227,21 @@ extension ManeuverModifier: Equatable, Hashable {}
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
public enum ManeuverType {
case turn
case merge
case newName
case depart
case arrive
case fork
case merge
case onRamp
case offRamp
case fork
case endOfRoad
case `continue`
case roundabout
case rotary
case roundaboutTurn
case notification
case exitRoundabout
case exitRotary
}

public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer {
Expand All @@ -1243,17 +1252,35 @@ public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer {
switch variant {
case 1: return .turn

case 2: return .merge
case 2: return .newName

case 3: return .depart

case 4: return .arrive

case 5: return .fork
case 5: return .merge

case 6: return .onRamp

case 7: return .offRamp

case 8: return .fork

case 9: return .endOfRoad

case 6: return .offRamp
case 10: return .continue

case 7: return .roundabout
case 11: return .roundabout

case 12: return .rotary

case 13: return .roundaboutTurn

case 14: return .notification

case 15: return .exitRoundabout

case 16: return .exitRotary

default: throw UniffiInternalError.unexpectedEnumCase
}
Expand All @@ -1264,7 +1291,7 @@ public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer {
case .turn:
writeInt(&buf, Int32(1))

case .merge:
case .newName:
writeInt(&buf, Int32(2))

case .depart:
Expand All @@ -1273,14 +1300,41 @@ public struct FfiConverterTypeManeuverType: FfiConverterRustBuffer {
case .arrive:
writeInt(&buf, Int32(4))

case .fork:
case .merge:
writeInt(&buf, Int32(5))

case .offRamp:
case .onRamp:
writeInt(&buf, Int32(6))

case .roundabout:
case .offRamp:
writeInt(&buf, Int32(7))

case .fork:
writeInt(&buf, Int32(8))

case .endOfRoad:
writeInt(&buf, Int32(9))

case .continue:
writeInt(&buf, Int32(10))

case .roundabout:
writeInt(&buf, Int32(11))

case .rotary:
writeInt(&buf, Int32(12))

case .roundaboutTurn:
writeInt(&buf, Int32(13))

case .notification:
writeInt(&buf, Int32(14))

case .exitRoundabout:
writeInt(&buf, Int32(15))

case .exitRotary:
writeInt(&buf, Int32(16))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/ferrostar-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ferrostar-core"
version = "0.0.1"
version = "0.0.2"
authors = ["Ian Wagner <[email protected]>", "Luke Seelenbinder <[email protected]>"]
license = "BSD-3-Clause"
repository = "https://github.com/stadiamaps/ferrostar"
Expand Down
13 changes: 11 additions & 2 deletions common/ferrostar-core/src/ferrostar.udl
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,21 @@ dictionary VisualInstructionContent {

enum ManeuverType {
"Turn",
"Merge",
"NewName",
"Depart",
"Arrive",
"Fork",
"Merge",
"OnRamp",
"OffRamp",
"Fork",
"EndOfRoad",
"Continue",
"Roundabout",
"Rotary",
"RoundaboutTurn",
"Notification",
"ExitRoundabout",
"ExitRotary",
};

enum ManeuverModifier {
Expand Down
19 changes: 17 additions & 2 deletions common/ferrostar-core/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,28 @@ pub struct VisualInstructions {
#[serde(rename_all = "lowercase")]
pub enum ManeuverType {
Turn,
Merge,
#[serde(rename = "new name")]
NewName,
Depart,
Arrive,
Fork,
Merge,
#[serde(rename = "on ramp")]
OnRamp,
#[serde(rename = "off ramp")]
OffRamp,
Fork,
#[serde(rename = "end of road")]
EndOfRoad,
Continue,
Roundabout,
Rotary,
#[serde(rename = "roundabout turn")]
RoundaboutTurn,
Notification,
#[serde(rename = "exit roundabout")]
ExitRoundabout,
#[serde(rename = "exit rotary")]
ExitRotary,
}

/// Specifies additional information about a [ManeuverType]
Expand Down
562 changes: 541 additions & 21 deletions common/ferrostar-core/src/routing_adapters/osrm/mod.rs

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions common/ferrostar-core/tests/navigation_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ fn simple_route_state_machine_advances_with_location_change() {
NavigationControllerConfig {
// NOTE: We will use an exact location to trigger the update;
// this is not testing the thresholds.
step_advance: StepAdvanceMode::DistanceToEndOfStep { distance: 0, minimum_horizontal_accuracy: 0 },
step_advance: StepAdvanceMode::DistanceToEndOfStep {
distance: 0,
minimum_horizontal_accuracy: 0,
},
},
);

Expand Down Expand Up @@ -144,4 +147,3 @@ fn simple_route_state_machine_advances_with_location_change() {

assert_ne!(first_step, second_step);
}

0 comments on commit cabf0d8

Please sign in to comment.