private void button2_Click(object sender, EventArgs e)
        {
            Parameters.setN_phi((int)numericUpDown6n_phi.Value);
            if (Parameters.getR_robot() != (int)numericUpDown2r_robot.Value)
            {
                Parameters.setR_robot((int)numericUpDown2r_robot.Value);
                environment.recalculateIndoorMap();
            }
            Parameters.setR_scan((int)numericUpDown1r_scan.Value);
            Parameters.setSgm_lmax((int)numericUpDown3sgm_lmax.Value);
            Parameters.setSgm_psi_deg((int)numericUpDown4sgm_psi.Value);
            Environment.setR_scanNoiseMode((byte)numericUpDown5scan_noise.Value);

            switch (currentMode)
            {
            case 1:
                setMode1();
                break;

            case 2:
                setMode2();
                break;

            case 3:
                setMode3();
                break;
            }
        }
Exemple #2
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);
 }
        /// <summary>
        /// Рассчитывает карту indoor-среды для заданной карты.
        /// </summary>
        /// <param name="map"></param>
        /// <returns></returns>
        private static PixelMap calculateIndoorMap(PixelMap map)
        {
            Bitmap     preciseIndoorMapBmp = map.GetBitmap();
            Pen        pen      = new Pen(Parameters.wallColor);
            SolidBrush brush    = new SolidBrush(Parameters.wallColor);
            Graphics   graphics = Graphics.FromImage(preciseIndoorMapBmp);
            int        r        = Parameters.getR_robot() + Parameters.getR_robot() / 2; //увеличенные размеры робота, для того, чтобы на угловых участках траектории сглаживание происходило без проблем
            int        d        = Parameters.getD_robot() + Parameters.getR_robot();

            for (int i = 0; i < map.Width; i++)
            {
                for (int j = 0; j < map.Height; j++)
                {
                    if (map[i, j].Color == Parameters.wallColor)
                    {
                        try
                        {
                            FillCircle(ref graphics, ref pen, ref brush, r, d, ref i, ref j);
                        }
                        catch (Exception ex) { }
                    }
                }
            }
            //    preciseIndoorMapBmp.Save("C:\\Adocuments\\Library\\Clapeyron_ind\\task6 map creation\\PreciseIndoorMap13.png");
            PixelMap preciseIndoorMap = new PixelMap(preciseIndoorMapBmp);

            return(preciseIndoorMap);
        }
 /// <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);
 }