SimulatedLocationEngine
public class SimulatedLocationEngine : ValidatingLocationEngine
The SimulatedLocationEngine provides simulated location updates to simulate driving on GPX/TTP tracks or route geometry.
Important
This is a Public Preview API. It may be changed or removed at any time.-
SimulatedLocationEngine
initializerDeclaration
Swift
public convenience init(delay: Double?)
Parameters
delay
The delay in seconds between the location updates. A
nil
value means the usage of timestamps from TTP files instead.
-
The last updated location.
Declaration
Swift
public private(set) var location: GeoLocation? { get }
-
Starts generation of location updates. NOTE: This does not stop any updates provided by other location engines.
Declaration
Swift
public func start()
-
Stops generation of location updates.
Declaration
Swift
public func stop()
-
Declaration
Swift
public func addObserver(_ observer: LocationEngineObserver)
-
Declaration
Swift
public func removeObserver(_ observer: LocationEngineObserver)
-
Updates the simulated engine with an array of coordinates to use as simulated positions.
Declaration
Swift
public func updateCoordinates(_ coordinates: [CLLocationCoordinate2D], interpolate: Bool = true)
Parameters
coordinates
Array of
CLLocationCoordinate2D
s.interpolate
Flag to toggle interpolation between coordinates in order to smooth out the simulation.
-
Updates the simulated engine with a path to a GPX file containing a route track.
Declaration
Swift
public func updateCoordinatesFromGPXFile(path: String, interpolate: Bool = false)
Parameters
path
Path to the GPX file that will be used to retrieve the route geometry.
interpolate
Flag to toggle interpolation between coordinates in order to smooth out the simulation.
-
Updates the simulated engine with a path to a TTP file containing a route track. NOTE:
SimulatedLocationEngine
must be initialized with anil
delay in order to use this methodDeclaration
Swift
public func updateLocationsFromTTPFile(path: String, interpolate: Bool = false)
Parameters
path
Path to the TTP file that will be used to retrieve the route geometry.
interpolate
Flag to toggle interpolation between coordinates in order to smooth out the simulation.