Skip To Content ArcGIS for Developers Sign In Dashboard

SimulatedLocationDataSource Class

(Esri::ArcGISRuntime::SimulatedLocationDataSource)

A simulated location data source object. More...

Header: #include <SimulatedLocationDataSource>
Since: Esri::ArcGISRuntime 100.8
Inherits: AbstractLocationDataSource

Public Functions

SimulatedLocationDataSource(QObject *parent)
~SimulatedLocationDataSource()
int currentLocationIndex() const
double iterationRate() const
QList<Location> locations() const
void setCurrentLocationIndex(int currentLocationIndex)
void setIterationRate(double iterationRate)
void setLocations(const QList<Location> &locations)
void setLocationsWithPolyline(const Polyline &polyline)
void setLocationsWithPolyline(const Polyline &polyline, SimulationParameters *simulationParameters)

Protected Slots

virtual void onStart()
virtual void onStop()

Additional Inherited Members

Detailed Description

A simulated location data source object.

This object can be used to simulate the updating of a device's location. It iterates over a list of Location objects that will passed into AbstractLocationDataSource::updateLocation. The locations list can be set from:

  • Vertices in a polyline.
  • Automatically generated along a polyline based on a velocity.
  • Set directly via a list of Location.

Member Function Documentation

SimulatedLocationDataSource::SimulatedLocationDataSource(QObject *parent)

Creates the new instance of the data source with an optional parent.

SimulatedLocationDataSource::~SimulatedLocationDataSource()

Destructor.

int SimulatedLocationDataSource::currentLocationIndex() const

Returns the index of the item in the the locations list that is currently being used.

This represents the index of the location that will be passed into AbstractLocationDataSource::updateLocation. This can be used to either find which item in the SimulatedLocationDataSource::locations list is being used, or it can be used to forward/rewind/loop to a different item in the SimulatedLocationDataSource::locations list.

See also setCurrentLocationIndex().

double SimulatedLocationDataSource::iterationRate() const

Returns the rate at which the SimulatedLocationDataSource::locations is iterated over (default is 1.0).

The rate at which the locations are iterated over, controlling the time between calls to AbstractLocationDataSource::updateLocation.

The default value is 1.0, which calls AbstractLocationDataSource::updateLocation once a second. To speedup set this property to a higher value, e.g. 2.0 = 2x speedup. To slowdown set this property to a lower value, e.g. 0.5 = 2x slowdown. This property does not affect the time property of the items in the SimulatedLocationDataSource::locations (they are always 1 second).

See also setIterationRate().

QList<Location> SimulatedLocationDataSource::locations() const

Returns a list of location objects.

For each location in the list the AbstractLocationDataSource::updateLocation will be fired. The rate at which the AbstractLocationDataSource::updateLocation is called is based on SimulatedLocationDataSource::iterationRate. The list can be populated by calling SimulatedLocationDataSource::setLocationsWithPolyline or by directly setting Location objects in a list.

See also setLocations().

[virtual protected slot] void SimulatedLocationDataSource::onStart()

Reimplemented from AbstractLocationDataSource::onStart().

Reacts to start requests by starting the simulation.

Note: You should not call this method directly - use start instead.

[virtual protected slot] void SimulatedLocationDataSource::onStop()

Reimplemented from AbstractLocationDataSource::onStop().

Reacts to stop requests by stopping the simulation.

Note: You should not call this method directly - use stop instead.

void SimulatedLocationDataSource::setCurrentLocationIndex(int currentLocationIndex)

Sets the currentLocationIndex to currentLocationIndex.

See also currentLocationIndex.

void SimulatedLocationDataSource::setIterationRate(double iterationRate)

Sets the iterationRate to iterationRate.

See also iterationRate.

void SimulatedLocationDataSource::setLocations(const QList<Location> &locations)

Sets the locations to locations.

See also locations.

void SimulatedLocationDataSource::setLocationsWithPolyline(const Polyline &polyline)

Sets the locations using vertices from the input polyline.

The result locations can be obtained from SimulatedLocationDataSource::locations. These properties will be populated based on the inputs: Location::timestamp, Location::position, Location::velocity,

These properties will be calculated based on the inputs: Location::course

These properties will not be set: Location::horizontalAccuracy, Location::verticalAccuracy, Location::isLastKnown.

  • polyline - The polyline

void SimulatedLocationDataSource::setLocationsWithPolyline(const Polyline &polyline, SimulationParameters *simulationParameters)

Sets the locations using density points on input polyline depend on velocity.

Distance between each location on the polyline depends on velocity. For example if velocity is 10 m/s then distance between 2 locations will be 10 meters. The Location::timestamp values will always be 1 second apart. These properties will be set based on the inputs: Location::timestamp, Location::position, Location::velocity, Location::horizontalAccuracy, Location::verticalAccuracy These properties will be calculated based on the inputs: Location::course These properties will not be set: Location::isLastKnown.

  • polyline - The polyline
  • simulationParameters - The parameters used in creating the locations from the polyline

Feedback on this topic?