/// <summary> /// 显示指定要素的属性 /// </summary> /// <param name="identifiedFeature"></param> private void ShowFeatureAttributes(IFeature identifiedFeature, LayerIdentifiedResult layerResult) { ArcGisPublic agp = new ArcGisPublic(); ifeat = identifiedFeature; pFeatureLayer = agp.GetLayerByName(associateMapControl, layerResult.IdentifyLayer.Name) as IFeatureLayer; if (identifiedFeature == null) { //初始化属性列表 InitializeAttributesList(); return; } //清空数据列表 lstProperties.Items.Clear(); lstProperties.Columns.Clear(); //若查询数据不为空则显示数据 //添加列头 ColumnHeader fieldHeader = new ColumnHeader(); fieldHeader.Text = "字段名"; fieldHeader.Width = 85; ColumnHeader valueHeader = new ColumnHeader(); valueHeader.Text = "属性值"; valueHeader.Width = lstProperties.Width - fieldHeader.Width - 25; lstProperties.Columns.AddRange(new ColumnHeader[] { fieldHeader, valueHeader }); //添加值对 IFields fields = identifiedFeature.Fields; //几何图形 IGeometry shape = identifiedFeature.Shape; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.get_Field(i); ListViewItem lvi = new ListViewItem(field.AliasName); string fieldValue = string.Empty; if (field.Type == esriFieldType.esriFieldTypeGeometry) { fieldValue = shape.GeometryType.ToString().Substring(12); } else { fieldValue = identifiedFeature.get_Value(i).ToString(); } lvi.SubItems.Add(fieldValue); lstProperties.Items.Add(lvi); } }
private void button1_Click(object sender, EventArgs e) { Dictionary <string, string> FieldTable = new Dictionary <string, string>(); foreach (DataGridViewRow PropRow in this.dataGridView1.Rows) { string PropKey = PropRow.Cells[0].Value.ToString(); string PropValue = ""; if (PropRow.Cells[1].Value != null) { PropValue = PropRow.Cells[1].Value.ToString(); } else { PropValue = ""; } FieldTable.Add(PropKey, PropValue); } ArcGisPublic agp = new ArcGisPublic(); agp.UpdateFeatureValue(FieldTable, pFeatureLayer as IFeatureLayer); }
/// <summary> /// 显示指定要素的属性 /// </summary> /// <param name="identifiedFeature"></param> private void ShowFeatureAttributes(IFeature identifiedFeature, LayerIdentifiedResult layerResult) { ArcGisPublic agp = new ArcGisPublic(); ifeat = identifiedFeature; pFeatureLayer = agp.GetLayerByName(associateMapControl,layerResult.IdentifyLayer.Name) as IFeatureLayer; if (identifiedFeature == null) { //初始化属性列表 InitializeAttributesList(); return; } //清空数据列表 lstProperties.Items.Clear(); lstProperties.Columns.Clear(); //若查询数据不为空则显示数据 //添加列头 ColumnHeader fieldHeader = new ColumnHeader(); fieldHeader.Text = "字段名"; fieldHeader.Width = 85; ColumnHeader valueHeader = new ColumnHeader(); valueHeader.Text = "属性值"; valueHeader.Width = lstProperties.Width - fieldHeader.Width - 25; lstProperties.Columns.AddRange(new ColumnHeader[] { fieldHeader, valueHeader }); //添加值对 IFields fields = identifiedFeature.Fields; //几何图形 IGeometry shape = identifiedFeature.Shape; for (int i = 0; i < fields.FieldCount; i++) { IField field = fields.get_Field(i); ListViewItem lvi = new ListViewItem(field.AliasName); string fieldValue = string.Empty; if (field.Type == esriFieldType.esriFieldTypeGeometry) { fieldValue = shape.GeometryType.ToString().Substring(12); } else { fieldValue = identifiedFeature.get_Value(i).ToString(); } lvi.SubItems.Add(fieldValue); lstProperties.Items.Add(lvi); } }
public override void OnClick() { ArcGisPublic agp = new ArcGisPublic(); agp.export(axMapControl1, form1); }