Пример #1
0
        public static void Main(string[] args)
        {
            // enable logging.
            OsmSharp.Logging.Logger.LogAction = (o, level, message, parameters) =>
            {
                Console.WriteLine(string.Format("[{0}] {1} - {2}", o, level, message));
            };
            Itinero.Logging.Logger.LogAction = (o, level, message, parameters) =>
            {
                Console.WriteLine(string.Format("[{0}] {1} - {2}", o, level, message));
            };
            _logger = new Logger("Default");

            Itinero.Osm.Vehicles.Vehicle.RegisterVehicles();

#if DEBUG
            _logger.Log(TraceEventType.Information, "Performance tests are running in Debug, please run in Release mode.");
#endif
            // download and extract test-data if not already there.
            _logger.Log(TraceEventType.Information, "Downloading Luxembourg...");
            Download.DownloadLuxembourgAll();

            // test building a routerdb.
            var routerDb = RouterDbBuildingTests.Run();
            var router   = new Router(routerDb);

            var route = router.Calculate(Osm.Vehicles.Vehicle.Car.Fastest(),
                                         router.Resolve(Osm.Vehicles.Vehicle.Car.Fastest(), 49.501803f, 6.066170f),
                                         router.Resolve(Osm.Vehicles.Vehicle.Car.Fastest(), 49.557734f, 5.884209f));

            // test resolving.
            ResolvingTests.Run(routerDb);

            // test routing.
            RoutingTests.Run(routerDb);
            RoutingTests.RunFictional();

            // tests calculate weight matrices.
            WeightMatrixTests.Run(routerDb);

            // test instruction generation.
            InstructionTests.Run(routerDb);

            _logger.Log(TraceEventType.Information, "Testing finished.");
#if DEBUG
            Console.ReadLine();
#endif
        }
Пример #2
0
        public static void Main(string[] args)
        {
            // enable logging.
            EnableLogging();
            _logger = new Logger("Default");

            Itinero.Osm.Vehicles.Vehicle.RegisterVehicles();
#if DEBUG
            _logger.Log(TraceEventType.Information, "Performance tests are running in Debug, please run in Release mode.");
#endif
            // download and extract test-data if not already there.
            _logger.Log(TraceEventType.Information, "Downloading Luxembourg...");
            Download.DownloadLuxembourgAll();

            // test building a routerdb.
            _logger.Log(TraceEventType.Information, "Starting tests...");
            var routerDb = RouterDbBuildingTests.Run();
            var router   = new Router(routerDb);

            // test some routerdb extensions.
            RouterDbExtensionsTests.Run(routerDb);

            // test writing shapefile.
            ShapeFileWriterTests.Run(routerDb);

            // test resolving.
            ResolvingTests.Run(routerDb);

            // test routing.
            RoutingTests.Run(routerDb);

            // tests calculate weight matrices.
            WeightMatrixTests.Run(routerDb);

            // test instruction generation.
            InstructionTests.Run(routerDb);

            _logger.Log(TraceEventType.Information, "Testing finished.");
#if DEBUG
            Console.ReadLine();
#endif
        }