|
| 1 | +import MapboxMaps |
| 2 | +import MapboxDirections |
| 3 | +import MapboxCoreNavigation |
| 4 | + |
| 5 | +// MARK: NavigationMapViewDelegate methods |
| 6 | + |
| 7 | +extension NavigationViewController: NavigationMapViewDelegate { |
| 8 | + |
| 9 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 10 | + routeLineLayerWithIdentifier identifier: String, |
| 11 | + sourceIdentifier: String) -> LineLayer? { |
| 12 | + delegate?.navigationViewController(self, |
| 13 | + routeLineLayerWithIdentifier: identifier, |
| 14 | + sourceIdentifier: sourceIdentifier) |
| 15 | + } |
| 16 | + |
| 17 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 18 | + routeCasingLineLayerWithIdentifier identifier: String, |
| 19 | + sourceIdentifier: String) -> LineLayer? { |
| 20 | + delegate?.navigationViewController(self, |
| 21 | + routeCasingLineLayerWithIdentifier: identifier, |
| 22 | + sourceIdentifier: sourceIdentifier) |
| 23 | + } |
| 24 | + |
| 25 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 26 | + routeRestrictedAreasLineLayerWithIdentifier identifier: String, |
| 27 | + sourceIdentifier: String) -> LineLayer? { |
| 28 | + delegate?.navigationViewController(self, |
| 29 | + routeRestrictedAreasLineLayerWithIdentifier: identifier, |
| 30 | + sourceIdentifier: sourceIdentifier) |
| 31 | + } |
| 32 | + |
| 33 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 34 | + waypointCircleLayerWithIdentifier identifier: String, |
| 35 | + sourceIdentifier: String) -> CircleLayer? { |
| 36 | + delegate?.navigationViewController(self, |
| 37 | + waypointCircleLayerWithIdentifier: identifier, |
| 38 | + sourceIdentifier: sourceIdentifier) |
| 39 | + } |
| 40 | + |
| 41 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 42 | + waypointSymbolLayerWithIdentifier identifier: String, |
| 43 | + sourceIdentifier: String) -> SymbolLayer? { |
| 44 | + delegate?.navigationViewController(self, |
| 45 | + waypointSymbolLayerWithIdentifier: identifier, |
| 46 | + sourceIdentifier: sourceIdentifier) |
| 47 | + } |
| 48 | + |
| 49 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 50 | + shapeFor waypoints: [Waypoint], |
| 51 | + legIndex: Int) -> FeatureCollection? { |
| 52 | + delegate?.navigationViewController(self, |
| 53 | + shapeFor: waypoints, |
| 54 | + legIndex: legIndex) |
| 55 | + } |
| 56 | + |
| 57 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 58 | + didAdd finalDestinationAnnotation: PointAnnotation, |
| 59 | + pointAnnotationManager: PointAnnotationManager) { |
| 60 | + delegate?.navigationViewController(self, |
| 61 | + didAdd: finalDestinationAnnotation, |
| 62 | + pointAnnotationManager: pointAnnotationManager) |
| 63 | + } |
| 64 | + |
| 65 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 66 | + didSelect waypoint: Waypoint) { |
| 67 | + delegate?.navigationViewController(self, |
| 68 | + didSelect: waypoint) |
| 69 | + } |
| 70 | + |
| 71 | + public func navigationMapView(_ navigationMapView: NavigationMapView, |
| 72 | + didSelect continuousAlternative: AlternativeRoute) { |
| 73 | + router.updateRoute(with: continuousAlternative.indexedRouteResponse, |
| 74 | + routeOptions: nil, |
| 75 | + completion: nil) |
| 76 | + |
| 77 | + delegate?.navigationViewController(self, |
| 78 | + didSelect: continuousAlternative) |
| 79 | + } |
| 80 | +} |
0 commit comments