Esempio n. 1
0
 private void button11_Click(object sender, EventArgs e)
 {
     layer = GISMyFile.ReadFile(@"D:\mygisfile\mygisfile.jkgeo");
     MessageBox.Show("read " + layer.FeatureCount() + " objects.");
     view.UpdateExtent(layer.Extent);
     UpdateMap();
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            GISShapefile sf = new GISShapefile();

            layer = sf.ReadShapefile(@"D:\课程\大三上\地理信息系统底层开发\data\china_cities_gdf_prj.shp");
            layer.DrawAttributeOrNot = false;
            MessageBox.Show("read " + layer.FeatureCount() + " point objects");
        }
Esempio n. 3
0
 public Form2(GISLayer layer)
 {
     InitializeComponent();
     for (int i = 0; i < layer.Fields.Count; i++) //添加一系列的列
     {
         dataGridView1.Columns.Add(layer.Fields[i].name, layer.Fields[i].name);
     }
     for (int i = 0; i < layer.FeatureCount(); i++)
     {
         dataGridView1.Rows.Add();
         for (int j = 0; j < layer.Fields.Count; j++)
         {
             dataGridView1.Rows[i].Cells[j].Value = layer.GetFeature(i).getAttribute(j);
         }
     }
 }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Shapefile文件|*.shp";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex      = 1;
            openFileDialog.Multiselect      = false;
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            layer = GISShapefile.ReadShapefile(openFileDialog.FileName);
            layer.DrawAttributeOrNot = false;
            MessageBox.Show("read " + layer.FeatureCount() + "objects");
            view.UpdateExtent(layer.Extent);
            UpdateMap();
        }
Esempio n. 5
0
 private void FillValue()//初始化DataGridView的部分移动到了此函数中
 {
     //增加ID列
     dataGridView1.Columns.Add("ID", "ID");
     //增加其他列 用以记录所有字段
     for (int i = 0; i < Layer.Fields.Count; i++)
     {
         dataGridView1.Columns.Add(Layer.Fields[i].name, Layer.Fields[i].name);
     }
     //增加行
     for (int i = 0; i < Layer.FeatureCount(); i++)
     {
         dataGridView1.Rows.Add();
         //增加ID值
         dataGridView1.Rows[i].Cells[0].Value = Layer.GetFeature(i).ID;
         //增加其他属性值
         for (int j = 0; j < Layer.Fields.Count; j++)
         {
             dataGridView1.Rows[i].Cells[j + 1].Value = Layer.GetFeature(i).getAttribute(j);
         }
         //确定每行的选择状态
         dataGridView1.Rows[i].Selected = Layer.GetFeature(i).Selected;
     }
 }