示例#1
0
 static void routing()
 {
     RoutingService.InitService(@"C:\Users\seetam\Documents\Visual Studio 2017\Projects\Orion\Orion\bin\Debug\netcoreapp2.1\itinero.routerdb");
     RoutingService.Service.BatchRouting();
     RoutingService.Service.bench();
     TripFunctions func = new TripFunctions();
     //func.GetByDayOfWeek(DayOfWeek.Sunday, new DateTime(2015, 1, 1), new DateTime(2016, 1, 1));
 }
示例#2
0
        public static void RunCommand(EnumCommands iCommand)
        {
            if (Commands.ContainsKey(iCommand))
            {
                switch (iCommand)
                {
                case EnumCommands.ComputeLattice:
                    printLn(">>Compute Lattice");
                    lattice = ComputeLattice();
                    break;

                case EnumCommands.GetRoute:
                    printLn(">>Get Route");
                    printLn(">>Source Location (lat, long):");
                    double[] source = ParseLocation(Console.ReadLine());

                    printLn(">>Destination Location (lat, long):");
                    double[] destination = ParseLocation(Console.ReadLine());

                    string result = RoutingService.Service.GetRoute(source, destination);
                    string path   = Path.Combine(saveFile, "route.geojson");
                    File.WriteAllText(path, result);
                    printLn("Route saved to : " + path);
                    break;

                case EnumCommands.GetTrips:
                    if (lattice == null)
                    {
                        RunCommand(EnumCommands.ComputeLattice);
                    }

                    printLn(">>Get Trips");
                    trips = GetTrips(lattice);
                    break;

                case EnumCommands.ComputeProbDist:
                    if (trips.Count == 0)
                    {
                        RunCommand(EnumCommands.GetTrips);
                    }
                    if (trips.Count > 0)
                    {
                        printLn(">>Save distribution results As:");
                        string file = Console.ReadLine();
                        printLn(">>Compute Probability Distribution");
                        TripStats.DistributionOfRequests(trips, file);
                    }
                    else
                    {
                        printLn("No trips available. Please check parameters.");
                    }
                    break;

                case EnumCommands.SaveAsBinary:
                    printLn(">>Enter File Name:");
                    string binfile = Console.ReadLine();
                    printLn(">Saving Trip Data<");
                    //TODO
                    //ToBinary.CsvToBinary(trips, Path.Combine(saveFile, binfile + ".dat"));
                    printLn(string.Format("{0} Trips Saved", trips.Count));
                    break;

                case EnumCommands.SaveAsCSV:
                    printLn(">>Enter File Name:");
                    string csvfile = Console.ReadLine();
                    printLn(">Saving Raw Trip Data<");
                    TripFunctions.Save(tripsDB, Path.Combine(saveFile, csvfile + ".csv"));
                    printLn(string.Format("{0} Trips Saved", tripsDB.Count));
                    break;

                default:
                    break;
                }
            }
        }