Navigation Visualization
Declaration
Swift
extension BetterRoute: CustomStringConvertible
Represents the style used to display the better route.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct BetterRouteStyle
Manages the visualization of better route proposals, e.g., visibility.
Important
To see the better route proposal theBetterProposalAcceptanceMode
should be set to
BetterProposalAcceptanceMode.manual
when configuring the TomTomNavigation
.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol BetterRouteVisualization : AnyObject
Declaration
Swift
extension DefaultBetterRouteDataSource: NavigationRouteAddObserver,
NavigationRouteRemoveObserver,
NavigationRouteUpdateObserver,
NavigationActiveRouteChangeObserver
Declaration
Swift
extension DefaultBetterRouteVisualizer: RouteDelegate
extension DefaultBetterRouteVisualizer: MapInteractionObserver
Declaration
Swift
extension DefaultNavigationVisualization: NavigationStateChangeObserver
extension DefaultNavigationVisualization: NavigationHorizonObserver
extension DefaultNavigationVisualization: NavigationProgressObserver
extension DefaultNavigationVisualization: NavigationRouteUpdateObserver
extension DefaultNavigationVisualization: NavigationActiveRouteChangeObserver
extension DefaultNavigationVisualization: NavigationDestinationArrivalObserver
extension DefaultNavigationVisualization: NavigationWaypointArrivalObserver
extension DefaultNavigationVisualization: GuidanceUpdateObserver
Declaration
Swift
extension DefaultSafetyLocationVisualization: MapInteractionObserver
The type of navigation guidance. It defines the behavior of the camera and the route around navigation events such as start, end, reaching waypoint or destination, etc. It also defines route events like deviation, change, information update, progress change, and so on.
See moreDeclaration
Swift
public enum GuidanceType
Declaration
Swift
extension NavigationEventsConnector: NavigationStateChangeObserver
extension NavigationEventsConnector: NavigationProgressObserver
extension NavigationEventsConnector: NavigationRouteUpdateObserver
extension NavigationEventsConnector: NavigationRouteAddObserver
extension NavigationEventsConnector: NavigationRouteRemoveObserver
extension NavigationEventsConnector: NavigationActiveRouteChangeObserver
extension NavigationEventsConnector: NavigationDestinationArrivalObserver
extension NavigationEventsConnector: NavigationWaypointArrivalObserver
extension NavigationEventsConnector: NavigationHorizonObserver
extension NavigationEventsConnector: GuidanceUpdateObserver
Entry point for all methods related to the navigation visualization module.
Instances of NavigationVisualization
are created using create(map:navigation:styleConfiguration:)
.
NavigationVisualization
shouldn’t be conformed outside the TomTom SDK frameworks.
Inheritance from TomTomSDKCommon/ConformanceLocked
makes it impossible to create NavigationVisualization
instances outside the TomTomSDK frameworks.
You should call methods on these instances from the main thread only, otherwise an exception can occur.
A NavigationVisualization
instance is used by first providing a RoutePlan
with displayRoutePlan(:_)
.
After that, the TomTomSDKRoute/Route
s contained in the RoutePlan
are displayed on the map, and you can use setActiveRoute(_:)
to select a route to navigate.
You can access the list of route primitives displayed on the map using routes
.
The selected route and the alternative routes are styled with the properties contained in the StyleConfiguration
provided to create(map:navigation:styleConfiguration:)
.
After selecting the type of navigation guidance with the property guidanceType
, you can start the navigation session with TomTomSDKNavigation/Navigation/start()
.
Once the navigation session is started, the route that is set becomes the active route.
When you’re finished using NavigationVisualization
, call TomTomSDKNavigation/Navigation/stop()
.
You can then call clearRoutePlan()
to remove all the primitives that have been added to the map by the module.
Visualization of on-route traffic incidents can be enabled or disabled using areTrafficIncidentsEnabled
.
If a TomTomSDKRoute/Route
contained in the RoutePlan
has traffic data available and areTrafficIncidentsEnabled
is true
, traffic incidents are displayed on the map on top of that TomTomSDKRoute/Route
.
You can access the list of traffic incidents that are on a route using trafficIncidents(on:)
.
The navigation visualization module subscribes to certain listeners during its life cycle, so that it can react automatically to important events:
TomTomSDKNavigation/NavigationStateChangeObserver
- Notifies the module when a navigation state changes. The module reacts by removing the alternative routes from the map, setting the camera tracking mode toTomTomSDKMapsDisplay/CameraTrackingMode/followNorthUp
, and setting a default tilt angle.TomTomSDKNavigation/NavigationProgressObserver
- Notifies the module as the driver progresses on the route. The module reacts by updating the visual cue of the progress on the route (i.e., the grayed-out region behind the vehicle).TomTomSDKNavigation/GuidanceUpdateObserver
- Notifies the module when new on-route instructions are available. The new instructions are provided along with the notification. The module reacts by updating the route with the new instructions.TomTomSDKNavigation/NavigationDestinationArrivalObserver
- Notifies the module when the driver reaches the destination. The module reacts by removing the route from the map, setting camera tracking mode toTomTomSDKMapsDisplay/CameraTrackingMode/followNorthUp
, and setting the default 2D view.TomTomSDKMapDisplay/CameraEventObserver
- Notifies the module when a parameter of the camera changes. The module reacts by, for example, showing or hiding certain traffic markers (seemarkerVisibilityByCategory
).
Declaration
Swift
public protocol NavigationVisualization : AnyObject, RoutingVisualization
Creates instances of NavigationVisualization
.
Declaration
Swift
public enum NavigationVisualizationFactory
Enum representing options for the number of safety locations to display at the start of the route.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum SafetyLocationCountOptions
Defines the appearance and behavior of the safety location visualization on the route.
Important
Currently supported safety location types are:SafetyLocation/SafetyLocationType/speedEnforcement
SafetyLocation/SafetyLocationType/averageSpeed
SafetyLocation/SafetyLocationType/mobileRiskZone
SafetyLocation/SafetyLocationType/trafficLight
SafetyLocation/SafetyLocationType/mobile
SafetyLocation/SafetyLocationType/fixedDangerZone
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public struct SafetyLocationStyle
Addresses visualization of safety locations such as configuration, user interaction, etc.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public protocol SafetyLocationVisualization : AnyObject
Represents a style configuration for the elements of the NavigationVisualization
.
When no arguments are provided to the constructor, it constructs the default style configuration.
Declaration
Swift
public struct StyleConfiguration
Errors that can be thrown during stylization.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public enum StyleConfigurationError : LocalizedError
A type alias for TomTomSDKRoutingVisualization/TrafficIncident
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public typealias TrafficIncident = TomTomSDKRoutingVisualization.TrafficIncident
Declaration
Swift
extension VisualSafetyLocation: Equatable
extension VisualSafetyLocation: Hashable