Class ClosestFacilityParameters
ClosestFacilityTask
. This class contains
all inputs for the ClosestFacilityTask, as well as settings such as he impedance attribute, accumulate and restriction
attributes, backtrack (u-turn) policy, etc.
Use ClosestFacilityTask.createDefaultParametersAsync()
to get an instance of this class that is initialized with smart
default values based on the task's metadata ClosestFacilityTask.getClosestFacilityTaskInfo()
.
To set the facilities, incidents and barriers (point, polyline or polygon) for solving a closest facility, you can use
the following methods setFacilities(Iterable)
, setIncidents(Iterable)
, setPointBarriers(Iterable)
,
setPolylineBarriers(Iterable)
or setPolygonBarriers(Iterable)
.
For example:
List<Facility> facilities = new ArrayList<Facility>();
facilities.add(new Facility(new Point(-13052490.008, 4035542.739, SpatialReferences.getWebMercator())));
mClosestFacilityParameters.setFacilities(facilities);
You can also set facilities, incidents and barriers by executing queries on a FeatureTable and extracting the facilities, incidents or barriers from
features within the table, using setFacilities(ArcGISFeatureTable, QueryParameters)
, setIncidents(ArcGISFeatureTable, QueryParameters)
,
setPointBarriers(ArcGISFeatureTable, QueryParameters)
, setPolylineBarriers(ArcGISFeatureTable, QueryParameters)
,
and setPolygonBarriers(ArcGISFeatureTable, QueryParameters)
.
- Since:
- 100.1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears any facilities that have been set usingsetFacilities(Iterable)
orsetFacilities(ArcGISFeatureTable, QueryParameters)
.void
Clears any incidents that have been set usingsetIncidents(Iterable)
orsetIncidents(ArcGISFeatureTable, QueryParameters)
.void
Clears any point barriers that have been set usingsetPointBarriers(Iterable)
orsetPointBarriers(ArcGISFeatureTable, QueryParameters)
.void
Clears any polygon barriers that have been set usingsetPolygonBarriers(Iterable)
orsetPolygonBarriers(ArcGISFeatureTable, QueryParameters)
.void
Clears any polyline barriers that have been set usingsetPolylineBarriers(Iterable)
orsetPolylineBarriers(ArcGISFeatureTable, QueryParameters)
.Gets a list of network attributes to be accumulated and returned as part of the closest facility route.double
Gets the default impedance cutoff which is a value for the impedance beyond which facilities should not be found.int
Gets the default target facility count.Gets the unit system of measurement used when providing distances for turn-by-turn directions.Gets the language used when reporting directions.Gets the style being used for providing directions.Gets the spatial reference in which the result geometries are returned.Gets the route shape type.getSearchWhereClause
(String sourceName) Gets the search where clause.Gets the start time that was set.Gets the start time usage type.Gets the travel direction.Gets the travel mode that was set.boolean
Gets whether to return direction maneuvers in the result.boolean
Indicates if point barriers will be returned in the resultClosestFacilityResult.getPointBarriers()
.boolean
Indicates if polygon barriers will be returned in the resultClosestFacilityResult.getPolygonBarriers()
.boolean
Indicates if polyline barriers will be returned in the resultClosestFacilityResult.getPolylineBarriers()
.boolean
Gets whether to return routes in the resultClosestFacilityResult.getRoute(int, int)
.void
setDefaultImpedanceCutoff
(double defaultImpedanceCutoff) Sets the default impedance cutoff which is a value for the impedance beyond which facilities should not be found.void
setDefaultTargetFacilityCount
(int defaultTargetFacilityCount) Sets the default target facility count.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
setFacilities
(ArcGISFeatureTable featureTable, QueryParameters queryParameters) Sets the facilities that are searched for when finding the closest location, using features in a given feature table.void
setFacilities
(Iterable<Facility> facilities) Sets the facilities that are searched for when finding the closest location.void
setIncidents
(ArcGISFeatureTable featureTable, QueryParameters queryParameters) Sets the incidents from which the service searches for the nearby locations, using features in a given feature table.void
setIncidents
(Iterable<Incident> incidents) Sets the incidents from which the service searches for the nearby locations.void
setOutputSpatialReference
(SpatialReference outputSpatialReference) Sets the spatial reference in which the result geometries should be returned.void
setPointBarriers
(ArcGISFeatureTable featureTable, QueryParameters queryParameters) Sets the point barriers to avoid in the result closest facility route, using features in a given feature table.void
setPointBarriers
(Iterable<PointBarrier> barriers) Sets the point barriers to avoid in the result closest facility route.void
setPolygonBarriers
(ArcGISFeatureTable featureTable, QueryParameters queryParameters) Sets the polygon barriers to avoid in the result closest facility route, using features in a given feature table.void
setPolygonBarriers
(Iterable<PolygonBarrier> barriers) Sets the polygon barriers to avoid in the result closest facility route.void
setPolylineBarriers
(ArcGISFeatureTable featureTable, QueryParameters queryParameters) Sets the polyline barriers to avoid in the result closest facility route, using features in a given feature table.void
setPolylineBarriers
(Iterable<PolylineBarrier> barriers) Sets the polyline barriers to avoid in the result closest facility route.void
setReturnDirections
(boolean returnDirections) Sets whether to return turn-by-turn directions in the resultClosestFacilityRoute.getDirectionManeuvers()
.void
setReturnPointBarriers
(boolean returnPointBarriers) Sets whether to return point barriers used while computing the route, in the resultClosestFacilityResult.getPointBarriers()
.void
setReturnPolygonBarriers
(boolean returnPolygonBarriers) Sets whether to return polygon barriers used while computing the route, in the resultClosestFacilityResult.getPolygonBarriers()
.void
setReturnPolylineBarriers
(boolean returnPolylineBarriers) Sets whether to return polyline barriers used while computing the route, in the resultClosestFacilityResult.getPolylineBarriers()
.void
setReturnRoutes
(boolean returnRoutes) Sets whether to return routes in the resultClosestFacilityResult.getRoute(int, int)
.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 closest facility route begins.void
setStartTimeUsage
(StartTimeUsage startTimeUsage) Sets the start time usage type.void
setTravelDirection
(TravelDirection travelDirection) Sets the travel direction.void
setTravelMode
(TravelMode travelMode) Sets the travel mode.
-
Method Details
-
getAccumulateAttributeNames
Gets a list of network attributes to be accumulated and returned as part of the closest facility route.For example, accumulateAttributeNames = {"Miles", "Kilometers"} indicates that the total cost of the closest facility route should also be calculated in miles and kilometers. All supported attributes can be obtained from
ClosestFacilityTaskInfo.getCostAttributes()
.- Returns:
- the accumulate attribute names
- Since:
- 100.1.0
- See Also:
-
getTravelMode
Gets the travel mode that was set.- Returns:
- the travel mode or a default if not set
- Since:
- 100.1.0
-
setTravelMode
Sets the travel mode.- Parameters:
travelMode
- the travel mode- Throws:
IllegalArgumentException
- if travelMode is null- Since:
- 100.1.0
-
getDefaultTargetFacilityCount
public int getDefaultTargetFacilityCount()Gets the default target facility count.Current value will be applied for solving closest facility if
Incident.getTargetFacilityCount()
is not specified.- Returns:
- the default count of target facility
- Since:
- 100.1.0
- See Also:
-
setDefaultTargetFacilityCount
public void setDefaultTargetFacilityCount(int defaultTargetFacilityCount) Sets the default target facility count.Current value will be applied for solving closest facility if
Incident.getTargetFacilityCount()
is not specified.- Parameters:
defaultTargetFacilityCount
- the default target facility count- Since:
- 100.1.0
- See Also:
-
getDefaultImpedanceCutoff
public double getDefaultImpedanceCutoff()Gets the default impedance cutoff which is a value for the impedance beyond which facilities should not be found.For instance, while finding the closest hospitals from the site of an accident, a cutoff value of 15 minutes would mean that the closest facility task would search for the closest hospital within 15 minutes from the incident. If the closest hospital is 17 minutes away, no routes will be returned in the output routes. A cutoff value is especially useful when searching for multiple facilities or incidents. The units for impedance cutoff is based on the value of the
TravelMode.getImpedanceAttributeName()
. For example, ifTravelMode.getImpedanceAttributeName()
is TravelTime, the defaultImpedanceCutoff is specified in minutes. Current value will be applied for solving closest facility ifFacility.getImpedanceCutoff()
orIncident.getImpedanceCutoff()
is not specified.- Returns:
- the default impedance cutoff
- Since:
- 100.1.0
- See Also:
-
setDefaultImpedanceCutoff
public void setDefaultImpedanceCutoff(double defaultImpedanceCutoff) Sets the default impedance cutoff which is a value for the impedance beyond which facilities should not be found.For instance, while finding the closest hospitals from the site of an accident, a cutoff value of 15 minutes would mean that the closest facility task would search for the closest hospital within 15 minutes from the incident. If the closest hospital is 17 minutes away, no routes will be returned in the output routes. A cutoff value is especially useful when searching for multiple facilities or incidents. The units for impedance cutoff is based on the value of the
TravelMode.getImpedanceAttributeName()
. For example, ifTravelMode.getImpedanceAttributeName()
is TravelTime, the defaultImpedanceCutoff is specified in minutes. Current value will be applied for solving closest facility ifFacility.getImpedanceCutoff()
orIncident.getImpedanceCutoff()
are not specified.- Parameters:
defaultImpedanceCutoff
- the default impedance cutoff- Since:
- 100.1.0
- See Also:
-
getStartTime
Gets the start time that was set. If not specified, defaults to the time the task is executed.- Returns:
- the start time. Returns null if it was not set
- Since:
- 100.1.0
- See Also:
-
setStartTime
Sets the time the closest facility route begins. If not specified, defaults to the time the task is executed.- Parameters:
startTime
- start time, can be null- Since:
- 100.1.0
- See Also:
-
getStartTimeUsage
Gets the start time usage type.- Returns:
- the start time usage type
- Since:
- 100.1.0
- See Also:
-
setStartTimeUsage
Sets the start time usage type.- Parameters:
startTimeUsage
- the StartTimeUsage enum value- Throws:
IllegalArgumentException
- if startTimeUsage is null- Since:
- 100.1.0
- See Also:
-
getTravelDirection
Gets the travel direction.- Returns:
- the travel direction
- Since:
- 100.1.0
- See Also:
-
setTravelDirection
Sets the travel direction.- Parameters:
travelDirection
- the travel direction- Throws:
IllegalArgumentException
- if travelDirection is null- Since:
- 100.1.0
- See Also:
-
getRouteShapeType
Gets the route shape type.Specifies the route shape type that will be used in
ClosestFacilityRoute.getRouteGeometry()
.- Returns:
- the route shape type
- Since:
- 100.1.0
- See Also:
-
setRouteShapeType
Sets the route shape type.Specifies the route shape type that will be used in
ClosestFacilityRoute.getRouteGeometry()
.- Parameters:
routeShapeType
- route shape type- Throws:
IllegalArgumentException
- if routeShapeType is null- Since:
- 100.1.0
- See Also:
-
getOutputSpatialReference
Gets the spatial reference in which the result geometries are returned.- Returns:
- the output spatial reference
- Since:
- 100.1.0
- See Also:
-
setOutputSpatialReference
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 byClosestFacilityTaskInfo.getOutputSpatialReference()
.- Parameters:
outputSpatialReference
- the output spatial reference- Throws:
IllegalArgumentException
- if outputSpatialReference is null- Since:
- 100.1.0
- See Also:
-
isReturnPointBarriers
public boolean isReturnPointBarriers()Indicates if point barriers will be returned in the resultClosestFacilityResult.getPointBarriers()
.- Returns:
- true if returning point barriers in the result is enabled, false otherwise
- Since:
- 100.1.0
-
setReturnPointBarriers
public void setReturnPointBarriers(boolean returnPointBarriers) Sets whether to return point barriers used while computing the route, in the resultClosestFacilityResult.getPointBarriers()
.- Parameters:
returnPointBarriers
- true to return point barriers, otherwise false- Since:
- 100.1.0
-
isReturnPolylineBarriers
public boolean isReturnPolylineBarriers()Indicates if polyline barriers will be returned in the resultClosestFacilityResult.getPolylineBarriers()
.- Returns:
- true if returning polyline barriers in the result is enabled, false otherwise
- Since:
- 100.1.0
-
setReturnPolylineBarriers
public void setReturnPolylineBarriers(boolean returnPolylineBarriers) Sets whether to return polyline barriers used while computing the route, in the resultClosestFacilityResult.getPolylineBarriers()
.- Parameters:
returnPolylineBarriers
- true to return polyline barriers, otherwise false- Since:
- 100.1.0
-
isReturnPolygonBarriers
public boolean isReturnPolygonBarriers()Indicates if polygon barriers will be returned in the resultClosestFacilityResult.getPolygonBarriers()
.- Returns:
- true if returning polygon barriers in the result is enabled, false otherwise
- Since:
- 100.1.0
-
setReturnPolygonBarriers
public void setReturnPolygonBarriers(boolean returnPolygonBarriers) Sets whether to return polygon barriers used while computing the route, in the resultClosestFacilityResult.getPolygonBarriers()
.- Parameters:
returnPolygonBarriers
- true to return polygon barriers, otherwise false- Since:
- 100.1.0
-
isReturnRoutes
public boolean isReturnRoutes()Gets whether to return routes in the resultClosestFacilityResult.getRoute(int, int)
.- Returns:
- true if the routes will be returned in the result, false otherwise
- Since:
- 100.1.0
-
setReturnRoutes
public void setReturnRoutes(boolean returnRoutes) Sets whether to return routes in the resultClosestFacilityResult.getRoute(int, int)
.- Parameters:
returnRoutes
- true to return routes, otherwise false- Since:
- 100.1.0
-
isReturnDirections
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
- Since:
- 100.1.0
-
setReturnDirections
public void setReturnDirections(boolean returnDirections) Sets whether to return turn-by-turn directions in the resultClosestFacilityRoute.getDirectionManeuvers()
.- Parameters:
returnDirections
- true to return direction maneuvers with the result routes, otherwise false- Since:
- 100.1.0
-
getDirectionsDistanceUnits
Gets the unit system of measurement used when providing distances for turn-by-turn directions.- Returns:
- the unit system of measurement
- Since:
- 100.1.0
- See Also:
-
setDirectionsDistanceUnits
Sets the unit system of measurement used when providing distances for turn-by-turn directions.- Parameters:
directionsDistanceUnits
- the unit system of measurement- Throws:
IllegalArgumentException
- if directionsDistanceUnits is null- Since:
- 100.1.0
- See Also:
-
getDirectionsLanguage
Gets the language used when reporting directions.- Returns:
- the directions language
- Since:
- 100.1.0
- See Also:
-
setDirectionsLanguage
Sets the language used when reporting directions. The list of supported languages can be obtained by callingClosestFacilityTaskInfo.getSupportedLanguages()
.- Parameters:
directionsLanguage
- the directions language- Since:
- 100.1.0
- See Also:
-
getDirectionsStyle
Gets the style being used for providing directions.- Returns:
- the directions style
- Since:
- 100.1.0
- See Also:
-
setDirectionsStyle
Sets the style to use for providing directions.- Parameters:
directionsStyle
- the directions style- Throws:
IllegalArgumentException
- if directionsStyle is null- Since:
- 100.1.0
- See Also:
-
getSearchWhereClause
Gets the search where clause.This filters the potential matches returned from the task based on an expression. Search where clauses are not supported for online closest facility tasks. They are only supported when solving local closest facility tasks.
- Parameters:
sourceName
- the name of source in local network- Returns:
- the search where clause. Returns empty string if sourceName was not set
- Since:
- 100.1.0
-
setSearchWhereClause
Sets the search where clause.This filters the potential matches returned from the task based on an expression. Search where clauses are not supported for online closest facility tasks. They are only supported when solving local closest facility tasks.
- Parameters:
sourceName
- the name of source in local networksearchWhereClause
- the search where clause- Since:
- 100.1.0
-
setFacilities
Sets the facilities that are searched for when finding the closest location.Note: calling this method causes any facilities set by a previous call to
setFacilities(ArcGISFeatureTable, QueryParameters)
to be cleared.- Parameters:
facilities
- the facilities- Throws:
IllegalArgumentException
- if facilities is null- Since:
- 100.1.0
-
setFacilities
Sets the facilities that are searched for when finding the closest location, 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 facilities 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
ClosestFacilityTask.solveClosestFacilityAsync(ClosestFacilityParameters)
is called.Note: calling this method causes any facilities set by a previous call to
setFacilities(Iterable)
to be cleared.- Parameters:
featureTable
- the feature tablequeryParameters
- the query parameters- Throws:
IllegalArgumentException
- if featureTable or queryParameters is null- Since:
- 100.1.0
-
clearFacilities
public void clearFacilities()Clears any facilities that have been set usingsetFacilities(Iterable)
orsetFacilities(ArcGISFeatureTable, QueryParameters)
.- Since:
- 100.1.0
-
setIncidents
Sets the incidents from which the service searches for the nearby locations.Note: calling this method causes any incidents set by a previous call to
setIncidents(ArcGISFeatureTable, QueryParameters)
to be cleared.- Parameters:
incidents
- the incidents- Throws:
IllegalArgumentException
- if facilities is null- Since:
- 100.1.0
-
setIncidents
Sets the incidents from which the service searches for the nearby locations, 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 incidents 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
ClosestFacilityTask.solveClosestFacilityAsync(ClosestFacilityParameters)
is called.Note: calling this method causes any incidents set by a previous call to
setIncidents(Iterable)
to be cleared.- Parameters:
featureTable
- the feature tablequeryParameters
- the query parameters- Throws:
IllegalArgumentException
- if featureTable or queryParameters is null- Since:
- 100.1.0
-
clearIncidents
public void clearIncidents()Clears any incidents that have been set usingsetIncidents(Iterable)
orsetIncidents(ArcGISFeatureTable, QueryParameters)
.- Since:
- 100.1.0
-
setPointBarriers
Sets the point barriers to avoid in the result closest facility 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- Since:
- 100.1.0
-
setPointBarriers
Sets the point barriers to avoid in the result closest facility 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
ClosestFacilityTask.solveClosestFacilityAsync(ClosestFacilityParameters)
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 tablequeryParameters
- the query parameters- Throws:
IllegalArgumentException
- if featureTable or queryParameters is null- Since:
- 100.1.0
-
clearPointBarriers
public void clearPointBarriers()Clears any point barriers that have been set usingsetPointBarriers(Iterable)
orsetPointBarriers(ArcGISFeatureTable, QueryParameters)
.- Since:
- 100.1.0
-
setPolylineBarriers
Sets the polyline barriers to avoid in the result closest facility 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- Since:
- 100.1.0
-
setPolylineBarriers
Sets the polyline barriers to avoid in the result closest facility 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
ClosestFacilityTask.solveClosestFacilityAsync(ClosestFacilityParameters)
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 tablequeryParameters
- the query parameters- Throws:
IllegalArgumentException
- if featureTable or queryParameters is null- Since:
- 100.1.0
-
clearPolylineBarriers
public void clearPolylineBarriers()Clears any polyline barriers that have been set usingsetPolylineBarriers(Iterable)
orsetPolylineBarriers(ArcGISFeatureTable, QueryParameters)
.- Since:
- 100.1.0
-
setPolygonBarriers
Sets the polygon barriers to avoid in the result closest facility 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- Since:
- 100.1.0
-
setPolygonBarriers
Sets the polygon barriers to avoid in the result closest facility 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
ClosestFacilityTask.solveClosestFacilityAsync(ClosestFacilityParameters)
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 tablequeryParameters
- the query parameters- Throws:
IllegalArgumentException
- if featureTable or queryParameters is null- Since:
- 100.1.0
-
clearPolygonBarriers
public void clearPolygonBarriers()Clears any polygon barriers that have been set usingsetPolygonBarriers(Iterable)
orsetPolygonBarriers(ArcGISFeatureTable, QueryParameters)
.- Since:
- 100.1.0
-