ClosestFacilityTask Class

  • ClosestFacilityTask
  • class Esri::ArcGISRuntime::ClosestFacilityTask

    A task to find a least-cost route between facilities and incidents. More...

    Header: #include <ClosestFacilityTask.h>
    Since: Esri::ArcGISRuntime 100.1
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::ApiKeyResource, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    ClosestFacilityTask(const QString &databasePath, const QString &networkName, QObject *parent = nullptr)
    ClosestFacilityTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    ClosestFacilityTask(const QUrl &url, QObject *parent = nullptr)
    ClosestFacilityTask(Esri::ArcGISRuntime::TransportationNetworkDataset *transportationNetworkDataset, QObject *parent = nullptr)
    virtual ~ClosestFacilityTask() override
    Esri::ArcGISRuntime::ClosestFacilityTaskInfo closestFacilityTaskInfo() const
    QFuture<Esri::ArcGISRuntime::ClosestFacilityParameters> createDefaultParametersAsync()
    Esri::ArcGISRuntime::TaskWatcher solveClosestFacility(const Esri::ArcGISRuntime::ClosestFacilityParameters &closestFacilityParameters)
    Esri::ArcGISRuntime::TransportationNetworkDataset *transportationNetworkDataset() const

    Reimplemented Public Functions

    virtual QString apiKey() const override
    virtual void cancelLoad() override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    virtual void setApiKey(const QString &apiKey) override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override


    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Detailed Description

    The closest facility task class uses a transportation network to measure the cost of traveling between incidents and facilities and determines which are nearest to one other in terms of cost. When finding closest facilities, you can specify how many to find and whether the direction of travel is toward or away from them. You can also provide impedance attributes to be considered when calculating route cost. ClosestFacilityTask is executed asynchronously. A successful execution returns a ClosestFacilityResult instance with details about the closest facility route.

    The closest facility task works in an online connected scenario by using a transportation network that is published to ArcGIS Server as an online Network Analyst closest facility service. Esri also provides ready-to-use services, such as the Directions and Routing Services, which requires authentication with an ArcGIS organizational account. In connected scenarios, provide a URL to the REST endpoint of the service, along with any necessary credentials.

    See also Loadable and Closest Facility REST API documentation.

    Member Function Documentation

    [since Esri::ArcGISRuntime 100.2] ClosestFacilityTask::ClosestFacilityTask(const QString &databasePath, const QString &networkName, QObject *parent = nullptr)

    Constructor that takes a databasePath and networkName, with an optional parent.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    ClosestFacilityTask::ClosestFacilityTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that takes a url to a secured Network Analysis service endpoint and a credential, with an optional parent.

    [explicit] ClosestFacilityTask::ClosestFacilityTask(const QUrl &url, QObject *parent = nullptr)

    Constructor that takes a url to a Network Analysis service endpoint with an optional parent.

    [explicit, since Esri::ArcGISRuntime 100.2] ClosestFacilityTask::ClosestFacilityTask(Esri::ArcGISRuntime::TransportationNetworkDataset *transportationNetworkDataset, QObject *parent = nullptr)

    Constructor that takes a transportationNetworkDataset with an optional parent.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [override virtual] ClosestFacilityTask::~ClosestFacilityTask()


    [override virtual, since Esri::ArcGISRuntime 100.10] QString ClosestFacilityTask::apiKey() const

    Reimplements: ApiKeyResource::apiKey() const.

    Returns the API key.

    See ApiKeyResource.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also setApiKey().

    [override virtual] void ClosestFacilityTask::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    Esri::ArcGISRuntime::ClosestFacilityTaskInfo ClosestFacilityTask::closestFacilityTaskInfo() const

    Returns the ClosestFacilityTaskInfo about the ClosestFacilityTask.

    Wait until the ClosestFacilityTask is doneLoading before attempting to obtain the ClosestFacilityTaskInfo.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::ClosestFacilityParameters> ClosestFacilityTask::createDefaultParametersAsync()

    Returns the default parameters.

    Retrieves the default parameters as defined by the service.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [override virtual] Esri::ArcGISRuntime::Credential *ClosestFacilityTask::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns the security credential used to access the closest facility service.

    Only applicable if using an online service that is secured.

    [signal] void ClosestFacilityTask::doneLoading(const Esri::ArcGISRuntime::Error &loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    Note: If there is a load error it will also be emitted on the errorOccurred signal.

    See also Loadable and Object.

    [override virtual] void ClosestFacilityTask::load()

    Reimplements: Loadable::load().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error ClosestFacilityTask::loadError() const

    Reimplements: Loadable::loadError() const.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::LoadStatus ClosestFacilityTask::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    [signal] void ClosestFacilityTask::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the load status changes for this object.

    See also Loadable.

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::RequestConfiguration ClosestFacilityTask::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this task.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual] void ClosestFacilityTask::retryLoad()

    Reimplements: Loadable::retryLoad().

    See Loadable.

    [override virtual, since Esri::ArcGISRuntime 100.10] void ClosestFacilityTask::setApiKey(const QString &apiKey)

    Reimplements: ApiKeyResource::setApiKey(const QString &apiKey).

    Sets the API key to apiKey.

    See ApiKeyResource.

    This function was introduced in Esri::ArcGISRuntime 100.10.

    See also apiKey().

    [override virtual, since Esri::ArcGISRuntime 100.1] void ClosestFacilityTask::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets configuration parameters used for network requests sent by this task to requestConfiguration.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

    Esri::ArcGISRuntime::TaskWatcher ClosestFacilityTask::solveClosestFacility(const Esri::ArcGISRuntime::ClosestFacilityParameters &closestFacilityParameters)

    Solves a closest facility with the given closestFacilityParameters.

    The solveClosestFacilityCompleted signal will emit once the operation is complete, giving access to the ClosestFacilityResult.

    [since Esri::ArcGISRuntime 100.2] Esri::ArcGISRuntime::TransportationNetworkDataset *ClosestFacilityTask::transportationNetworkDataset() const

    Returns the TransportationNetworkDataset used to construct this ClosestFacilityTask.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    [override virtual] QUrl ClosestFacilityTask::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL to the online service.

    Only applicable to online closest facility.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.