Esempio n. 1
0
 private void button8_Click(object sender, EventArgs e)
 {
     other.Add(current);
     current = null;
     OnOffMoving(false);
     button8.Enabled = false;
 }
Esempio n. 2
0
        public void LoadDetail()
        {
            ConsoleApp.Logic.Point[] points = DBConnector.GetList <DetailModel>().Where(
                det => det.DetailNumber == int.Parse((string)comboBox2.SelectedItem) && det.Articul == (string)comboBox1.SelectedItem
                ).Select(det => new ConsoleApp.Logic.Point(det.X, det.Y)).ToArray();

            current = new ConsoleApp.Logic.Detail(points.Skip(1).ToArray(), size, points.First());
        }
Esempio n. 3
0
        private void Kek(List <ConsoleApp.Logic.Detail> details)
        {
            var allcombi = allcombinations(Enumerable.Range(0, details.Count()).ToList(), new List <int>()).ToList();
            List <ConsoleApp.Logic.Detail> details_on_plan = new List <ConsoleApp.Logic.Detail>();
            List <ConsoleApp.Logic.Detail> best            = new List <ConsoleApp.Logic.Detail>();
            int optimal_treashold = 1000;

            for (int i = 0; i < allcombi.Count(); i++)
            {
                for (int j = 0; j < allcombi[i].Count; j++)
                {
                    int index = allcombi[i][j];
                    other   = details_on_plan;
                    current = details[index];

                    TryInsertFigure(
                        new Range()
                    {
                        min = 0, max = 1000, step = step
                    },
                        new Range()
                    {
                        min = 0, max = borderX, step = step
                    },
                        new Range()
                    {
                        min = 0, max = 360, step = 90
                    }
                        );

                    details_on_plan.Add(details[index]);
                }
                current = null;

                int new_threashold = details_on_plan.Select(det => det.GetTranslatedPoints().Max(p => p.Y)).Max(x => x);

                if (optimal_treashold > new_threashold)
                {
                    //best = details_on_plan.Select(det => (ConsoleApp.Logic.Detail)det.Clone()).ToList();
                    optimal_treashold = new_threashold;
                    panel1.Invalidate();
                    Thread.Sleep(1000);
                }

                details_on_plan = new List <ConsoleApp.Logic.Detail>();
            }

            MessageBox.Show("подбор окончен");
        }
Esempio n. 4
0
        private void button11_Click(object sender, EventArgs e)
        {
            try { CheckDetailSelectors(); }
            catch (Exception ex)
            {
                errorLabal.Text = ex.Message;
                return;
            }
            LoadDetail();
            bool isSuccess = TryInsertFigure(
                new Range()
            {
                min = 0, max = 1000, step = step
            },
                new Range()
            {
                min = 0, max = borderX, step = step
            },
                new Range()
            {
                min = 0, max = 360, step = 90
            }
                );

            if (!isSuccess)
            {
                current = null;
                MessageBox.Show("не получилось вставить");
                return;
            }
            TryInsertFigure(
                new Range()
            {
                min = current.position.Y - step, max = current.position.Y + 1, step = 1
            },
                new Range()
            {
                min = current.position.X - step, max = current.position.X + 1, step = 1
            },
                new Range()
            {
                min = 0, max = 360, step = 90
            }
                );
            panel1.Invalidate();
            OnOffMoving(true);
            button8.Enabled = true;
        }
Esempio n. 5
0
 private void button10_Click(object sender, EventArgs e)
 {
     other   = new List <ConsoleApp.Logic.Detail>();
     current = null;
     panel1.Invalidate();
 }