| Package | com.esri.aws.services |
| Interface | public interface IRouteFinder |
See also
| Method | Defined by | ||
|---|---|---|---|
|
findRoute(routeStops:Array, routeFinderOptions:RouteFinderOptions, responder:IResponder):void
Returns route information for a given set of route stops and routing parameters.
| IRouteFinder | ||
|
getLanguages(responder:IResponder):void
Returns the supported languages for the driving directions.
| IRouteFinder | ||
| findRoute | () | method |
public function findRoute(routeStops:Array, routeFinderOptions:RouteFinderOptions, responder:IResponder):voidReturns route information for a given set of route stops and routing parameters.
ParametersrouteStops:Array — Contains the stops along a route.
|
|
routeFinderOptions:RouteFinderOptions — Contains parameters for using Route Finder Web Service.
|
|
responder:IResponder — The responder to call on result or fault. Result will be passed a RouteInfo instance.
|
See also
| getLanguages | () | method |
public function getLanguages(responder:IResponder):voidReturns the supported languages for the driving directions.
Parametersresponder:IResponder — The responder to call on result or fault. Result will be passed a ArrayCollection instance.
|
See also
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:awx="http://www.arcwebservices.com/2007/awx"
implements="mx.rpc.IResponder"
creationComplete="onComplete()"
>
<mx:Script>
<![CDATA[
import com.esri.aws.awx.geom.GeoPoint;
import com.esri.aws.osgi.framework.ServiceTracker;
import com.esri.aws.services.SegmentDesc;
import com.esri.aws.services.RouteInfo;
import com.esri.aws.services.RouteFinderOptions;
import com.esri.aws.services.RouteStop;
import com.esri.aws.services.IRouteFinder;
import com.esri.aws.osgi.framework.IServiceReference;
import flash.utils.getQualifiedClassName;
import mx.controls.Alert;
private var routeTracker:ServiceTracker;
private function onComplete():void
{
routeTracker = new ServiceTracker(framework.systemContext, getQualifiedClassName(IRouteFinder));
routeTracker.open();
}
public function getRoute():void
{
var routeService:IRouteFinder = routeTracker.getService() as IRouteFinder;
if (routeService)
{
// build stops
var routeStops:Array = new Array(2);
var start:RouteStop = new RouteStop();
start.desc = "Start";
start.point = new GeoPoint(-71.05274248, 42.36704409);
routeStops[0] = start;
var end:RouteStop = new RouteStop();
end.desc = "End";
end.point = new GeoPoint(-71.071, 42.384);
routeStops[1] = end;
// build options
var routeFinderOptions:RouteFinderOptions = new RouteFinderOptions();
routeFinderOptions.returnDirections = true;
// call the RouteFinder service using 'this' as the responder.
routeService.findRoute(routeStops, routeFinderOptions, this);
info.htmlText = "Sending request ...";
}
}
public function result(data:Object):void
{
var routeInfo:RouteInfo = RouteInfo(data);
info.htmlText = "<i>Summary</i><br/>";
info.htmlText += routeInfo.totalDesc.totalTime + "<br/>";
info.htmlText += routeInfo.totalDesc.totalDistance + "<br/>";
info.htmlText += "<br/><i>" + routeInfo.segmentDescs.length + " segments</i><br/>";
for each (var segment:SegmentDesc in routeInfo.segmentDescs)
{
info.htmlText += segment.descriptiveDirections + "<br/>";
}
}
public function fault(info:Object):void
{
Alert.show(info.toString());
}
]]>
</mx:Script>
<awx:Framework id="framework" apiKey="[MY-API-KEY]" frameworkStart="getRoute()">
<awx:RouteFinderActivator/>
</awx:Framework>
<mx:Text id="info" fontSize="14" top="80"/>
</mx:Application>