コード例 #1
0
ファイル: HomeController.cs プロジェクト: takraj/menetrend
        public ActionResult TestMap(string stopFrom = "", string stopTo = "")
        {
            var rnd      = new Random();
            var src      = rnd.Next(100, 5000);
            var dst      = rnd.Next(100, 5000);
            var allStops = DbDataManager.GetAllStops();

            if (stopFrom != "" && stopTo != "")
            {
                try
                {
                    src             = allStops.First(s => s.StopName == stopFrom).StopId;
                    dst             = allStops.First(s => s.StopName == stopTo).StopId;
                    ViewBag.Message = "";
                }
                catch
                {
                    ViewBag.Message = "Random útvonal";
                }
            }

            var now = DateTime.Now.TimeOfDay;
            var instructionsToShow = PathfinderManager.GetRoute(src, dst, new DateTime(2013, 03, 01, now.Hours, now.Minutes, now.Seconds));

            //var instructionsToShow = PathfinderManager.GetRoute(src, dst, new DateTime(2013, 03, 01, 16, 21, now.Seconds));
            //var instructionsToShow = PathfinderManager.GetRoute(src, dst, DateTime.Now);
            ViewBag.StopNames = allStops.Select(s => s.StopName).Distinct().ToArray();

            Utility.SetupCulture();
            return(View(instructionsToShow));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: takraj/menetrend
        public ActionResult StopGroups()
        {
            var allStops   = DbDataManager.GetAllStops();
            var stopGroups = DbDataManager.GetStopGroups(50);

            ViewBag.Message = "Stop Groups teszt: " + stopGroups.Count + " / " + allStops.Count;
            return(View(stopGroups));
        }
コード例 #3
0
        static void FindStopGroups()
        {
            Console.Write("Finding Groups...");
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var allStops   = DbDataManager.GetAllStops();
            var stopGroups = DbDataManager.GetStopGroups(100);

            stopwatch.Stop();

            Console.WriteLine("\t" + stopGroups.Count + " / " + allStops.Count + "\t" + (stopwatch.ElapsedMilliseconds / 1000.0) + "s");
        }