示例#1
0
        public async Task <ActionResult <List <RoutingSegmentResult> > > GetOptimalRoute(NavigationRequestParam navigationParams)
        {
            Console.WriteLine("Finding your optimal path!");
            var routeGraph =
                await _routeSegmentationService.GetGraph(navigationParams.StartPoint, navigationParams.EndPoint);

            var weightedGraph = await GenerateCosts(routeGraph, navigationParams.Optimizer);

            var optimalRoute = _pathFindingService.GetOptimalPath(navigationParams.StartPoint, navigationParams.EndPoint, weightedGraph);

            return(optimalRoute.Select(segment => _internalCache.GetByKey(segment)).ToList());

            // TODO: return optimalRoute
            // TODO: Remove below test debug return
            Console.WriteLine(optimalRoute);
            Console.WriteLine(navigationParams.ToString());
            var testResponse = new List <RoutingSegmentResult>
            {
                new RoutingSegmentResult(
                    Models.NavigationMode.Walk.ToString(),
                    new List <NavigationPoint>()
                {
                    new NavigationPoint(0, 0), new NavigationPoint(10, 0)
                },
                    0
                    )
            };

            return(testResponse);
        }
示例#2
0
 public Task <ActionResult <List <RoutingSegmentResult> > > Post(NavigationRequestParam requestParam)
 {
     return(_navigationRoutingService.GetOptimalRoute(requestParam));
 }