Esempio n. 1
0
        private void Area_Load(object sender, EventArgs e)
        {
            List <double> area = new List <double>();

            ShapeFile.ReadShp rs = new ShapeFile.ReadShp();
            rs.ReadShape(MainForm.filename);
            if (MainForm.calflag == 1)
            {
                area = rs.CalArea();
            }
            else if (MainForm.calflag == 2)
            {
                area = rs.CalTrapezoid();
            }
            #region 设置datagridview的相关属性
            dataGridView1.RowCount         = area.Count; //行数
            dataGridView1.ColumnCount      = 2;          //列数
            dataGridView1.Columns[0].Width = 100;        //第一列宽
            dataGridView1.Columns[1].Width = 400;        //第二列宽
            dataGridView1.Columns[0].Name  = "序号";
            dataGridView1.Columns[1].Name  = "面积";
            #endregion
            for (int i = 0; i < area.Count; i++)
            {
                this.dataGridView1[0, i].Value = (i + 1).ToString();
                this.dataGridView1[1, i].Value = area[i];
            }
        }
Esempio n. 2
0
        private void 墨卡托投影反算ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Refresh();
            ShapeFile.ReadShp rs = new ShapeFile.ReadShp();
            rs.ReadShape(filename);
            Bitmap mi = rs.MercatorInverse(pictureBox1.DisplayRectangle);

            merpolylist            = rs.merpolylist;
            this.pictureBox1.Image = mi;
        }
Esempio n. 3
0
        //更改picturebox的大小,使其与主窗口变化一致
        private void MainForm_Resize(object sender, EventArgs e)
        {
            Control control = (Control)sender;

            this.pictureBox1.ClientSize = control.Size;
            if (flag == 1)
            {
                pictureBox1.Invalidate();
                ShapeFile.ReadShp rs = new ShapeFile.ReadShp();
                rs.ReadShape(filename);
                //Bitmap shp = rs.DrawShp(pictureBox1.DisplayRectangle);
                shp = rs.DrawShp(pictureBox1.DisplayRectangle);
                this.pictureBox1.Image = shp;
            }
        }
Esempio n. 4
0
        public List <List <List <PointF> > > merpolylist = new List <List <List <PointF> > >(); //原始多边形集合
        private void shapefile文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pictureBox1.Refresh();
            flag = 1;
            OpenFileDialog ofd = new OpenFileDialog();//打开文件夹

            ofd.Filter = "shapefile(*.shp)|*.shp|所有文件(*.*)|*.*";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                filename = ofd.FileName;
                ShapeFile.ReadShp rs = new ShapeFile.ReadShp();
                rs.ReadShape(filename);
                Bitmap shp = rs.DrawShp(pictureBox1.DisplayRectangle);
                this.pictureBox1.Image = shp;
                polylist    = rs.polylist;    //有值
                merpolylist = rs.merpolylist; //无值
            }
            ofd.Dispose();
        }