• RouteTrackerLocationDataSource
  • class Esri::ArcGISRuntime::RouteTrackerLocationDataSource

    A location data source that uses a route tracker and a generic location data source to output locations snapped to a route. More...

    Header: #include <RouteTrackerLocationDataSource.h>
    Since: Esri::ArcGISRuntime 100.9
    Inherits: Esri::ArcGISRuntime::AbstractLocationDataSource

    Public Functions

    RouteTrackerLocationDataSource(Esri::ArcGISRuntime::RouteTracker *routeTracker, QObject *parent = nullptr)
    RouteTrackerLocationDataSource(Esri::ArcGISRuntime::RouteTracker *routeTracker, Esri::ArcGISRuntime::AbstractLocationDataSource *locationDataSource, QObject *parent = nullptr)
    virtual ~RouteTrackerLocationDataSource() override

    Protected Slots

    virtual void onStart() override
    virtual void onStop() override

    Detailed Description

    Setting the RouteTrackerLocationDataSource is optional when desiring to have the location display symbol navigate along a route. Using this object provides the benefit of having the current location snapped to the route polyline during navigation. If the RouteTrackerLocationDataSource is not used, you may notice that the input location tends to wander off the route polyline due to the accuracy of the underlying location data source.

    No distance tolerance needs to be specified to enable the snapping effect of having the location display symbol follow along the route polyline. An internal algorithm is used by the RouteTrackerLocationDataSource to determine if location is 'on route' or 'off route'. If the location is seen as 'on route' then snapping will occur, otherwise the output location will be the original input location. If it is determined that the tracking along the route is no longer needed the RouteTrackerLocationDataSource::onStop() method can be called on the RouteTrackerLocationDataSource or the LocationDisplay can be reset to a different data source.

    To provide some insight on how the RouteTrackerLocationDataSource works, the data source will pass the locations from the AbstractLocationDataSource::locationChanged(const Esri::ArcGISRuntime::Location&) event to the RouteTracker::trackLocationAsync(const Esri::ArcGISRuntime::Location&). The TrackingStatus::displayLocation will then be returned in this data source's AbstractLocationDataSource::locationChanged(const Esri::ArcGISRuntime::Location&) event.

    To control the orientation of the location display symbol as it navigates along a route refer to the MapView::locationDisplay class.

    During indoor navigation, locations output by the RouteTrackerLocationDataSource retain the z-value and additional source properties, such as the floor, from the input location. This allows the LocationDisplay and a floor filter to follow the user across floors.

    Member Function Documentation

    [explicit] RouteTrackerLocationDataSource::RouteTrackerLocationDataSource(Esri::ArcGISRuntime::RouteTracker *routeTracker, QObject *parent = nullptr)

    Creates a RouteTrackerLocationDataSource object using the passed in RouteTracker and the platform's default location data source.

    RouteTrackerLocationDataSource::RouteTrackerLocationDataSource(Esri::ArcGISRuntime::RouteTracker *routeTracker, Esri::ArcGISRuntime::AbstractLocationDataSource *locationDataSource, QObject *parent = nullptr)

    Creates a RouteTrackerLocationDataSource object.

    [override virtual noexcept] RouteTrackerLocationDataSource::~RouteTrackerLocationDataSource()

    Destructor.

    [override virtual protected slot] void RouteTrackerLocationDataSource::onStart()

    Reimplements: AbstractLocationDataSource::onStart().

    Reacts to start requests by starting the location tracking.

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

    [override virtual protected slot] void RouteTrackerLocationDataSource::onStop()

    Reimplements: AbstractLocationDataSource::onStop().

    Reacts to stop requests by stopping the location tracking.

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