Exemple #1
0
 /// <summary>
 /// отрисовать все три центра
 /// отрисовать радиусы для scan0 и scan1
 /// </summary>
 /// <param name="preciseMapBmp"></param>
 /// <param name="graphics"></param>
 private void interfaceDrawing(Bitmap preciseMapBmp, Graphics graphics)
 {
     try
     {
         Pen pen;
         int X0 = crosslinker.getXY0()[0];
         int Y0 = crosslinker.getXY0()[1];
         int X1 = crosslinker.getXY1()[0];
         int Y1 = crosslinker.getXY1()[1];
         int X2 = crosslinker.getXY2()[0];
         int Y2 = crosslinker.getXY2()[1];
         if ((X0 >= 0) && (Y0 >= 0))
         {
             preciseMapBmp.SetPixel(X0, Y0, Parameters.startColor);
             pen = new Pen(Parameters.startColor);
             graphics.DrawEllipse(pen, X0 - Parameters.getR_scan(), Y0 - Parameters.getR_scan(), Parameters.getD_scan(), Parameters.getD_scan());
             graphics.DrawEllipse(pen, X0 - Parameters.getR_robot(), Y0 - Parameters.getR_robot(), Parameters.getD_robot(), Parameters.getD_robot());
         }
         if ((X1 >= 0) && (Y1 >= 0))
         {
             preciseMapBmp.SetPixel(X1, Y1, Parameters.finishColor);
             pen = new Pen(Parameters.finishColor);
             graphics.DrawEllipse(pen, X1 - Parameters.getR_scan(), Y1 - Parameters.getR_scan(), Parameters.getD_scan(), Parameters.getD_scan());
             graphics.DrawEllipse(pen, X1 - Parameters.getR_robot(), Y1 - Parameters.getR_robot(), Parameters.getD_robot(), Parameters.getD_robot());
         }
         if ((X2 >= 0) && (Y2 >= 0))
         {
             preciseMapBmp.SetPixel(X2, Y2, Parameters.routeColor);
         }
     }
     catch (Exception ex) { }
     mouseMoveMap = new PixelMap(preciseMapBmp);
     mainForm.drawBitmapOnPictureBox1(preciseMapBmp);
 }
Exemple #2
0
        /// <summary>
        /// Рисует сшитые сканы на одном холсте.
        /// </summary>
        /// <param name="X1_rl"></param>
        /// <param name="Y1_rl"></param>
        private void drawCrosslinkedScans(int X1_rl, int Y1_rl)
        {
            int X0 = crosslinker.getXY0()[0];
            int Y0 = crosslinker.getXY0()[1];
            //
            //    int X2 = crosslinker.getXY2()[0];
            //    int Y2 = crosslinker.getXY2()[1];
            //
            PixelMap scan01 = new PixelMap(Parameters.getD_scan1() + Parameters.getR_scan(), Parameters.getD_scan1() + Parameters.getR_scan(), 0, 0, 0);
            int      C      = (Parameters.getD_scan() + Parameters.getR_scan()) / 2;

            for (int i = 0; i < crosslinker.scan0.xyScan.Count; i++)
            {
                scan01[crosslinker.scan0.xyScan[i][0] + C, crosslinker.scan0.xyScan[i][1] + C] = new Pixel(Parameters.startColor);
            }
            for (int i = 0; i < crosslinker.scan1.xyScan.Count; i++)
            {
                scan01[crosslinker.scan1.xyScan[i][0] + X1_rl - X0 + C, crosslinker.scan1.xyScan[i][1] + Y1_rl - Y0 + C] = new Pixel(Parameters.finishColor);
            }
            MainForm.drawBitmapOnPictureBox(pictureBox4, scan01.GetBitmap());
        }
 /// <summary>
 /// Требуемый метод для поддержки конструктора — не изменяйте
 /// содержимое этого метода с помощью редактора кода.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
     this.panel1 = new System.Windows.Forms.Panel();
     this.panel3 = new System.Windows.Forms.Panel();
     this.label8 = new System.Windows.Forms.Label();
     this.numericUpDown4sgm_psi    = new System.Windows.Forms.NumericUpDown();
     this.numericUpDown5scan_noise = new System.Windows.Forms.NumericUpDown();
     this.numericUpDown6n_phi      = new System.Windows.Forms.NumericUpDown();
     this.numericUpDown3sgm_lmax   = new System.Windows.Forms.NumericUpDown();
     this.numericUpDown2r_robot    = new System.Windows.Forms.NumericUpDown();
     this.numericUpDown1r_scan     = new System.Windows.Forms.NumericUpDown();
     this.label7       = new System.Windows.Forms.Label();
     this.label6       = new System.Windows.Forms.Label();
     this.label5       = new System.Windows.Forms.Label();
     this.label4       = new System.Windows.Forms.Label();
     this.label3       = new System.Windows.Forms.Label();
     this.label2       = new System.Windows.Forms.Label();
     this.button2      = new System.Windows.Forms.Button();
     this.label1       = new System.Windows.Forms.Label();
     this.pictureBox1  = new System.Windows.Forms.PictureBox();
     this.button1      = new System.Windows.Forms.Button();
     this.radioButton3 = new System.Windows.Forms.RadioButton();
     this.radioButton2 = new System.Windows.Forms.RadioButton();
     this.radioButton1 = new System.Windows.Forms.RadioButton();
     this.panel2       = new System.Windows.Forms.Panel();
     this.panel1.SuspendLayout();
     this.panel3.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4sgm_psi)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5scan_noise)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6n_phi)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3sgm_lmax)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2r_robot)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1r_scan)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
     this.SuspendLayout();
     //
     // panel1
     //
     this.panel1.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
     this.panel1.Controls.Add(this.panel3);
     this.panel1.Controls.Add(this.label1);
     this.panel1.Controls.Add(this.pictureBox1);
     this.panel1.Controls.Add(this.button1);
     this.panel1.Controls.Add(this.radioButton3);
     this.panel1.Controls.Add(this.radioButton2);
     this.panel1.Controls.Add(this.radioButton1);
     resources.ApplyResources(this.panel1, "panel1");
     this.panel1.Name = "panel1";
     //
     // panel3
     //
     this.panel3.BackColor = System.Drawing.SystemColors.ScrollBar;
     this.panel3.Controls.Add(this.label8);
     this.panel3.Controls.Add(this.numericUpDown4sgm_psi);
     this.panel3.Controls.Add(this.numericUpDown5scan_noise);
     this.panel3.Controls.Add(this.numericUpDown6n_phi);
     this.panel3.Controls.Add(this.numericUpDown3sgm_lmax);
     this.panel3.Controls.Add(this.numericUpDown2r_robot);
     this.panel3.Controls.Add(this.numericUpDown1r_scan);
     this.panel3.Controls.Add(this.label7);
     this.panel3.Controls.Add(this.label6);
     this.panel3.Controls.Add(this.label5);
     this.panel3.Controls.Add(this.label4);
     this.panel3.Controls.Add(this.label3);
     this.panel3.Controls.Add(this.label2);
     this.panel3.Controls.Add(this.button2);
     resources.ApplyResources(this.panel3, "panel3");
     this.panel3.Name = "panel3";
     //
     // label8
     //
     resources.ApplyResources(this.label8, "label8");
     this.label8.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.label8.Name      = "label8";
     //
     // numericUpDown6n_phi
     //
     resources.ApplyResources(this.numericUpDown6n_phi, "numericUpDown6n_phi");
     this.numericUpDown6n_phi.Name    = "numericUpDown6n_phi";
     this.numericUpDown6n_phi.Maximum = 500;
     this.numericUpDown6n_phi.Minimum = 10;
     this.numericUpDown6n_phi.Value   = Parameters.getN_phi();
     //
     // numericUpDown2r_robot
     //
     resources.ApplyResources(this.numericUpDown2r_robot, "numericUpDown2r_robot");
     this.numericUpDown2r_robot.Name    = "numericUpDown2r_robot";
     this.numericUpDown2r_robot.Maximum = 100;
     this.numericUpDown2r_robot.Minimum = 0;
     this.numericUpDown2r_robot.Value   = Parameters.getR_robot();
     //
     // numericUpDown1r_scan
     //
     resources.ApplyResources(this.numericUpDown1r_scan, "numericUpDown1r_scan");
     this.numericUpDown1r_scan.Name    = "numericUpDown1r_scan";
     this.numericUpDown1r_scan.Maximum = 300;
     this.numericUpDown1r_scan.Minimum = 0;
     this.numericUpDown1r_scan.Value   = Parameters.getR_scan();
     //
     // numericUpDown4sgm_psi
     //
     resources.ApplyResources(this.numericUpDown4sgm_psi, "numericUpDown4sgm_psi");
     this.numericUpDown4sgm_psi.Name    = "numericUpDown4sgm_psi";
     this.numericUpDown4sgm_psi.Maximum = 300;
     this.numericUpDown4sgm_psi.Minimum = 0;
     this.numericUpDown4sgm_psi.Value   = Parameters.getSgm_psi_deg();
     //
     // numericUpDown5scan_noise
     //
     resources.ApplyResources(this.numericUpDown5scan_noise, "numericUpDown5scan_noise");
     this.numericUpDown5scan_noise.Name    = "numericUpDown5scan_noise";
     this.numericUpDown5scan_noise.Maximum = 3;
     this.numericUpDown5scan_noise.Minimum = 0;
     this.numericUpDown5scan_noise.Value   = Environment.getR_scanNoiseMode();
     //
     // numericUpDown3sgm_lmax
     //
     resources.ApplyResources(this.numericUpDown3sgm_lmax, "numericUpDown3sgm_lmax");
     this.numericUpDown3sgm_lmax.Name    = "numericUpDown3sgm_lmax";
     this.numericUpDown3sgm_lmax.Maximum = 50;
     this.numericUpDown3sgm_lmax.Minimum = 0;
     this.numericUpDown3sgm_lmax.Value   = Parameters.getSgm_lmax();
     //
     // label7
     //
     resources.ApplyResources(this.label7, "label7");
     this.label7.Name = "label7";
     //
     // label6
     //
     resources.ApplyResources(this.label6, "label6");
     this.label6.Name = "label6";
     //
     // label5
     //
     resources.ApplyResources(this.label5, "label5");
     this.label5.Name = "label5";
     //
     // label4
     //
     resources.ApplyResources(this.label4, "label4");
     this.label4.Name = "label4";
     //
     // label3
     //
     resources.ApplyResources(this.label3, "label3");
     this.label3.Name = "label3";
     //
     // label2
     //
     resources.ApplyResources(this.label2, "label2");
     this.label2.Name = "label2";
     //
     // button2
     //
     resources.ApplyResources(this.button2, "button2");
     this.button2.Name = "button2";
     this.button2.UseVisualStyleBackColor = true;
     this.button2.Click += new System.EventHandler(this.button2_Click);
     //
     // label1
     //
     resources.ApplyResources(this.label1, "label1");
     this.label1.Name = "label1";
     //
     // pictureBox1
     //
     this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlDark;
     resources.ApplyResources(this.pictureBox1, "pictureBox1");
     this.pictureBox1.Name    = "pictureBox1";
     this.pictureBox1.TabStop = false;
     //
     // button1
     //
     resources.ApplyResources(this.button1, "button1");
     this.button1.BackColor = System.Drawing.SystemColors.ControlLight;
     this.button1.Name      = "button1";
     this.button1.UseVisualStyleBackColor = false;
     //
     // radioButton3
     //
     resources.ApplyResources(this.radioButton3, "radioButton3");
     this.radioButton3.Name    = "radioButton3";
     this.radioButton3.TabStop = true;
     this.radioButton3.UseVisualStyleBackColor = true;
     radioButton3.CheckedChanged += radioButton3_CheckedChanged;
     //
     // radioButton2
     //
     resources.ApplyResources(this.radioButton2, "radioButton2");
     this.radioButton2.Name    = "radioButton2";
     this.radioButton2.TabStop = true;
     this.radioButton2.UseVisualStyleBackColor = true;
     radioButton2.CheckedChanged += radioButton2_CheckedChanged;
     //
     // radioButton1
     //
     resources.ApplyResources(this.radioButton1, "radioButton1");
     this.radioButton1.Name    = "radioButton1";
     this.radioButton1.TabStop = true;
     this.radioButton1.UseVisualStyleBackColor = true;
     radioButton1.Checked         = true;
     radioButton1.CheckedChanged += radioButton1_CheckedChanged;
     //
     // panel2
     //
     resources.ApplyResources(this.panel2, "panel2");
     this.panel2.Name = "panel2";
     //
     // MainForm
     //
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
     this.BackColor     = System.Drawing.SystemColors.ActiveCaption;
     resources.ApplyResources(this, "$this");
     this.Controls.Add(this.panel1);
     this.Controls.Add(this.panel2);
     this.Name        = "MainForm";
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
     this.panel1.ResumeLayout(false);
     this.panel1.PerformLayout();
     this.panel3.ResumeLayout(false);
     this.panel3.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4sgm_psi)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5scan_noise)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6n_phi)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3sgm_lmax)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2r_robot)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1r_scan)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
     this.ResumeLayout(false);
 }
Exemple #4
0
 public void initialize()
 {
     this.pictureBox2                = new System.Windows.Forms.PictureBox();
     this.pictureBox3                = new System.Windows.Forms.PictureBox();
     this.pictureBox4                = new System.Windows.Forms.PictureBox();
     this.button2Scan0Center         = new System.Windows.Forms.Button();
     this.button3Scan1Center         = new System.Windows.Forms.Button();
     this.button4SupposedScan1Center = new System.Windows.Forms.Button();
     this.label4                      = new System.Windows.Forms.Label();
     this.labelError                  = new System.Windows.Forms.Label();
     this.textBox1Scan0Center         = new System.Windows.Forms.TextBox();
     this.textBox2Scan1Center         = new System.Windows.Forms.TextBox();
     this.textBox3SupposedScan1Center = new System.Windows.Forms.TextBox();
     this.button1Crosslink            = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
     mainForm.panel1SuspendLayout();
     mainForm.setPictureBox1MouseDownHandler(new MouseEventHandler(pictureBox1_MouseDown));
     mainForm.setPictureBox1MouseMoveHandler(new MouseEventHandler(pictureBox1_MouseMove));
     //
     // pictureBox2
     //
     this.pictureBox2.BackColor = System.Drawing.SystemColors.ControlDark;
     this.pictureBox2.Location  = new System.Drawing.Point(0, 32);
     this.pictureBox2.Name      = "pictureBox2";
     this.pictureBox2.Size      = new System.Drawing.Size(Parameters.getD_scan() + 1, Parameters.getD_scan() + 1);
     this.pictureBox2.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
     this.pictureBox2.TabIndex  = 11;
     this.pictureBox2.TabStop   = false;
     //
     // pictureBox3
     //
     this.pictureBox3.BackColor = System.Drawing.SystemColors.ControlDark;
     this.pictureBox3.Location  = new System.Drawing.Point(0, Parameters.getD_scan() + 52 + 10);
     this.pictureBox3.Name      = "pictureBox3";
     this.pictureBox3.Size      = new System.Drawing.Size(Parameters.getD_scan() + 1, Parameters.getD_scan() + 1);
     this.pictureBox3.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
     this.pictureBox3.TabIndex  = 12;
     this.pictureBox3.TabStop   = false;
     //
     // pictureBox4
     //
     this.pictureBox4.BackColor = System.Drawing.SystemColors.ControlDark;
     this.pictureBox4.Location  = new System.Drawing.Point(Parameters.getD_scan() + 1 + 5, 32);
     this.pictureBox4.Name      = "pictureBox4";
     this.pictureBox4.Size      = new System.Drawing.Size(Parameters.getD_scan() + Parameters.getR_scan() + 1, Parameters.getD_scan() + Parameters.getR_scan() + 1);
     this.pictureBox4.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
     this.pictureBox4.TabIndex  = 13;
     this.pictureBox4.TabStop   = false;
     //
     // button2Scan0Center
     //
     this.button2Scan0Center.AutoSize  = true;
     this.button2Scan0Center.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.button2Scan0Center.Location  = new System.Drawing.Point(0, 6);
     this.button2Scan0Center.Name      = "button2";
     this.button2Scan0Center.Size      = new System.Drawing.Size(41, 13);
     this.button2Scan0Center.TabIndex  = 15;
     this.button2Scan0Center.Text      = "Scan 0";
     button2Scan0Center.MouseClick    += button2Scan0Center_Click;
     //
     // button3Scan1Center
     //
     this.button3Scan1Center.AutoSize  = true;
     this.button3Scan1Center.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.button3Scan1Center.Location  = new System.Drawing.Point(0, Parameters.getD_scan() + 36);
     this.button3Scan1Center.Name      = "button3";
     this.button3Scan1Center.Size      = new System.Drawing.Size(41, 13);
     this.button3Scan1Center.TabIndex  = 16;
     this.button3Scan1Center.Text      = "Scan 1";
     button3Scan1Center.MouseClick    += button3Scan1Center_Click;
     //
     // button4SupposedScan1Center
     //
     this.button4SupposedScan1Center.AutoSize  = true;
     this.button4SupposedScan1Center.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.button4SupposedScan1Center.Location  = new System.Drawing.Point(0, pictureBox3.Location.Y + pictureBox3.Height + 2);
     this.button4SupposedScan1Center.Name      = "button4";
     this.button4SupposedScan1Center.Size      = new System.Drawing.Size(41, 13);
     this.button4SupposedScan1Center.TabIndex  = 16;
     this.button4SupposedScan1Center.Text      = "Supposed";
     button4SupposedScan1Center.MouseClick    += button4SupposedScan1Center_Click;
     //
     // label4
     //
     this.label4.AutoSize  = true;
     this.label4.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.label4.Location  = new System.Drawing.Point(pictureBox4.Location.X, 10);
     this.label4.Name      = "label4";
     this.label4.Size      = new System.Drawing.Size(61, 13);
     this.label4.TabIndex  = 17;
     this.label4.Text      = "Crosslinked";
     //
     // label5
     //
     this.labelError.AutoSize  = true;
     this.labelError.BackColor = System.Drawing.SystemColors.InactiveCaption;
     this.labelError.Location  = new System.Drawing.Point(pictureBox4.Location.X, pictureBox4.Location.Y + pictureBox4.Height + 4);
     this.labelError.Name      = "label5";
     this.labelError.Size      = new System.Drawing.Size(61, 13);
     this.labelError.TabIndex  = 17;
     this.labelError.Text      = "error: ";
     //
     // textBox1
     //
     this.textBox1Scan0Center.Size     = new System.Drawing.Size(50, 13);
     this.textBox1Scan0Center.Location = new System.Drawing.Point(pictureBox2.Location.X + pictureBox2.Width - textBox1Scan0Center.Width, button2Scan0Center.Location.Y + 1);
     this.textBox1Scan0Center.Name     = "textBox1";
     this.textBox1Scan0Center.TabIndex = 17;
     this.textBox1Scan0Center.Text     = "x,y";
     //
     // textBox2
     //
     this.textBox2Scan1Center.Size     = new System.Drawing.Size(50, 13);
     this.textBox2Scan1Center.Location = new System.Drawing.Point(pictureBox2.Location.X + pictureBox2.Width - textBox2Scan1Center.Width, button3Scan1Center.Location.Y + 1);
     this.textBox2Scan1Center.Name     = "textBox2";
     this.textBox2Scan1Center.TabIndex = 17;
     this.textBox2Scan1Center.Text     = "x,y";
     //
     // textBox3
     //
     this.textBox3SupposedScan1Center.Size     = new System.Drawing.Size(50, 13);
     this.textBox3SupposedScan1Center.Location = new System.Drawing.Point(pictureBox2.Location.X + pictureBox2.Width - textBox3SupposedScan1Center.Width, pictureBox3.Location.Y + pictureBox3.Height + 3);
     this.textBox3SupposedScan1Center.Name     = "textBox2";
     this.textBox3SupposedScan1Center.TabIndex = 17;
     this.textBox3SupposedScan1Center.Text     = "x,y";
     //
     // button1
     //
     this.button1Crosslink.Location = new System.Drawing.Point(pictureBox4.Location.X + pictureBox4.Width - button1Crosslink.Size.Width, pictureBox4.Location.Y + pictureBox4.Height);
     this.button1Crosslink.Name     = "button1";
     this.button1Crosslink.Size     = new System.Drawing.Size(75, 23);
     this.button1Crosslink.TabIndex = 18;
     this.button1Crosslink.Text     = "Closslink";
     this.button1Crosslink.UseVisualStyleBackColor = true;
     this.button1Crosslink.Click += new System.EventHandler(this.button1Crosslink_Click);
     //
     // Form1
     //
     mainForm.BackColor  = System.Drawing.SystemColors.ActiveCaption;
     mainForm.ClientSize = new System.Drawing.Size(1454, 873);
     mainForm.addComponentToPanel1(button1Crosslink);
     mainForm.addComponentToPanel1(this.labelError);
     mainForm.addComponentToPanel1(this.label4);
     mainForm.addComponentToPanel1(this.button4SupposedScan1Center);
     mainForm.addComponentToPanel1(this.button3Scan1Center);
     mainForm.addComponentToPanel1(this.button2Scan0Center);
     mainForm.addComponentToPanel1(this.textBox3SupposedScan1Center);
     mainForm.addComponentToPanel1(this.textBox2Scan1Center);
     mainForm.addComponentToPanel1(this.textBox1Scan0Center);
     mainForm.addComponentToPanel1(this.pictureBox4);
     mainForm.addComponentToPanel1(this.pictureBox3);
     mainForm.addComponentToPanel1(this.pictureBox2);
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
     mainForm.panel1ReleaseLayout();
 }
Exemple #5
0
        /// <summary>
        /// Думаем, что центр scan1 - это X2,Y2. Нужно вернуть X1,Y1.
        /// </summary>
        /// <returns>Возвращает массив int[3]: X,Y,error: координаты настоящего центра scan1 и квадрат расстояния от него до реального симуляционного центра scan1</returns>
        public int[] getRealCoords4()
        {
            Console.WriteLine("crosslinkig " + X0 + "," + Y0 + ";"
                              + X1 + "," + Y1 + ";" + X2 + "," + Y2);
            double       minsum = 100000000;
            int          limXY  = 20;
            double       summ;
            double       min;
            int          optX = 0, optY = 0;
            int          C         = (Parameters.getD_scan() + Parameters.getR_scan()) / 2;
            List <int[]> errorZone = pieErrorZoneSearch(0, 0, X2 - X0, Y2 - Y0);
            //    Console.WriteLine("errorZone.Count "+ errorZone.Count);
            int numberOfMinPoints = 0; //количество точек с одинаковыми минимальными значениями функционала ошибки //TODO

            for (int k = 0; k < errorZone.Count; k++)
            {
                PixelMap     map01             = new PixelMap(Parameters.getD_scan1() + Parameters.getR_scan(), Parameters.getD_scan1() + Parameters.getR_scan(), 0, 0, 0);
                List <int[]> irrelevantPoints0 = new List <int[]>();
                List <int[]> irrelevantPoints1 = new List <int[]>();
                int          X = errorZone[k][0];
                int          Y = errorZone[k][1];
                for (int i = 0; i < scan0.xyScan.Count; i++)
                {
                    map01[scan0.xyScan[i][0] + C, scan0.xyScan[i][1] + C] = new Pixel(Parameters.wallColor);
                }
                for (int i = 0; i < scan1.xyScan.Count; i++)
                {
                    map01[scan1.xyScan[i][0] + X + C, scan1.xyScan[i][1] + Y + C] = new Pixel(Parameters.wallColor);
                }
                int  y1 = new int();
                int  x1 = new int();
                bool flagR;        //Будет true, если на текущем угле сканирования видно препятствие, иначе false и радиус от текущего угла будет равен нулю
                bool flagRepeated; //Будет true, если точка уже сохранена в списке скана
                int  rPhi = -1;

                for (int i = 0; i < Parameters.getN_phi(); i++)
                {
                    //---------------------------------------scan1
                    flagR = false;
                    for (ushort r = 1; r < Parameters.getR_scan() + 1; r++)
                    {
                        x1 = (int)Math.Round(r * Math.Cos(i * Parameters.getScan_step()));
                        y1 = (int)Math.Round(r * Math.Sin(i * Parameters.getScan_step()));
                        if (map01[x1 + X + C, y1 + Y + C].Color == Parameters.wallColor)
                        {
                            rPhi  = r;
                            flagR = true;
                            break;
                        }
                    }
                    if (!flagR)
                    {
                        rPhi = 0;
                    }
                    if (rPhi == -1)
                    {
                        Console.WriteLine("Scanning problems r == -1 on scan1, angle: " + i * Parameters.getScan_step() / Math.PI * 180);
                    }
                    if (scan1.rByPhi[i] != rPhi)
                    {
                        flagRepeated = false;
                        for (int j = 0; j < irrelevantPoints1.Count; j++)
                        {
                            if ((irrelevantPoints1[j][0] == x1) && (irrelevantPoints1[j][1] == y1))
                            {
                                flagRepeated = true;
                            }
                        }
                        if (!flagRepeated)
                        {
                            irrelevantPoints1.Add(new int[2] {
                                x1, y1
                            });
                        }
                    }
                    //---------------------------------------scan0
                    flagR = false;
                    for (ushort r = 1; r < Parameters.getR_scan() + 1; r++)
                    {
                        x1 = (int)Math.Round(r * Math.Cos(i * Parameters.getScan_step()));
                        y1 = (int)Math.Round(r * Math.Sin(i * Parameters.getScan_step()));
                        if (map01[x1 + C, y1 + C].Color == Parameters.wallColor)
                        {
                            rPhi  = r;
                            flagR = true;
                            break;
                        }
                    }
                    if (!flagR)
                    {
                        rPhi = 0;
                    }
                    if (rPhi == -1)
                    {
                        Console.WriteLine("Scanning problems r == -1 on scan0, angle: " + i * Parameters.getScan_step() / Math.PI * 180);
                    }
                    if (scan0.rByPhi[i] != rPhi)
                    {
                        flagRepeated = false;
                        for (int j = 0; j < irrelevantPoints0.Count; j++)
                        {
                            if ((irrelevantPoints0[j][0] == x1) && (irrelevantPoints0[j][1] == y1))
                            {
                                flagRepeated = true;
                            }
                        }
                        if (!flagRepeated)
                        {
                            irrelevantPoints0.Add(new int[2] {
                                x1, y1
                            });
                        }
                    }
                }

                summ = 0;
                for (int i = 0; i < irrelevantPoints1.Count; i++)
                {
                    min = 1000000;
                    for (int j = 0; j < scan1.xyScan.Count; j++)
                    {
                        if (min > Parameters.getSquaredDistance(irrelevantPoints1[i][0], irrelevantPoints1[i][1], scan1.xyScan[j][0], scan1.xyScan[j][1]))
                        {
                            min = Parameters.getSquaredDistance(irrelevantPoints1[i][0], irrelevantPoints1[i][1], scan1.xyScan[j][0], scan1.xyScan[j][1]);
                        }
                    }
                    summ += min;
                }
                for (int i = 0; i < irrelevantPoints0.Count; i++)
                {
                    min = 1000000;
                    for (int j = 0; j < scan0.xyScan.Count; j++)
                    {
                        if (min > Parameters.getSquaredDistance(irrelevantPoints0[i][0], irrelevantPoints0[i][1], scan0.xyScan[j][0], scan0.xyScan[j][1]))
                        {
                            min = Parameters.getSquaredDistance(irrelevantPoints0[i][0], irrelevantPoints0[i][1], scan0.xyScan[j][0], scan0.xyScan[j][1]);
                        }
                    }
                    summ += min;
                }
                if (minsum > summ)
                {
                    minsum            = summ;
                    optX              = X;
                    optY              = Y;
                    numberOfMinPoints = 0; //TODO
                }
                if (summ == minsum)        //TODO
                {
                    numberOfMinPoints++;
                }
            }
            int errorSquredDistance = Parameters.getSquaredDistance(X1, Y1, X0 + optX, Y0 + optY); //квадрат раастояния от реального положения до предсказанного

            //
            //    Console.WriteLine("opts "+optX+","+optY);
            if (errorSquredDistance != 0) //TODO
            {
                Console.WriteLine("Don't match--------------------------------------");
            }
            return(new int[5] {
                X0 + optX, Y0 + optY, errorSquredDistance, errorZone.Count(), numberOfMinPoints
            });                                                                                                    //TODO
        }
        /// <summary>
        /// Возвращает скан с точной карты в заданных координатах
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="scanColor">цвет скана для отрисовки</param>
        /// <returns></returns>
        public Scan getScan(int X, int Y, Color scanColor)
        {
            Scan scan = new Scan();
            int  y    = new int();
            int  x    = new int();
            bool flagR;        //Будет true, если на текущем угле сканирования видно препятствие, иначе false и радиус от текущего угла будет равен нулю
            bool flagRepeated; //Будет true, если точка уже сохранена в списке скана

            Random rand = new Random(System.DateTime.Now.Millisecond);

            //    Stopwatch stopwatch = Stopwatch.StartNew();
            for (int i = 0; i < Parameters.getN_phi(); i++)
            {
                flagR = false;
                for (ushort r = 1; r < Parameters.getR_scan1(); r++)
                {
                    x = (int)Math.Round(r * Math.Cos(i * Parameters.getScan_step()));
                    y = (int)Math.Round(r * Math.Sin(i * Parameters.getScan_step()));
                    if (preciseMap[x + X, y + Y].Color == Parameters.wallColor)
                    {
                        scan.rByPhi[i] = r;
                        flagRepeated   = false;
                        for (int j = 0; j < scan.xyScan.Count; j++)
                        {
                            if ((scan.xyScan[j][0] == x) && (scan.xyScan[j][1] == y))
                            {
                                flagRepeated = true;
                            }
                        }
                        if (!flagRepeated)
                        {
                            switch (r_scanNoiseMode)
                            {
                            case 1:
                                r = rNoising1(ref r, ref rand);
                                break;

                            case 2:
                                r = rNoising2(ref r, ref rand);
                                break;

                            case 3:
                                r = rNoising3(ref r, ref rand);
                                break;
                            }

                            x = (int)Math.Round(r * Math.Cos(i * Parameters.getScan_step()));
                            y = (int)Math.Round(r * Math.Sin(i * Parameters.getScan_step()));
                            scan.xyScan.Add(new int[2] {
                                x, y
                            });
                        }
                        scan.scanBmp[x + Parameters.getR_scan(), y + Parameters.getR_scan()] = new Pixel(scanColor);
                        flagR = true;
                        break;
                    }
                }
                if (!flagR)
                {
                    scan.rByPhi[i] = 0;
                }
            }

            //   stopwatch.Stop();
            //    Console.WriteLine("Time wasted: "+stopwatch.ElapsedMilliseconds);
            return(scan);
        }