日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ArcEngine图层属性查询

發布時間:2024/3/26 编程问答 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ArcEngine图层属性查询 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以下代碼實現了,根據給定的索引值layerindex,圖層名稱顯示在Label中,將圖層的屬性名稱添加到CheckedListBox中,將屬性展示在DataGridView中。

ILayer layer = mainForm.axMapControltemp.get_Layer(layerindex);IFeatureLayer pFeatureLayer = layer as IFeatureLayer;label1.Text = "您選擇的是:"+pFeatureLayer.Name+" 圖層";//加載屬性數據ITable table = pFeatureLayer.FeatureClass as ITable;dataGridView1.ColumnCount = table.Fields.FieldCount;//要先指定<span style="font-family: Arial, Helvetica, sans-serif;">dataGridView1的列數</span>for (int i = 0; i < table.Fields.FieldCount; i++){checkedListBox1.Items.Add(table.Fields.get_Field(i).Name.ToString());dataGridView1.Columns[i].Name = table.Fields.get_Field(i).Name.ToString();//屬性名賦給列名dataGridView1.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;//自適應列寬}for (int i = 0; i < table.RowCount(null); i++){int index = dataGridView1.Rows.Add();//獲取當前行for (int j = 0; j < table.Fields.FieldCount; j++){if (table.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeGeometry)//Arcgis屬性中的特殊屬性類型處理dataGridView1.Rows[index].Cells[j].Value = GetFeatureShapeType(pFeatureLayer);elsedataGridView1.Rows[index].Cells[j].Value = table.GetRow(i).get_Value(j).ToString();}} private String GetFeatureShapeType(IFeatureLayer pFeatureLayer)//獲取圖層Shape類型的方法{String str;str = "error";if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint){str = "Point";}else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline){str = "Line";}else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon){str = "Polygon";}return str;}


總結

以上是生活随笔為你收集整理的ArcEngine图层属性查询的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。