private function routeOrders():void{ [LEFT] stops = new FeatureSet([]); var start:Graphic = new Graphic(WebMercatorUtil.geographicToWebMercator(new MapPoint(Model.instance.activeVehicle.attributes.StartX,Model.instance.activeVehicle.attributes.StartY, Model.instance.map.spatialReference)), new TextSymbol('Start',null,0x000000,false,0,true,0xFFFFFF,TextSymbol.PLACEMENT_START,0,20,20)); start.attributes = {Name: "Start"}; stops.features.push(start); foreach(var order:Graphic in Model.instance.oLayer.graphicProvider){ var g1:Graphic = new Graphic(MapPoint(order.geometry)); g1.attributes = {Name: order.attributes.OrderNum}; stops.features.push(g1); } Model.instance.oLayer.add(start); var end:Graphic = new Graphic(WebMercatorUtil.geographicToWebMercator(new MapPoint(Model.instance.activeVehicle.attributes.EndX,Model.instance.activeVehicle.attributes.EndY, Model.instance.map.spatialReference)), new TextSymbol('End',null,0x000000,false,0,true,0xFFFFFF,TextSymbol.PLACEMENT_END,0,-20,20)); end.attributes = {Name: "End"}; Model.instance.oLayer.add(end); stops.features.push(end); if (stops.features.length > 1){ routeTask.solve(routeParams); } }[/LEFT]
[Bindable] private var stops:FeatureSet = new FeatureSet([]); private function routeOrders():void{ stops = new FeatureSet([]); var start:Graphic = new Graphic(WebMercatorUtil.geographicToWebMercator(new MapPoint(Model.instance.activeVehicle.attributes.StartX,Model.instance.activeVehicle.attributes.StartY, Model.instance.map.spatialReference)), new TextSymbol('Start',null,0x000000,false,0,true,0xFFFFFF,'middle',0,20,20)); Model.instance.oLayer.add(start); stops.features.push(start); for each(var order:Graphic in Model.instance.oLayer.graphicProvider){ var g1:Graphic = new Graphic(MapPoint(order.geometry)); stops.features.push(g1); } var end:Graphic = new Graphic(WebMercatorUtil.geographicToWebMercator(new MapPoint(Model.instance.activeVehicle.attributes.EndX,Model.instance.activeVehicle.attributes.EndY, Model.instance.map.spatialReference)), new TextSymbol('End',null,0x000000,false,0,true,0xFFFFFF,'middle',0,20,20)); Model.instance.oLayer.add(end); stops.features.push(end); if (stops.features.length > 1){ routeTask.solve(routeParams); } } <esri:RouteTask id="routeTask" concurrency="last" fault="faultHandler(event)" requestTimeout="30" showBusyCursor="true" solveComplete="solveCompleteHandler(event)" url="http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"/> <esri:RouteParameters id="routeParams" stops="{stops}" outSpatialReference="{Model.instance.map.spatialReference}" findBestSequence="true" returnStops="true" preserveFirstStop="true" preserveLastStop="true"/>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.