NavigationMapView
open class NavigationMapView: MGLMapView, UIGestureRecognizerDelegate
NavigationMapView
is a subclass of MGLMapView
with convenience functions for adding Route
lines to a map.
-
Returns the altitude that the map camera initally defaults to.
Declaration
Swift
@objc public static let defaultAltitude: CLLocationDistance = 1000.0
-
Returns the altitude the map conditionally zooms out to when user is on a motorway, and the maneuver length is sufficently long.
Declaration
Swift
@objc public static let zoomedOutMotorwayAltitude: CLLocationDistance = 2000.0
-
Returns the threshold for what the map considers a
long-enough
maneuver distance to trigger a zoom-out when the user enters a motorway.Declaration
Swift
@objc public static let longManeuverDistance: CLLocationDistance = 1000.0
-
Maximum distance the user can tap for a selection to be valid when selecting an alternate route.
Declaration
Swift
@objc public var tapGestureDistanceThreshold: CGFloat = 50
-
The object that acts as the navigation delegate of the map view.
Declaration
Swift
public weak var navigationMapDelegate: NavigationMapViewDelegate?
-
The object that acts as the course tracking delegate of the map view.
Declaration
Swift
public weak var courseTrackingDelegate: NavigationMapViewCourseTrackingDelegate?
-
Determines whether the map should follow the user location and rotate when the course changes.
Seealso
NavigationMapViewCourseTrackingDelegateDeclaration
Swift
open var tracksUserCourse: Bool = false
-
A
UIView
used to indicate the user’s location and course on the map.If the view conforms to
UserCourseView
, itsUserCourseView.update(location:pitch:direction:animated:)
method is frequently called to ensure that its visual appearance matches the map’s camera.Declaration
Swift
@objc public var userCourseView: UIView?
-
Adds or updates both the route line and the route line casing
Declaration
Swift
@objc public func showRoutes(_ routes: [Route], legIndex: Int = 0)
-
Removes route line and route line casing from map
Declaration
Swift
@objc public func removeRoutes()
-
Adds the route waypoints to the map given the current leg index. Previous waypoints for completed legs will be omitted.
Declaration
Swift
@objc public func showWaypoints(_ route: Route, legIndex: Int = 0)
-
Removes all waypoints from the map.
Declaration
Swift
@objc public func removeWaypoints()
-
Shows the step arrow given the current
RouteProgress
.Declaration
Swift
@objc public func addArrow(route: Route, legIndex: Int, stepIndex: Int)
-
Removes the step arrow from the map.
Declaration
Swift
@objc public func removeArrow()
-
Attempts to localize road labels into the local language and other labels into the system’s preferred language.
When this property is enabled, the style automatically modifies the
text
property of any symbol style layer whose source is the Mapbox Streets source. On iOS, the user can set the system’s preferred language in Settings, General Settings, Language & Region.Unlike the
MGLStyle.localizeLabels(into:)
method, this method localizes road labels into the local language, regardless of the system’s preferred language, in an effort to match road signage. The turn banner always displays road names and exit destinations in the local language, so you should call this method in theMGLMapViewDelegate.mapView(_:didFinishLoading:)
method of any delegate of a standaloneNavigationMapView
. The map view embedded inNavigationViewController
is localized automatically, so you do not need to call this method on the value ofNavigationViewController.mapView
.Declaration
Swift
@objc public func localizeLabels()
-
Sets the camera directly over a series of coordinates.
Declaration
Swift
@objc public func setOverheadCameraView(from userLocation: CLLocationCoordinate2D, along coordinates: [CLLocationCoordinate2D], for bounds: UIEdgeInsets)