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

Added nearest coordinate index for polyline #214

Merged
merged 18 commits into from
Sep 3, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/stadiamaps/maplibre-swiftui-dsl-playground",
"state" : {
"revision" : "02f5a62009bc991a9dc59011785c83c347d7eea6",
"version" : "0.0.23"
"revision" : "a789bbee505a1344a87d9a5f999455ed55acdcde",
"version" : "0.0.28"
}
},
{
"identity" : "mockable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Kolos65/Mockable.git",
"state" : {
"revision" : "81ccaead99a3c038c09345caa2888ae74b644ee9",
"version" : "0.0.9"
"revision" : "da977ecb20974c4b1cf185f5fd38771b2d4674fb",
"version" : "0.0.10"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if useLocalFramework {
path: "./common/target/ios/libferrostar-rs.xcframework"
)
} else {
let releaseTag = "0.9.1"
let releaseTag = "0.10.0"
let releaseChecksum = "d06ba13bd12262b91ecec20a80c96649a8507a43b2d041086ca04c6bcee2ba2f"
binaryTarget = .binaryTarget(
name: "FerrostarCoreRS",
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ plugins {

allprojects {
group = "com.stadiamaps.ferrostar"
version = "0.9.2"
version = "0.10.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fun NavigationState.Companion.pedestrianExample(): NavigationState {
return NavigationState(
tripState =
TripState.Navigating(
currentStepGeometryIndex = 0u,
snappedUserLocation = UserLocation.pedestrianExample(),
remainingSteps = listOf(),
remainingWaypoints = listOf(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/maplibre/maplibre-gl-native-distribution.git",
"state" : {
"revision" : "cf66f087af489ebc091c03cbd4f38d0540135871",
"version" : "6.5.3"
"revision" : "abe762f1e19e03a4c6943d2aad92c219da384b29",
"version" : "6.5.4"
}
},
{
Expand All @@ -24,23 +24,23 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/stadiamaps/maplibre-swiftui-dsl-playground",
"state" : {
"revision" : "02f5a62009bc991a9dc59011785c83c347d7eea6",
"version" : "0.0.23"
"revision" : "a789bbee505a1344a87d9a5f999455ed55acdcde",
"version" : "0.0.28"
}
},
{
"identity" : "mockable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Kolos65/Mockable.git",
"state" : {
"revision" : "81ccaead99a3c038c09345caa2888ae74b644ee9",
"version" : "0.0.9"
"revision" : "da977ecb20974c4b1cf185f5fd38771b2d4674fb",
"version" : "0.0.10"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax.git",
"state" : {
"revision" : "64889f0c732f210a935a0ad7cda38f77f876262d",
"version" : "509.1.1"
Expand Down
1 change: 1 addition & 0 deletions apple/Sources/FerrostarCore/FerrostarCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public protocol FerrostarCoreDelegate: AnyObject {

switch newState {
case let .navigating(
currentStepGeometryIndex: _,
snappedUserLocation: _,
remainingSteps: _,
remainingWaypoints: remainingWaypoints,
Expand Down
2 changes: 2 additions & 0 deletions apple/Sources/FerrostarCore/Mock/MockNavigationState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Foundation
public extension NavigationState {
static let pedestrianExample = NavigationState(
tripState: .navigating(
currentStepGeometryIndex: 0,
snappedUserLocation: UserLocation(
latitude: samplePedestrianWaypoints.first!.lat,
longitude: samplePedestrianWaypoints.first!.lng,
Expand Down Expand Up @@ -36,6 +37,7 @@ public extension NavigationState {

return NavigationState(
tripState: .navigating(
currentStepGeometryIndex: 0,
snappedUserLocation: UserLocation(
coordinates: samplePedestrianWaypoints.first!,
horizontalAccuracy: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public struct DynamicallyOrientingNavigationView: View, CustomizableNavigatingIn
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -153,7 +153,7 @@ public struct DynamicallyOrientingNavigationView: View, CustomizableNavigatingIn
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public struct LandscapeNavigationView: View {
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -124,7 +124,7 @@ public struct LandscapeNavigationView: View {
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public struct NavigationMapView: View {
}

private func updateCameraIfNeeded() {
if case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = navigationState?.tripState,
if case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = navigationState?.tripState,
// There is no reason to push an update if the coordinate and heading are the same.
// That's all that gets displayed, so it's all that MapLibre should care about.
locationManager.lastLocation.coordinate != userLocation.coordinates
Expand All @@ -98,7 +98,7 @@ public struct NavigationMapView: View {
// TODO: Make map URL configurable but gitignored
let state = NavigationState.modifiedPedestrianExample(droppingNWaypoints: 4)

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct LandscapeNavigationOverlayView: View, CustomizableNavigatingInnerGridView
var body: some View {
HStack {
VStack {
if case let .navigating(_, _, _, progress: progress, _, visualInstruction: visualInstruction,
if case let .navigating(_, _, _, _, progress: progress, _, visualInstruction: visualInstruction,
_) = navigationState?.tripState,
let visualInstruction
{
Expand All @@ -61,7 +61,7 @@ struct LandscapeNavigationOverlayView: View, CustomizableNavigatingInnerGridView

Spacer()

if case let .navigating(_, _, _, progress: progress, _, _, _) = navigationState?.tripState {
if case let .navigating(_, _, _, _, progress: progress, _, _, _) = navigationState?.tripState {
ArrivalView(
progress: progress,
onTapExit: onTapExit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct PortraitNavigationOverlayView: View, CustomizableNavigatingInnerGridView

var body: some View {
VStack {
if case let .navigating(_, _, _, progress: progress, _, visualInstruction: visualInstruction,
if case let .navigating(_, _, _, _, progress: progress, _, visualInstruction: visualInstruction,
_) = navigationState?.tripState,
let visualInstruction
{
Expand Down Expand Up @@ -81,7 +81,7 @@ struct PortraitNavigationOverlayView: View, CustomizableNavigatingInnerGridView
}
.padding(.horizontal, 16)

if case let .navigating(_, _, _, progress: progress, _, _, _) = navigationState?.tripState {
if case let .navigating(_, _, _, _, progress: progress, _, _, _) = navigationState?.tripState {
ArrivalView(
progress: progress,
onTapExit: onTapExit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public struct PortraitNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .imperial

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand All @@ -124,7 +124,7 @@ public struct PortraitNavigationView: View, CustomizableNavigatingInnerGridView
formatter.locale = Locale(identifier: "en-US")
formatter.units = .metric

guard case let .navigating(snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
guard case let .navigating(_, snappedUserLocation: userLocation, _, _, _, _, _, _) = state.tripState else {
return EmptyView()
}

Expand Down
Loading
Loading