public final class

RouteParameters

extends Object
java.lang.Object
   ↳ com.esri.arcgisruntime.tasks.networkanalysis.RouteParameters

Class Overview

Represents input parameters for computing routes using RouteTask. Use createDefaultParametersAsync() to get an instance of this class that is initialized with smart default values based on the task's metadata getRouteTaskInfo().

To set the stops and barriers (point, polyline or polygon) for solving a route, you can get the modifiable list of each by calling getStops(), getPointBarriers(), getPolygonBarriers() or getPolylineBarriers() and adding your stops and barriers to their respective modifiable lists.

 
   List<Stop> stops = mRouteParameters.getStops();
   stops.add(new Stop(new Point(-13052490.008, 4035542.739, SpatialReferences.getWebMercator())));
 
 
You can also set stops and barriers by executing queries on a FeatureTable and extracting the stops or barriers from features within the table, using setStops(ArcGISFeatureTable, QueryParameters), setPointBarriers(ArcGISFeatureTable, QueryParameters), setPolylineBarriers(ArcGISFeatureTable, QueryParameters), and setPolygonBarriers(ArcGISFeatureTable, QueryParameters).

Summary

Public Constructors
RouteParameters()
Creates an instance of RouteParameters.
Public Methods
void clearPointBarriers()
Clears any point barriers that have been set using setPointBarriers(Iterable) or setPointBarriers(ArcGISFeatureTable, QueryParameters).
void clearPolygonBarriers()
Clears any polygon barriers that have been set using setPolygonBarriers(Iterable) or setPolygonBarriers(ArcGISFeatureTable, QueryParameters).
void clearPolylineBarriers()
Clears any polyline barriers that have been set using setPolylineBarriers(Iterable) or setPolylineBarriers(ArcGISFeatureTable, QueryParameters).
void clearStops()
Clears any stops that have been set using setStops(Iterable) or setStops(ArcGISFeatureTable, QueryParameters).
List<String> getAccumulateAttributeNames()
Gets a list of network attributes to be accumulated and returned as part of the route.
UnitSystem getDirectionsDistanceUnits()
Gets the unit system of measurement used when providing distances for turn-by-turn directions.
String getDirectionsLanguage()
Gets the language used when reporting directions.
DirectionsStyle getDirectionsStyle()
Gets the style being used for providing directions.
SpatialReference getOutputSpatialReference()
Gets the spatial reference in which the result geometries are returned.
List<PointBarrier> getPointBarriers()
This method is deprecated. As of 100.1.0, replaced by setPointBarriers(Iterable)
List<PolygonBarrier> getPolygonBarriers()
This method is deprecated. As of 100.1.0, replaced by setPolygonBarriers(Iterable)
List<PolylineBarrier> getPolylineBarriers()
This method is deprecated. As of 100.1.0, replaced by setPolylineBarriers(Iterable)
RouteShapeType getRouteShapeType()
Gets the route shape type.
String getSearchWhereClause(String sourceName)
Gets the search where clause.
Calendar getStartTime()
Gets the start time that was set.
List<Stop> getStops()
This method is deprecated. As of 100.1.0, replaced by setStops(Iterable)
TravelMode getTravelMode()
Gets the travel mode that was set.
boolean isFindBestSequence()
Indicates if the order of the stops can be changed in order to find the optimal route between all stops.
boolean isPreserveFirstStop()
Indicates if the first input stop is preserved as the first stop on the solved route.
boolean isPreserveLastStop()
Indicates if the last input stop is preserved as the last stop on the solved route.
boolean isReturnDirections()
Gets whether to return direction maneuvers in the result.
boolean isReturnPointBarriers()
Indicates if point barriers will be returned in the result getPointBarriers().
boolean isReturnPolygonBarriers()
Indicates if polygon barriers will be returned in the result getPolygonBarriers().
boolean isReturnPolylineBarriers()
Indicates if polyline barriers will be returned in the result getPolylineBarriers().
boolean isReturnRoutes()
Gets whether to return routes in the result getRoutes().
boolean isReturnStops()
Gets whether returning stops in the result getStops() is enabled or not.
void setDirectionsDistanceUnits(UnitSystem directionsDistanceUnits)
Sets the unit system of measurement used when providing distances for turn-by-turn directions.
void setDirectionsLanguage(String directionsLanguage)
Sets the language used when reporting directions.
void setDirectionsStyle(DirectionsStyle directionsStyle)
Sets the style to use for providing directions.
void setFindBestSequence(boolean findBestSequence)
Sets if the order of the stops can be changed in order to find the optimal route between all stops.
void setOutputSpatialReference(SpatialReference outputSpatialReference)
Sets the spatial reference in which the result geometries should be returned.
void setPointBarriers(Iterable<PointBarrier> barriers)
Sets the point barriers to avoid in the result route.
void setPointBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
Sets the point barriers to avoid in the result route, using features in a given feature table.
void setPolygonBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
Sets the polygon barriers to avoid in the result route, using features in a given feature table.
void setPolygonBarriers(Iterable<PolygonBarrier> barriers)
Sets the polygon barriers to avoid in the result route.
void setPolylineBarriers(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
Sets the polyline barriers to avoid in the result route, using features in a given feature table.
void setPolylineBarriers(Iterable<PolylineBarrier> barriers)
Sets the polyline barriers to avoid in the result route.
void setPreserveFirstStop(boolean preserveFirstStop)
Specifies whether to keep the first stop fixed in the sequence even when setFindBestSequence(boolean) is enabled.
void setPreserveLastStop(boolean preserveLastStop)
Specifies whether to keep the last stop fixed in the sequence even when setFindBestSequence(boolean) is enabled.
void setReturnDirections(boolean returnDirections)
Sets whether to return turn-by-turn directions in the result getDirectionManeuvers().
void setReturnPointBarriers(boolean returnPointBarriers)
Sets whether to return point barriers used while computing the route, in the result getPointBarriers().
void setReturnPolygonBarriers(boolean returnPolygonBarriers)
Sets whether to return polygon barriers used while computing the route, in the result getPolygonBarriers().
void setReturnPolylineBarriers(boolean returnPolylineBarriers)
Sets whether to return polyline barriers used while computing the route, in the result getPolylineBarriers().
void setReturnRoutes(boolean returnRoutes)
Sets to return routes in the result getRoutes().
void setReturnStops(boolean returnStops)
Sets whether to return the stops along each route in the result getStops()
void setRouteShapeType(RouteShapeType routeShapeType)
Sets the route shape type.
void setSearchWhereClause(String sourceName, String searchWhereClause)
Sets the search where clause.
void setStartTime(Calendar startTime)
Sets the time the route begins.
void setStops(Iterable<Stop> stops)
Sets the stops to visit in the result route.
void setStops(ArcGISFeatureTable featureTable, QueryParameters queryParameters)
Sets the stops to visit in the result route, using features in a given feature table.
void setTravelMode(TravelMode travelMode)
Sets the travel mode.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RouteParameters ()

Creates an instance of RouteParameters. The recommended way is to use createDefaultParametersAsync(), which creates a set of necessary default parameters required for solving a route with a particular RouteTask.

Public Methods

public void clearPointBarriers ()

Clears any point barriers that have been set using setPointBarriers(Iterable) or setPointBarriers(ArcGISFeatureTable, QueryParameters).

public void clearPolygonBarriers ()

Clears any polygon barriers that have been set using setPolygonBarriers(Iterable) or setPolygonBarriers(ArcGISFeatureTable, QueryParameters).

public void clearPolylineBarriers ()

Clears any polyline barriers that have been set using setPolylineBarriers(Iterable) or setPolylineBarriers(ArcGISFeatureTable, QueryParameters).

public void clearStops ()

Clears any stops that have been set using setStops(Iterable) or setStops(ArcGISFeatureTable, QueryParameters).

public List<String> getAccumulateAttributeNames ()

Gets a list of network attributes to be accumulated and returned as part of the route. Available attributes are specified by getAccumulateAttributeNames().

Returns
  • the accumulate attribute names

public UnitSystem getDirectionsDistanceUnits ()

Gets the unit system of measurement used when providing distances for turn-by-turn directions.

Returns
  • the unit system of measurement
See Also

public String getDirectionsLanguage ()

Gets the language used when reporting directions.

Returns
  • the directions language

public DirectionsStyle getDirectionsStyle ()

Gets the style being used for providing directions.

Returns
  • the directions style

public SpatialReference getOutputSpatialReference ()

Gets the spatial reference in which the result geometries are returned.

Returns
  • the output spatial reference

public List<PointBarrier> getPointBarriers ()

This method is deprecated.
As of 100.1.0, replaced by setPointBarriers(Iterable)

This method is a deprecated way to set the point barriers to avoid in the result route. Initially it returns an empty list. Adding point barriers to this list automatically updates the point barriers in the same way as calling setPointBarriers(Iterable) would. The new way to set a collection of point barriers is to create your own collection and pass it to setPointBarriers(Iterable).

Returns
  • a modifiable list of point barriers

public List<PolygonBarrier> getPolygonBarriers ()

This method is deprecated.
As of 100.1.0, replaced by setPolygonBarriers(Iterable)

This method is a deprecated way to set the polygon barriers to avoid in the result route. Initially it returns an empty list. Adding polygon barriers to this list automatically updates the polygon barriers in the same way as calling setPolygonBarriers(Iterable) would. The new way to set a collection of polygon barriers is to create your own collection and pass it to setPolygonBarriers(Iterable).

Returns
  • a modifiable list of polygon barriers

public List<PolylineBarrier> getPolylineBarriers ()

This method is deprecated.
As of 100.1.0, replaced by setPolylineBarriers(Iterable)

This method is a deprecated way to set the polyline barriers to avoid in the result route. Initially it returns an empty list. Adding polyline barriers to this list automatically updates the polyline barriers in the same way as calling setPolylineBarriers(Iterable) would. The new way to set a collection of polyline barriers is to create your own collection and pass it to setPolylineBarriers(Iterable).

Returns
  • a modifiable list of polyline barriers

public RouteShapeType getRouteShapeType ()

Gets the route shape type.

Returns
  • the route shape type

public String getSearchWhereClause (String sourceName)

Gets the search where clause.

Parameters
sourceName source name
Returns
  • the search where clause. Returns empty string if sourceName was not set.

public Calendar getStartTime ()

Gets the start time that was set.

Returns
  • the start time. Returns null if it was not set

public List<Stop> getStops ()

This method is deprecated.
As of 100.1.0, replaced by setStops(Iterable)

This method is a deprecated way to set the stops to visit in the result route. Initially it returns an empty list. Adding stops to this list automatically updates the stops in the same way as calling setStops(Iterable) would. The new way to set a collection of stops is to create your own collection and pass it to setStops(Iterable).

Returns
  • a modifiable list of stops

public TravelMode getTravelMode ()

Gets the travel mode that was set.

Returns
  • the travel mode. Returns the default based on the database if the travel mode is not set.

public boolean isFindBestSequence ()

Indicates if the order of the stops can be changed in order to find the optimal route between all stops.

Returns
  • true if the order of stops can be changed, false otherwise

public boolean isPreserveFirstStop ()

Indicates if the first input stop is preserved as the first stop on the solved route. Has no affect if isFindBestSequence is false.

Returns
  • true if the first stop is preserved as the route departure location; false otherwise

public boolean isPreserveLastStop ()

Indicates if the last input stop is preserved as the last stop on the solved route. Has no affect if isFindBestSequence is false.

Returns
  • true if the last stop is preserved as the route departure location; false otherwise

public boolean isReturnDirections ()

Gets whether to return direction maneuvers in the result.

Returns
  • true if the direction maneuvers are returned in the result, false otherwise

public boolean isReturnPointBarriers ()

Indicates if point barriers will be returned in the result getPointBarriers().

Returns
  • true if returning point barriers in the result is enabled, false otherwise

public boolean isReturnPolygonBarriers ()

Indicates if polygon barriers will be returned in the result getPolygonBarriers().

Returns
  • true if returning polygon barriers in the result is enabled, false otherwise

public boolean isReturnPolylineBarriers ()

Indicates if polyline barriers will be returned in the result getPolylineBarriers().

Returns
  • true if returning polyline barriers in the result is enabled, false otherwise

public boolean isReturnRoutes ()

Gets whether to return routes in the result getRoutes().

Returns
  • if the routes will be returned in the result, false otherwise

public boolean isReturnStops ()

Gets whether returning stops in the result getStops() is enabled or not.

Returns
  • true if returning stops in the result is enabled, false otherwise

public void setDirectionsDistanceUnits (UnitSystem directionsDistanceUnits)

Sets the unit system of measurement used when providing distances for turn-by-turn directions.

Parameters
directionsDistanceUnits the unit system of measurement
See Also

public void setDirectionsLanguage (String directionsLanguage)

Sets the language used when reporting directions. The list of supported languages can be obtained by calling getSupportedLanguages().

Parameters
directionsLanguage directions language

public void setDirectionsStyle (DirectionsStyle directionsStyle)

Sets the style to use for providing directions.

Parameters
directionsStyle directions style
Throws
IllegalArgumentException if directionsStyle is null

public void setFindBestSequence (boolean findBestSequence)

Sets if the order of the stops can be changed in order to find the optimal route between all stops.

Parameters
findBestSequence find best sequence

public void setOutputSpatialReference (SpatialReference outputSpatialReference)

Sets the spatial reference in which the result geometries should be returned. If not specified then the results will be returned in the spatial reference specified by getOutputSpatialReference().

Parameters
outputSpatialReference output spatial reference
Throws
IllegalArgumentException if outputSpatialReference is null

public void setPointBarriers (Iterable<PointBarrier> barriers)

Sets the point barriers to avoid in the result route.

Note: calling this method causes any point barriers set by a previous call to setPointBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

Parameters
barriers the point barriers
Throws
IllegalArgumentException if barriers is null

public void setPointBarriers (ArcGISFeatureTable featureTable, QueryParameters queryParameters)

Sets the point barriers to avoid in the result route, using features in a given feature table.

The feature table can be either local or online and must be of geometry type point. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until solveRouteAsync(RouteParameters) is called.

Note: calling this method causes any point barriers set by a previous call to setPointBarriers(Iterable) to be cleared.

Parameters
featureTable the feature table
queryParameters the query parameters
Throws
IllegalArgumentException if featureTable or queryParameters is null

public void setPolygonBarriers (ArcGISFeatureTable featureTable, QueryParameters queryParameters)

Sets the polygon barriers to avoid in the result route, using features in a given feature table.

The feature table can be either local or online and must be of geometry type polygon. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until solveRouteAsync(RouteParameters) is called.

Note: calling this method causes any polygon barriers set by a previous call to setPolygonBarriers(Iterable) to be cleared.

Parameters
featureTable the feature table
queryParameters the query parameters
Throws
IllegalArgumentException if featureTable or queryParameters is null

public void setPolygonBarriers (Iterable<PolygonBarrier> barriers)

Sets the polygon barriers to avoid in the result route.

Note: calling this method causes any polygon barriers set by a previous call to setPolygonBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

Parameters
barriers the polygon barriers
Throws
IllegalArgumentException if barriers is null

public void setPolylineBarriers (ArcGISFeatureTable featureTable, QueryParameters queryParameters)

Sets the polyline barriers to avoid in the result route, using features in a given feature table.

The feature table can be either local or online and must be of geometry type polyline. Attributes from the feature table are mapped to the properties on the barrier objects generated from the specified feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until solveRouteAsync(RouteParameters) is called.

Note: calling this method causes any polyline barriers set by a previous call to setPolylineBarriers(Iterable) to be cleared.

Parameters
featureTable the feature table
queryParameters the query parameters
Throws
IllegalArgumentException if featureTable or queryParameters is null

public void setPolylineBarriers (Iterable<PolylineBarrier> barriers)

Sets the polyline barriers to avoid in the result route.

Note: calling this method causes any polyline barriers set by a previous call to setPolylineBarriers(ArcGISFeatureTable, QueryParameters) to be cleared.

Parameters
barriers the polyline barriers
Throws
IllegalArgumentException if barriers is null

public void setPreserveFirstStop (boolean preserveFirstStop)

Specifies whether to keep the first stop fixed in the sequence even when setFindBestSequence(boolean) is enabled. Only applicable if setFindBestSequence(boolean) is enabled.

Parameters
preserveFirstStop preserve first stop

public void setPreserveLastStop (boolean preserveLastStop)

Specifies whether to keep the last stop fixed in the sequence even when setFindBestSequence(boolean) is enabled. Only applicable if setFindBestSequence(boolean) is enabled.

Parameters
preserveLastStop preserve last stop

public void setReturnDirections (boolean returnDirections)

Sets whether to return turn-by-turn directions in the result getDirectionManeuvers().

Parameters
returnDirections whether to return direction maneuvers with the result routes

public void setReturnPointBarriers (boolean returnPointBarriers)

Sets whether to return point barriers used while computing the route, in the result getPointBarriers().

Parameters
returnPointBarriers whether to return point barriers

public void setReturnPolygonBarriers (boolean returnPolygonBarriers)

Sets whether to return polygon barriers used while computing the route, in the result getPolygonBarriers().

Parameters
returnPolygonBarriers whether to return polygon barriers

public void setReturnPolylineBarriers (boolean returnPolylineBarriers)

Sets whether to return polyline barriers used while computing the route, in the result getPolylineBarriers().

Parameters
returnPolylineBarriers whether to return polyline barriers

public void setReturnRoutes (boolean returnRoutes)

Sets to return routes in the result getRoutes().

Parameters
returnRoutes whether to return routes

public void setReturnStops (boolean returnStops)

Sets whether to return the stops along each route in the result getStops()

Parameters
returnStops whether to return stops

public void setRouteShapeType (RouteShapeType routeShapeType)

Sets the route shape type.

Parameters
routeShapeType route shape type
Throws
IllegalArgumentException if routeShapeType is null

public void setSearchWhereClause (String sourceName, String searchWhereClause)

Sets the search where clause.

Parameters
sourceName source name
searchWhereClause search where clause

public void setStartTime (Calendar startTime)

Sets the time the route begins. If not specified, defaults to the time the task is executed.

Parameters
startTime start time. It can be null.

public void setStops (Iterable<Stop> stops)

Sets the stops to visit in the result route.

Note: calling this method causes any stops set by a previous call to setStops(ArcGISFeatureTable, QueryParameters) to be cleared.

Parameters
stops the stops
Throws
IllegalArgumentException if stops is null

public void setStops (ArcGISFeatureTable featureTable, QueryParameters queryParameters)

Sets the stops to visit in the result route, using features in a given feature table.

The feature table can be either local or online and must be of geometry type point. Attributes from the feature table are mapped to the properties on the stops objects generated from the feature table. The where clause set in the query parameters will be applied to the feature table. If an online feature table is specified the table will not be queried for features until solveRouteAsync(RouteParameters) is called.

Note: calling this method causes any stops set by a previous call to setStops(Iterable) to be cleared.

Parameters
featureTable the feature table
queryParameters the query parameters
Throws
IllegalArgumentException if featureTable or queryParameters is null

public void setTravelMode (TravelMode travelMode)

Sets the travel mode.

Parameters
travelMode travel mode
Throws
IllegalArgumentException if travelMode is null