Пример #1
0
        /// <summary>
        /// Gets a route from one location to a set of others taking into account transit data.
        /// </summary>
        /// <returns></returns>
        public override Route[] GetTransitOneToMany(DateTime dt, List <Vehicle> vehicles, GeoCoordinate[] coordinates, HashSet <string> operators, bool complete)
        {
            var targetVehicles = new List <Vehicle>();

            targetVehicles.AddAll(vehicles[1], coordinates.Length - 1);
            var router = new OneToManyProfileSearchRouter(_connectionsDb, new OsmRoutingInterpreter(), dt, vehicles[0],
                                                          coordinates[0], targetVehicles.ToArray(), coordinates.GetRange(1, coordinates.Length - 1), x => x);

            router.Run();
            if (router.HasSucceeded)
            {
                var routes = new Route[coordinates.Length - 1];
                for (int i = 0; i < coordinates.Length - 1; i++)
                {
                    routes[i] = router.BuildRoute(i);
                }
                return(routes);
            }
            return(null);
        }
 /// <summary>
 /// Gets a route from one location to a set of others taking into account transit data.
 /// </summary>
 /// <returns></returns>
 public override Route[] GetTransitOneToMany(DateTime dt, List<Vehicle> vehicles, GeoCoordinate[] coordinates, HashSet<string> operators, bool complete)
 {
     var targetVehicles = new List<Vehicle>();
     targetVehicles.AddAll(vehicles[1], coordinates.Length - 1);
     var router = new OneToManyProfileSearchRouter(_connectionsDb, new OsmRoutingInterpreter(), dt, vehicles[0],
         coordinates[0], targetVehicles.ToArray(), coordinates.GetRange(1, coordinates.Length - 1), x => x);
     router.Run();
     if (router.HasSucceeded)
     {
         var routes = new Route[coordinates.Length - 1];
         for (int i = 0; i < coordinates.Length - 1; i++)
         {
             routes[i] = router.BuildRoute(i);
         }
         return routes;
     }
     return null;
 }