TomTomDynamicGuidanceEngine
public class TomTomDynamicGuidanceEngine : GuidanceEngine
Responsible for generating dynamic, real-time guidance based on the active route’s instructions and various dynamic parameters.
TomTomDynamicGuidanceEngine
generates dynamic Guidance
for the
Instruction
s supplied within NavigationSnapshot.activeRoute
.
To generate dynamic Guidance
, TomTomDynamicGuidanceEngine
takes various
parameters into account. These parameters include, but are not limited to:
- Distance to the next maneuver.
- Current speed of the vehicle.
- Free-flow speed of the road between the current position and the next maneuver.
- Traffic situation ahead.
So, unlike TomTomGuidanceEngine
, TomTomDynamicGuidanceEngine
does not depend on
Announcement
information that may or may not be included in the
Instruction
. It continuously checks the
active route progress to provide up-to-date Guidance
information. Once the vehicle reaches an announcement
point, the generated Guidance
includes the (GuidanceAnnouncement
) to be announced.
Another difference between TomTomDynamicGuidanceEngine
and TomTomGuidanceEngine
is that
TomTomDynamicGuidanceEngine
uses TomTom’s advanced verbal instruction messages to synthesize
GuidanceAnnouncement
s dynamically on the fly. Note that the set of supported languages may differ
between different GuidanceEngine
s.
TomTomDynamicGuidanceEngine
can be used to provide turn-by-turn navigation with any routing client (offline, online
with GuidanceOptions.guidanceVersion
v1
or v2
).
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes a new instance of
TomTomDynamicGuidanceEngine
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public init()
-
Defines whether generation of announcements is enabled.
Allows enabling or disabling the generation of guidance announcements. When set to
true
, the engine will generate announcements. When set tofalse
, no announcements will be generated.Example of usage:
tomtomDynamicGuidanceEngine.announcementsEnabled = true // Announcements are now enabled and will be generated during navigation.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var announcementsEnabled: Bool { get set }
-
Defines the
AnnouncementMode
for thisGuidanceEngine
.It allows configuring the type of announcements generated by the engine. The
AnnouncementMode
determines the verbosity level of the generated announcements. Changing the mode updates the verbosity level used by theverbalMessageGenerator
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var announcementMode: AnnouncementMode { get set }
-
Returns a list of languages (represented as Locale) supported by
GuidanceEngine
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var availableLanguages: [Locale] { get }
-
Generates guidance which might be a new upcoming maneuver or the same with updated distance to next maneuver.
It processes a
NavigationSnapshot
to produce dynamic guidance information. It examines the active route’s instructions, the vehicle’s current speed, and other dynamic parameters to generate guidance that is accurate and up-to-date.Example of usage:
do { let guidance = try tomtomDynamicGuidanceEngine.generateGuidance(navigationSnapshot: currentSnapshot) // Use the generated guidance information. } catch { // Handle errors if guidance generation fails. }
Throws
-GuidanceEngineError.noTripSnapshot
if there is no trip snapshot available. -GuidanceEngineError.noNextInstructions
if there are no new instructions. -GuidanceEngineError.noTriggerPoints
if there are no trigger points.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func generateGuidance(navigationSnapshot: NavigationSnapshot) throws // swiftlint:disable:this function_body_length -> Guidance
Parameters
navigationSnapshot
The snapshot of the current navigation session.
Return Value
A
Guidance
object containing guidance information related to the current position on the route. -
Generates a lane guidance object related to the current position on the route based on input parameters.
Note
LaneGuidanceUpdate
is suppressed (set to nil) when none of the lanes are set as recommended.Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func generateLaneGuidance(navigationSnapshot: NavigationSnapshot) -> LaneGuidanceUpdate?
Parameters
navigationSnapshot
The snapshot of the current navigation session.
Return Value
Lane guidance info object containing lane guidance information related to the current position on the route.
-
Resets the object to the default state.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func reset()