Exemple #1
0
        static void Main(string[] args)
        {
            Location locationA = new Location("A");
            Location locationB = new Location("B");
            Location locationC = new Location("C");
            Location locationD = new Location("D");
            Location locationE = new Location("E");
            Location locationF = new Location("F");
            Location locationG = new Location("G");
            Location locationH = new Location("H");

            RouteEngine engine = new RouteEngine();

            engine.Locations.Add(locationA);
            engine.Locations.Add(locationB);
            engine.Locations.Add(locationC);
            engine.Locations.Add(locationD);
            engine.Locations.Add(locationE);
            engine.Locations.Add(locationF);
            engine.Locations.Add(locationG);
            engine.Locations.Add(locationH);
            engine.Connections.Add(new Connection(locationA, locationB, 5));
            engine.Connections.Add(new Connection(locationA, locationF, 3));
            engine.Connections.Add(new Connection(locationB, locationC, 2));
            engine.Connections.Add(new Connection(locationB, locationG, 3));
            engine.Connections.Add(new Connection(locationC, locationH, 10));
            engine.Connections.Add(new Connection(locationC, locationD, 6));
            engine.Connections.Add(new Connection(locationD, locationE, 3));
            engine.Connections.Add(new Connection(locationE, locationF, 8));
            engine.Connections.Add(new Connection(locationF, locationG, 7));
            engine.Connections.Add(new Connection(locationG, locationH, 2));
            engine.Connections.Add(new Connection(locationH, locationE, 5));

            Console.WriteLine(engine.CalculateMinCost(locationF));
        }
Exemple #2
0
    void Start()
    {
        routeEngineComp = RouteEngine.Instance;

        TimeText.text     = "2:00";
        DistanceText.text = "0";

        TimeValue = 120;
    }
    private void InitializeComponents()
    {
        RouteEngineComp = RouteEngine.Instance;

        SpriteRendererComp = CountNumbersGO.GetComponent <SpriteRenderer>();

        CarControllerGo = CarController.Instance.gameObject;

        carGo = Car.Instance.gameObject;

        Init();
    }
Exemple #4
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
            RouteEngine.RegisterViewEngines(ViewEngines.Engines);

            Application["OnlineUsers"]          = 0;
            MvcHandler.DisableMvcResponseHeader = true;
        }
        public void ComputeRouteTest()
        {
            var t1 = new TransportCenter();

            t1.Name = "DARFUR";
            t1.Id   = 19;
            var t2 = new TransportCenter();

            t2.Name = "ADDIS_ABEBA";
            t2.Id   = 17;
            var test = new RouteEngine();
            var res  = test.ComputeRoute(null, t1, t2);

            Assert.IsNotNull(res);
        }
 public static IRouteEngine Create(SuperscribeOptions options)
 {
     var engine = new RouteEngine(options.StringRouteParser, options.RouteWalkerFactory);
     return engine;
 }
        public static IRouteEngine Create(SuperscribeOptions options)
        {
            var engine = new RouteEngine(options);

            return(engine);
        }
        public void RouteEngineTest()
        {
            var route = new RouteEngine();

            Assert.IsNotNull(route);
        }
Exemple #9
0
        private void BuildRoute_Click(object sender, RoutedEventArgs e)
        {
            if (MapImage.Source == null || routeImages.Count < 2)
            {
                return;
            }

            MainTabControl.Opacity = 0.2;
            Progress.Value         = 0;
            Report.Text            = $"{0}/{routeImages.Count} images processed";
            FileMenuItem.IsEnabled = false;
            BuildRoute.IsEnabled   = false;

            new TaskFactory().StartNew(() =>
            {
                double k = 0;
                foreach (var image in routeImages)
                {
                    results.Add(RouteEngine.Run(new AirPhoto(new Bitmap(map), map), new AirPhoto(new Bitmap(image.FileName), image.FileName)));
                    k++;
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        Progress.Value = (k / routeImages.Count) * 100;
                        Report.Text    = $"{k}/{routeImages.Count} images processed";
                    }));
                }

                Dispatcher.BeginInvoke(new Action(() =>
                {
                    FileMenuItem.IsEnabled = true;
                    BuildRoute.IsEnabled   = true;
                    MainTabControl.Opacity = 1;
                    for (int i = 0; i < results.Count; i++)
                    {
                        var bitmap = results[i].RAWmatchestoBitmap();
                        var image  = new System.Windows.Controls.Image
                        {
                            Source = SourceBitmapConverter.ImageSourceFromBitmap(bitmap)
                        };
                        var tab = new TabItem
                        {
                            Header  = Path.GetFileNameWithoutExtension(results[i].SingleImage.FileName),
                            Content = image
                        };
                        ResultsTabControl.Items.Add(tab);

                        results[i]    = RouteEngine.FilterPoints(results[i]);
                        results[i].Id = i + 1;
                        routeImages.ElementAt(i).ImageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(results[i].SingleImage.AfterClusterizationtoBitmap());
                    }
                    if (DrawingSettings.DrawKeyPoints)
                    {
                        MapImage.Source = SourceBitmapConverter.ImageSourceFromBitmap(RouteEngine.DrawKPAtMap(SourceBitmapConverter.BitmapFromSource(MapImage.Source), results));
                    }
                    if (DrawingSettings.DrawBounds)
                    {
                        MapImage.Source = SourceBitmapConverter.ImageSourceFromBitmap(RouteEngine.DrawBounds(SourceBitmapConverter.BitmapFromSource(MapImage.Source), results));
                    }
                    if (DrawingSettings.DrawRoute)
                    {
                        MapImage.Source = SourceBitmapConverter.ImageSourceFromBitmap(RouteEngine.BuildRoute(SourceBitmapConverter.BitmapFromSource(MapImage.Source), results));
                    }
                }));
            });
        }
 public static IRouteEngine Create(SuperscribeOptions options)
 {
     var engine = new RouteEngine(options);
     return engine;
 }