Skip to content

Commit ab43741

Browse files
authored
Add intersection signals along current route. (#4185)
1 parent de2a854 commit ab43741

File tree

30 files changed

+791
-389
lines changed

30 files changed

+791
-389
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Fixed an issue where tapping on a route duration annotation that overlaps a different route would cause the wrong route to be passed into `NavigationMapViewDelegate.navigationMapView(_:didSelect:)` or `NavigationMapViewDelegate.navigationMapView(_:didSelect:)`. ([#4133](https://github.com/mapbox/mapbox-navigation-ios/pull/4133))
2222
* Fixed an issue where the shields in the instruction are using the style from last navigation session with the `NavigationMapView` injection used in the new session. ([#4197](https://github.com/mapbox/mapbox-navigation-ios/pull/4197))
2323
* Fixed an issue where the `NavigationMapView.localizeLabels()` method only localized map labels according to the user’s Preferred Language Order setting if the application also had a localization in the preferred language. ([#4205](https://github.com/mapbox/mapbox-navigation-ios/pull/4205))
24+
* Added `NavigationViewController.annotatesIntersectionsAlongRoute` and `CarPlayNavigationViewController.annotatesIntersectionsAlongRoute` to annotate intersections on the current route step during active navigation. ([#4185](https://github.com/mapbox/mapbox-navigation-ios/pull/4185))
2425

2526
### Banners and guidance instructions
2627

MapboxNavigation.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@
424424
B4BB0AD72704D1E6006F502D /* multileg_route.json in Resources */ = {isa = PBXBuildFile; fileRef = B4BB0AD62704D1E6006F502D /* multileg_route.json */; };
425425
B4C4FFA028ADB19600C7C253 /* RouteLineLayerPositionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C4FF9F28ADB19600C7C253 /* RouteLineLayerPositionTests.swift */; };
426426
B4C8E39E286B72FA004D3EDD /* FeedbackViewControllerSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4C8E39D286B72FA004D3EDD /* FeedbackViewControllerSnapshotTests.swift */; };
427+
B4DA62F128EE0A78004A66B8 /* NavigationMapView+Annotations.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4DA62F028EE0A78004A66B8 /* NavigationMapView+Annotations.swift */; };
427428
B4E19C47268114840011581F /* NavigationLocationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4E19C46268114840011581F /* NavigationLocationProvider.swift */; };
428429
B4F4FEAD27AB1E11003915A9 /* SpriteRepositoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4B61B9627A882E200AA127E /* SpriteRepositoryTests.swift */; };
429430
B4FD842827ED1980002662C4 /* UserPuckStyleKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4FD842727ED1980002662C4 /* UserPuckStyleKit.swift */; };
@@ -1060,6 +1061,7 @@
10601061
B4C4FF9F28ADB19600C7C253 /* RouteLineLayerPositionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouteLineLayerPositionTests.swift; sourceTree = "<group>"; };
10611062
B4C8E39D286B72FA004D3EDD /* FeedbackViewControllerSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbackViewControllerSnapshotTests.swift; sourceTree = "<group>"; };
10621063
B4D4291826260D5900EE92A8 /* MBXInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = MBXInfo.plist; sourceTree = "<group>"; };
1064+
B4DA62F028EE0A78004A66B8 /* NavigationMapView+Annotations.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NavigationMapView+Annotations.swift"; sourceTree = "<group>"; };
10631065
B4E19C46268114840011581F /* NavigationLocationProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationLocationProvider.swift; sourceTree = "<group>"; };
10641066
B4FD842727ED1980002662C4 /* UserPuckStyleKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPuckStyleKit.swift; sourceTree = "<group>"; };
10651067
C51511D020EAC89D00372A91 /* CPMapTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPMapTemplate.swift; sourceTree = "<group>"; };
@@ -1550,6 +1552,7 @@
15501552
8A0E0A66257ADD3D00C2E924 /* Navigation */ = {
15511553
isa = PBXGroup;
15521554
children = (
1555+
B4DA62F028EE0A78004A66B8 /* NavigationMapView+Annotations.swift */,
15531556
B4E19C46268114840011581F /* NavigationLocationProvider.swift */,
15541557
8A2081C925E07CED00F9B8A6 /* NavigationMapViewIdentifiers.swift */,
15551558
8A2081CA25E07CED00F9B8A6 /* RouteLineType.swift */,
@@ -2869,6 +2872,7 @@
28692872
8AA0386327F7B3F50007BD2D /* BottomBannerViewControllerDelegate.swift in Sources */,
28702873
8D53136B20653FA20044891E /* ExitView.swift in Sources */,
28712874
8D3322272200E4CA001D44AA /* NavigationOptions.swift in Sources */,
2875+
B4DA62F128EE0A78004A66B8 /* NavigationMapView+Annotations.swift in Sources */,
28722876
B41299CD26D6DE4D004031A3 /* RouteProgress+Arrival.swift in Sources */,
28732877
351BEC011E5BCC63006FE110 /* ManeuverView.swift in Sources */,
28742878
35B1E2951F1FF8EC00A13D32 /* UserCourseView.swift in Sources */,

Sources/MapboxNavigation/CarPlayNavigationViewController.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti
8080
}
8181
}
8282

83+
/**
84+
A Boolean value that determines whether the map annotates the intersections on current step during active navigation.
85+
86+
If `true`, the map would display an icon of a traffic control device on the intersection,
87+
such as traffic signal, stop sign, yield sign, or railroad crossing.
88+
Defaults to `true`.
89+
*/
90+
public var annotatesIntersectionsAlongRoute: Bool = true {
91+
didSet {
92+
updateIntersectionsAlongRoute()
93+
}
94+
}
95+
8396
/**
8497
`AlternativeRoute`s user might take during this trip to reach the destination using another road.
8598

@@ -777,8 +790,13 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti
777790
navigationMapView?.showWaypoints(on: routeProgress.route, legIndex: legIndex)
778791
}
779792

793+
if annotatesIntersectionsAlongRoute {
794+
navigationMapView?.updateIntersectionAnnotations(with: routeProgress)
795+
}
796+
780797
navigationMapView?.updateRouteLine(routeProgress: routeProgress, coordinate: location.coordinate, shouldRedraw: legIndex != currentLegIndexMapped)
781798
currentLegIndexMapped = legIndex
799+
782800
}
783801

784802
private func checkTunnelState(at location: CLLocation, along progress: RouteProgress) {
@@ -872,6 +890,10 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti
872890
navigationMapView?.removeArrow()
873891
}
874892
navigationMapView?.showWaypoints(on: progress.route, legIndex: legIndex)
893+
894+
if annotatesIntersectionsAlongRoute {
895+
navigationMapView?.updateIntersectionAnnotations(with: progress)
896+
}
875897
}
876898

877899
func updateManeuvers(_ routeProgress: RouteProgress) {
@@ -1013,6 +1035,15 @@ open class CarPlayNavigationViewController: UIViewController, BuildingHighlighti
10131035
carInterfaceController.dismissTemplate(animated: true)
10141036
carInterfaceController.presentTemplate(waypointArrival, animated: true)
10151037
}
1038+
1039+
func updateIntersectionsAlongRoute() {
1040+
if annotatesIntersectionsAlongRoute {
1041+
navigationMapView?.updateIntersectionSymbolImages(styleType: styleManager?.currentStyleType)
1042+
navigationMapView?.updateIntersectionAnnotations(with: navigationService.routeProgress)
1043+
} else {
1044+
navigationMapView?.removeIntersectionAnnotations()
1045+
}
1046+
}
10161047
}
10171048

10181049
// MARK: StyleManagerDelegate Methods
@@ -1040,6 +1071,7 @@ extension CarPlayNavigationViewController: StyleManagerDelegate {
10401071
wayNameView?.label.updateStyle(styleURI: styleURI, idiom: .carPlay)
10411072
updateMapTemplateStyle()
10421073
updateManeuvers(navigationService.routeProgress)
1074+
updateIntersectionsAlongRoute()
10431075
}
10441076

10451077
public func styleManagerDidRefreshAppearance(_ styleManager: StyleManager) {

0 commit comments

Comments
 (0)