LocationSimulator class abstract
Use the LocationSimulator to generate locations along a route or a GPX document.
It notifies
the registered object about the current location at a fixed interval. In order to customize
the interval, see LocationSimulatorOptions.
The locations are closely matched to the shape and proceeded from the start to the
destination as found in the provided route or the GPX document.
When providing a route, the LocationSimulator uses a base speed taken from each span
found in the provided route object. This base speed can be multiplied upfront
with a custom speedFactor for simulation purposes.
Effectively, this means that traffic-related information is not considered
to adjust the speed of the simulation.
For the GPXTrack, a speed is either based on timestamps in the original file or provided by the user. The following data is read from a GPXTrack and inserted into the provided Location object: latitude, longitude, altitude, time, bearingInDegrees, speedInMetersPerSecond, horizontalAccuracyInMeters, verticalAccuracyInMeters and locationTechnology.
Note that simulation works offline and independent from any map data
- only the information found in the provided route or GPX document is considered.
- When initializing the
LocationSimulatorwith a route, then interpolations take place between the vertices of the route's polyline. The distance between interpolated locations is a function of the current span's speed and the set notification interval. - When initializing the
LocationSimulatorwith a GPX file, theLocationSimulatordoes not apply any interpolation on the provided location data as this would shadow the recorded GPX data.
Notifications will stop after the entire route has been traveled.
Note: Map-matched locations are only accessible from RouteProgress.
Constructors
- LocationSimulator.withRoute(Route route, LocationSimulatorOptions options)
-
Creates a new instance of this class.
factory
- LocationSimulator.withTrack(GPXTrack gpxTrack, LocationSimulatorOptions options)
-
Create a location simulator
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- listener ↔ LocationListener?
-
The object that notifies on location updates.
Gets a
LocationListenerthat notifies on location updates.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → void - Pauses sending notifications to the subscribers.
-
resume(
) → void - Resumes sending notifications to the subscribers.
-
start(
) → void - Starts the location provider to send notifications to the subscribers.
-
stop(
) → void - Stops the location provider from sending notifications to the subscribers.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited