コード例 #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string            id    = id_hangar.Text;
            int               id_h  = Int32.Parse(id);
            MV_Add            ajout = new MV_Add(id);
            List <IImageInfo> liste = ajout.Recherche_avion();
            Main_bin_packing  main  = new Main_bin_packing(liste, id_h);

            //ajout.Add_opti();
        }
コード例 #2
0
        public Optimisation()
        {
            InitializeComponent();

            Main_bin_packing        mainb = new Main_bin_packing();
            List <IMappedImageInfo> mapy  = mainb.Map;
            int i = 0;

            foreach (IMappedImageInfo m in mapy)
            {
                Rectangle rect = new Rectangle(); //create the rectangle
                rect.StrokeThickness = 1;         //border to 1 stroke thick
                InitBrushes();
                rect.Stroke = _brushes[i];        //border color to black
                rect.Fill   = _brushes[i];
                rect.Width  = m.ImageInfo.Width * 10;
                rect.Height = m.ImageInfo.Height * 10;
                rect.Name   = "box" + i.ToString();
                Canvas.SetLeft(rect, m.X * 10);
                Canvas.SetTop(rect, m.Y * 10);
                _rectangles.Add(rect);

                i++;
            }
            // var grid = this.Content as Grid;

            foreach (var rect in _rectangles)
            {
                can.Children.Add(rect);
            }



            foreach (var point in _rectangles_bis)
            {
                can.Children.Add(point);
            }
        }
コード例 #3
0
        public Parking_window()
        {
            InitializeComponent();
            MV_Add                  ajout = new MV_Add("1");
            List <IImageInfo>       list  = ajout.Recherche_avion();
            Main_bin_packing        main  = new Main_bin_packing(list, 1);
            List <IMappedImageInfo> mapy  = main.Map;
            int i = 0;

            foreach (IMappedImageInfo m in mapy)
            {
//rectangle
                Rectangle rect = new Rectangle(); //create the rectangle
                rect.StrokeThickness = 1;         //border to 1 stroke thick
                InitBrushes();
                rect.Stroke = _brushes[i];        //border color to black
                rect.Fill   = _brushes[i];
                rect.Width  = m.ImageInfo.Width * 10;
                rect.Height = m.ImageInfo.Height * 10;
                rect.Name   = "box" + i.ToString();
                Canvas.SetLeft(rect, m.X * 10);
                Canvas.SetTop(rect, m.Y * 10);
                _rectangles.Add(rect);
                //avion
                Image image1 = new Image();
                var   uri    = new Uri("C://Users/sibel/Source/Repos/PICARRE/Pi²/avion.png");
                var   bitmap = new BitmapImage(uri);
                image1.Source = bitmap;
                image1.Height = m.ImageInfo.Height * 10;
                image1.Width  = m.ImageInfo.Width * 10;
                Canvas.SetLeft(image1, m.X * 10);
                Canvas.SetTop(image1, m.Y * 10);
                _image.Add(image1);
                i++;
            }
            // var grid = this.Content as Grid;
            int h = 0;

            foreach (var rect in _rectangles)
            {
                can.Children.Add(rect);
                can.Children.Add(_image[h]);
                h++;
            }


            Main_AStar        mainas = new Main_AStar();
            List <Coordonnee> liste  = mainas.Liste;

            this.width = 80;
            int p = 0;

            foreach (Coordonnee l in liste)
            {
                //   ConsoleManager.Show();
                // Console.WriteLine(l.X);
                //Console.WriteLine(l.Y);
                Rectangle point = new Rectangle(); //create the rectangle
                point.StrokeThickness = 1;         //border to 1 stroke thick
                InitBrushes();
                point.Stroke = _redBrush;          //border color to black
                point.Fill   = _redBrush;
                point.Width  = 1 * 10;
                point.Height = 1 * 10;
                point.Name   = "bo" + p.ToString();
                Canvas.SetLeft(point, 10 * l.X);
                Canvas.SetTop(point, 10 * l.Y);
                _rectangles_bis.Add(point);
                p++;
            }
            // var grid = this.Content as Grid;

            foreach (var point in _rectangles_bis)
            {
                can.Children.Add(point);
            }

            Canvas.SetLeft(start, mainas.Start.X * 10);
            Canvas.SetTop(start, mainas.Start.Y * 10);
            Canvas.SetLeft(stop, mainas.Goal.X * 10);
            Canvas.SetTop(stop, mainas.Goal.Y * 10);
        }