コード例 #1
0
        private void 生成凸包_Click(object sender, EventArgs e)         //图形显示
        {
            if (g_point.Count == 0)
            {
                status.Text = "没有数据,无法生成凸包"; return;
            }
            if (convex_hull.Count == 0 && g_point.Count != 0)
            {
                生成凸包 create_c_h = new 利用构建规则格网_grid_进行体积计算.生成凸包(g_point);
                minmax = create_c_h.getminmax();                //得到数据中最大最小X,Y值


                //convex_hull = create_c_h.get_convex_hull();              //              Graham'sScan算法  得到凸包点
                convex_hull = create_c_h.conver_h1(g_point);                            //               快速凸包法        得到的凸包点
            }
            grid_spacing = float.Parse(网格间隔.Text);                                      //获得最新的网格间隔信息

            DRAW   draw = new DRAW();                                                   //定义画图类
            Bitmap bmp  = draw.get_picture(g_point, convex_hull, grid_spacing, minmax); //得到画布

            pictureBox1.BackgroundImage       = bmp;                                    //得到图片
            pictureBox1.BackgroundImageLayout = ImageLayout.Stretch;
            panel1.Controls.Add(pictureBox1);                                           //放入容器

            pictureBox1.Width  = 650;                                                   //初始化图片的大小
            pictureBox1.Height = 400;
            panel1.BringToFront();
            status.Text = "生成凸包,并显示凸包";
        }