示例#1
0
 private void 读入参考数据_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog opf = new OpenFileDialog();
         opf.Filter = "(*.txt)|*.txt";
         status_text("玩命加载中   请稍等……", Color.Black);
         if (opf.ShowDialog() == DialogResult.OK)
         {
             dis_result[0] = new discriminant_result();
             string       rpath = opf.FileName;            //获得文件地址
             StreamReader sr    = new StreamReader(rpath); //打开文件
             dis_result[0].model_name = sr.ReadLine().Trim();
             while (!sr.EndOfStream)
             {
                 string[] line = sr.ReadLine().Trim().Split(',', ',');
                 int[]    a    = new int[] { int.Parse(line[0]), int.Parse(line[1]) };
                 dis_result[0].model_result.Add(a);
             }
             sr.Close();
         }
         REPORT_show.Text  = "----------------------------------目视解译 线匹配---------------------------------\r\n";
         REPORT_show.Text += "图层1    -->  图层2" + "\r\n";
         for (int i = 0; i < dis_result[0].model_result.Count; i++)
         {
             REPORT_show.Text += "线实体" + dis_result[0].model_result[i][0] + "  -->  " + "线实体" + dis_result[0].model_result[i][1] + "\r\n";
         }
         REPORT_show.BringToFront();
         status_text("读取参考数据成功", Color.Black);
     }
     catch { status_text("读取参考数据失败", Color.Red); }
 }
示例#2
0
        private void data_show(List <List <double> > hausdorff_D, string str)         //报告数据显示
        {
            discriminant_result dis_re = new discriminant_result();

            dis_re.model_name = str;

            REPORT_show.Text += "----------------------------------" + str + "线匹配---------------------------------\r\n";
            string match_info = "--------------------------------------------------------\r\n" +
                                "阈值:" + threshold_value.Text + "\r\n" + "图层1     ---匹配-->    图层2         距离值\r\n";
            int m = hausdorff_D.Count / 10;                                               //用来处理图层有多与10个的情况,让他们分段显示

            for (int n = 0; n <= m; n++)
            {
                if (n == m)
                {
                    REPORT_show.Text += str.PadRight(22);
                    for (int i = n * 10; i < hausdorff_D[0].Count; i++)
                    {
                        REPORT_show.Text += "  图层2线实体" + (i + 1);
                    }
                    REPORT_show.Text += "\r\n";
                    for (int j = m * 10; j < hausdorff_D.Count; j++)
                    {
                        REPORT_show.Text += "图层1线实体" + (j + 1).ToString().PadRight(20);
                        for (int jj = 0; jj < hausdorff_D[j].Count; jj++)
                        {
                            REPORT_show.Text += hausdorff_D[j][jj].ToString("0.0000").PadRight(14);
                            if (hausdorff_D[j][jj] < double.Parse(threshold_value.Text))
                            {
                                match_info += "线实体" + (j + 1).ToString().PadRight(5) + " ---->".ToString().PadRight(13)
                                              + "线实体" + (jj + 1).ToString().PadRight(8) + hausdorff_D[j][jj].ToString("0.0000") + "\r\n";
                                int[] a = new int[] { j + 1, jj + 1 };
                                dis_re.model_result.Add(a);
                            }
                        }
                        REPORT_show.Text += "\r\n";
                    }
                }
                else
                {
                    REPORT_show.Text += str.PadRight(22);
                    for (int i = n * 10; i < (n + 1) * 10; i++)
                    {
                        REPORT_show.Text += "  图层2线实体" + (i + 1);
                    }
                    REPORT_show.Text += "\r\n";

                    for (int j = n * 10; j < 10 * (n + 1); j++)
                    {
                        REPORT_show.Text += "图层1线实体" + (j + 1).ToString().PadRight(10);
                        for (int jj = 0; jj < hausdorff_D[j].Count; jj++)
                        {
                            REPORT_show.Text += hausdorff_D[j][jj].ToString("0.0000").PadRight(14);
                            if (hausdorff_D[j][jj] < double.Parse(threshold_value.Text))
                            {
                                match_info += "线实体" + (j + 1).ToString().PadRight(5) + " ---->".ToString().PadRight(13)
                                              + "线实体" + (jj + 1).ToString().PadRight(8) + hausdorff_D[j][jj].ToString("0.0000") + "\r\n";
                                int[] a = new int[] { j + 1, jj + 1 };
                                dis_re.model_result.Add(a);
                            }
                        }
                        REPORT_show.Text += "\r\n";
                    }
                }
            }
            if ("基于传统Hausdorff距离".Equals(str))                      //根据不同的model,把不同的结果放入不同的位置
            {
                dis_result[1] = dis_re;
            }
            else if ("基于改进的Hausdorff_SMHD距离".Equals(str))
            {
                dis_result[2] = dis_re;
            }
            else if ("基于离散Frechet距离".Equals(str))
            {
                dis_result[3] = dis_re;
            }
            else if ("基于平均Frechet距离".Equals(str))
            {
                dis_result[4] = dis_re;
            }
            else
            {
            }
            REPORT_show.Text += match_info + "\r\n  \r\n";
        }