/// <summary> /// 建模完成按钮响应事件 /// </summary> private void OnButtonModelDone(object sender, EventArgs e) { prepareforListDetectDis(); //prepareforListDetectDisFin(); //准备数据,为数组list_detect_distance_final,注意:每次切换一种雷达时候, this.featurecomboBox1.Items.Clear();//清空combobox内的值 this.featurelistView.Items.Clear(); //需要先清空list_detect_distance_final if (radioButton7.Checked == true) { //添加高斯噪声 //均值 double xMean = 0, xVariance = 0; double yMean = 0, yVariance = 0; //计算均值和方差 for (int i = 0; i < arr_tar.Count; i++) //得到guassList数组 { computeMeanVar(list_detect_distance_update[i], out xMean, out xVariance, out yMean, out yVariance); guassianList[i] = new List<PointD>(Noise.addGuassianNoise(list_detect_distance_update[i].ToArray(), xMean, xVariance, yMean, yVariance)); } prepareforguassListFinal(); button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了高斯白噪声")) { noiseFlag = NoiseEnum.GUASSIAN; //将当前选中的tab页设为特性分析 this.tabControl1.SelectedIndex = 1; } } else if (radioButton8.Checked == true) { //添加泊松噪音 for (int i = 0; i < arr_tar.Count; i++) { poissonList[i] = new List<PointD>(Noise.addPoissonNoise(list_detect_distance_update[i].ToArray(), (panel1.Width / 10) * 7, (panel1.Width / 10) * 7)); } prepareforpoissonListFinal(); button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了泊松噪声")) { noiseFlag = NoiseEnum.POISSON; //将当前的页面切换成特性分析 this.tabControl1.SelectedIndex = 1; } } else if (radioButton9.Checked == true) { //添加均匀噪声 //计算均匀分布的a和b double xMean = 0, xVariance = 0; double yMean = 0, yVariance = 0; double XA = 0, XB = 0; double YA = 0, YB = 0; for (int i = 0; i < arr_tar.Count; i++) { computeMeanVar(list_detect_distance_update[i], out xMean, out xVariance, out yMean, out yVariance); XA = xMean - Math.Pow(3, 1 / 2) * Math.Pow(xVariance, 2); XB = xMean + Math.Pow(3, 1 / 2) * Math.Pow(xVariance, 2); YA = yMean - Math.Pow(3, 1 / 2) * Math.Pow(yVariance, 2); YB = yMean + Math.Pow(3, 1 / 2) * Math.Pow(yVariance, 2); uniformList[i] = new List<PointD>(Noise.addUniformNoise(list_detect_distance_update[i].ToArray(), XA, XB, YA, YB)); } prepareforuniformListfinal(); button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了平均噪声")) { noiseFlag = NoiseEnum.UNIFORM; this.tabControl1.SelectedIndex = 1; } } }
/// <summary> /// 返回按钮响应事件 /// </summary> private void button_goback_Click(object sender, EventArgs e) { textBox_doppler.Visible = false; button_goback.Visible = false; label_sel_radartype.Visible = false; button_update_config.Visible = false; buttonDectecModeling.Visible = false; buttonModelDone.Visible = false; groupBox1.Visible = true; groupBox2.Visible = false; groupBox3.Visible = false; textBox_juli.Visible = false; textBox_zaipin.Visible = false; textBox_chongpin.Visible = false; textBox_maikuan.Visible = false; textBox_maifu.Visible = false; textBox_saomiao.Visible = false; textBox_jiebianliang.Visible = false; textBox_doudongliang.Visible = false; button_text_update.Visible = false; //从指挥控制中返回 this.label5.Visible = false; this.dopplercheckBox.Visible = false; this.multpBasecheckBox.Visible = false; this.bvrcheckBox.Visible = false; this.groupBox6.Visible = false; this.groupBox4.Visible = false; this.groupBox5.Visible = false; this.mixtrailButton.Visible = false; noiseFlag = NoiseEnum.NoNoise; pictureBox3.Visible = false; pictureBox4.Visible = false; pictureBox5.Visible = false; //返回到最开始,什么都没选择 this.radioButton1.Checked = false; this.radioButton2.Checked = false; this.radioButton3.Checked = false; this.radioButton4.Checked = false; this.radioButton5.Checked = false; this.radioButton6.Checked = false; this.radioButton13.Checked = false; this.radioButton14.Checked = false; this.radioButton15.Checked = false; this.radioButton16.Checked = false; this.radioButton17.Checked = false; this.radioButton18.Checked = false; this.radioButton19.Checked = false; this.radioButton20.Checked = false; this.radioButton21.Checked = false; this.radioButton22.Checked = false; this.button_goback.Visible = false; }
//添加噪音 private void OnButtonModelDone(object sender, EventArgs e) { prepareforListDetectDis(); //准备数据,为数组list_detect_distance_final,注意:每次切换一种雷达时候, //需要先清空list_detect_distance_final double distance1, distance2; distance1 = 7 * panel1.Width / 20; PointD point = new PointD(); PointD point_diff = new PointD(); if (radioButton7.Checked == true) { //添加高斯噪声 //均值 double xMean = 0, xVariance = 0; double yMean = 0, yVariance = 0; //计算均值和方差 for (int i = 0; i < arr_tar.Count; i++) { computeMeanVar(list_detect_distance_final[i], out xMean, out xVariance, out yMean, out yVariance); guassianList[i] = new List<PointD>(Noise.addGuassianNoise(list_detect_distance_final[i].ToArray(), xMean, xVariance, yMean, yVariance)); for (int j = 0; j < guassianList[i].Count; j++) { computeMeanVar(list_detect_distance_final[i], out xMean, out xVariance, out yMean, out yVariance); guassianList[i] = new List<PointD>(Noise.addGuassianNoise(list_detect_distance_final[i].ToArray(), xMean, xVariance, yMean, yVariance)); point.X = guassianList[i][j].X; point.Y = guassianList[i][j].Y; point_diff.X = point.X; point_diff.Y = point.Y; point_diff.X = point.X - pictureBox4.Left; point_diff.Y = point.Y - pictureBox4.Top; distance2 = Math.Sqrt(point_diff.X * point_diff.X + point_diff.Y * point_diff.Y); if (distance2 - distance1 <= 0) //相当于判断雷达的最大扫描范围 { // list_trace. PointD point_save = new PointD(); point_save.X = point.X; point_save.Y = point.Y; guassianList_final[i].Add(point_save); // continue; } else { continue; } } } button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了高斯白噪声")) { noiseFlag = NoiseEnum.GUASSIAN; //将当前选中的tab页设为特性分析 this.tabControl1.SelectedIndex = 1; } } else if (radioButton8.Checked == true) { //添加泊松噪音 for (int i = 0; i < arr_tar.Count; i++) { poissonList[i] = new List<PointD>(Noise.addPoissonNoise(list_detect_distance_final[i].ToArray(), (panel1.Width / 10) * 7, (panel1.Width / 10) * 7)); for (int j = 0; j < poissonList[i].Count; j++) { point.X = poissonList[i][j].X; point.Y = poissonList[i][j].Y; point_diff.X = point.X; point_diff.Y = point.Y; point_diff.X = point.X - pictureBox4.Left; point_diff.Y = point.Y - pictureBox4.Top; distance2 = Math.Sqrt(point_diff.X * point_diff.X + point_diff.Y * point_diff.Y); if (distance2 - distance1 <= 0) //相当于判断雷达的最大扫描范围 { // list_trace. PointD point_save = new PointD(); point_save.X = point.X; point_save.Y = point.Y; poissonList_final[i].Add(point_save); // continue; } else { continue; } } } button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了泊松噪声")) { //MessageBox.Show(""+(panel1.Width / 10) * 7); noiseFlag = NoiseEnum.POISSON; //将当前的页面切换成特性分析 this.tabControl1.SelectedIndex = 1; } //button_goback.Enabled = true; } else if (radioButton9.Checked == true) { //添加均匀噪声 //计算均匀分布的a和b double xMean = 0, xVariance = 0; double yMean = 0, yVariance = 0; double XA = 0, XB = 0; double YA = 0, YB = 0; for (int i = 0; i < arr_tar.Count; i++) { computeMeanVar(list_detect_distance_final[i], out xMean, out xVariance, out yMean, out yVariance); XA = xMean - Math.Pow(3, 1 / 2) * Math.Pow(xVariance, 2); XB = xMean + Math.Pow(3, 1 / 2) * Math.Pow(xVariance, 2); YA = yMean - Math.Pow(3, 1 / 2) * Math.Pow(yVariance, 2); YB = yMean + Math.Pow(3, 1 / 2) * Math.Pow(yVariance, 2); uniformList[i] = new List<PointD>(Noise.addUniformNoise(list_detect_distance_final[i].ToArray(), XA, XB, YA, YB)); for (int j = 0; j < uniformList[i].Count; j++) { point.X = uniformList[i][j].X; point.Y = uniformList[i][j].Y; point_diff.X = point.X; point_diff.Y = point.Y; point_diff.X = point.X - pictureBox4.Left; point_diff.Y = point.Y - pictureBox4.Top; distance2 = Math.Sqrt(point_diff.X * point_diff.X + point_diff.Y * point_diff.Y); if (distance2 - distance1 <= 0) //相当于判断雷达的最大扫描范围 { // list_trace. PointD point_save = new PointD(); point_save.X = point.X; point_save.Y = point.Y; uniformList_final[i].Add(point_save); // continue; } else { continue; } } } button_goback.Enabled = true; if (DialogResult.OK == MessageBox.Show("congratulations! 添加噪声完毕,你选择添加了平均噪声")) { noiseFlag = NoiseEnum.UNIFORM; this.tabControl1.SelectedIndex = 1; } //button_goback.Enabled = true; } else MessageBox.Show("请选择添加一种噪声"); }