public class

ServiceAreaTask

extends Object
java.lang.Object
   ↳ com.esri.core.tasks.na.ServiceAreaTask

Class Overview

Used to perform a 'solve service area' operation on a network layer resource of type service area. The layer resource is defined by its URL and can be a secure resource requiring user credentials for access.

To solve a service area problem, and thus find the service areas for an input facility/location or set of facilities/locations, an instance of ServiceAreaParameters must first be obtained using getDefaultParameters() then populated with any desired parameters. These parameters are then passed to the ServiceAreaTask instance and the task can be solved synchronously (solve(ServiceAreaParameters).

In both cases this operation, if successful, generates a ServiceAreaResult from which the relevant information (in particular the service area polygons) can be obtained.

Summary

Public Constructors
ServiceAreaTask(String url)
Instantiates a new service area task using the URL for a service area network layer resource.
ServiceAreaTask(String url, UserCredentials credentials)
Instantiates a new service area task using the URL for a service area network layer resource and the user credentials to access the secure resource.
Public Methods
ServiceAreaParameters getDefaultParameters()
Retrieves the default parameters as defined by the service layer.
ServiceAreaResult solve(ServiceAreaParameters sap)
Executes the ServiceAreaParameters defined for this ServiceAreaTask and returns a ServiceAreaResult containing the results.
Future<ServiceAreaResult> solve(ServiceAreaParameters sap, CallbackListener<ServiceAreaResult> callback)
Solve a service area problem asynchronously passing in a ServiceAreaParameters} object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ServiceAreaTask (String url)

Instantiates a new service area task using the URL for a service area network layer resource.

Parameters
url String: the URL

public ServiceAreaTask (String url, UserCredentials credentials)

Instantiates a new service area task using the URL for a service area network layer resource and the user credentials to access the secure resource.

Parameters
url String: the URL of a secure service area network layer resource
credentials UserCredentials: the user credentials to access the secure resource

Public Methods

public ServiceAreaParameters getDefaultParameters ()

Retrieves the default parameters as defined by the service layer.

Returns
ServiceAreaParameters ServiceAreaParameters the server-default parameters
Throws
Exception any exception while retrieving the parameters

public ServiceAreaResult solve (ServiceAreaParameters sap)

Executes the ServiceAreaParameters defined for this ServiceAreaTask and returns a ServiceAreaResult containing the results.

Parameters
sap ServiceAreaParameters: the service area parameters
Returns
ServiceAreaResult the ServiceAreaResult containing the results
Throws
Exception any exception during execution

public Future<ServiceAreaResult> solve (ServiceAreaParameters sap, CallbackListener<ServiceAreaResult> callback)

Solve a service area problem asynchronously passing in a ServiceAreaParameters} object. If the solve has not already started execution, it can be cancelled using the cancel method on the Future returned.

Parameters
sap ServiceAreaParameters: The ServiceAreaParameters object that contains the settings for the solve and the inputs
callback CallbackListener: A callback that will be used when the solve completes. Override onCallback(Object) to handle a successful solve and onError(Throwable) to handle a solve that fails.
Returns
Future<ServiceAreaResult> A Future object that can be used to poll for or cancel the solve operation.