private void FormOpenAttri_Load(object sender, EventArgs e) { if (m_bAllRecords) { btnSelectedFeature.Checked = false; btnAllFeature.Checked = true; } else { btnSelectedFeature.Checked = true; btnAllFeature.Checked = false; } if (m_featLayer != null) { IFeatureSelection featSelection = m_featLayer as IFeatureSelection; data_operate dop = new data_operate(); DataTable dt = dop.OpenAttrubutionTable(m_featLayer, m_bAllRecords); dataGridView1.DataSource = dt; totalCount = m_featLayer.FeatureClass.FeatureCount(null); selectedCount = featSelection.SelectionSet.Count; lblCount.Text = string.Format("(共{0}条记录,选中{1}条)", totalCount, selectedCount); this.Text = "图层属性表(" + m_featLayer.Name + ")"; } }
private void btnSelectedFeature_Click(object sender, EventArgs e) { if (m_featLayer != null) { data_operate dop = new data_operate(); DataTable dt = dop.OpenAttrubutionTable(m_featLayer, false); dataGridView1.DataSource = dt; btnAllFeature.Checked = false; btnSelectedFeature.Checked = true; } }
private void combo_layer_SelectedIndexChanged(object sender, EventArgs e) { data_operate dop = new data_operate(); feaLyr = (dop.GetLayerByName(map, combo_layer.SelectedItem.ToString())) as IFeatureLayer; IFeatureClass feaCls = null; if (feaLyr != null) { feaCls = feaLyr.FeatureClass; for (int i = 0; i < feaCls.Fields.FieldCount; i++) { string strFieldName = feaCls.Fields.get_Field(i).Name; listBox_attri.Items.Add(strFieldName); } } }
private void btn_ok_Click(object sender, EventArgs e) { if (combo_layer.SelectedItem == null) { MessageBox.Show("没有图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (combo_unit.SelectedItem == null || text_dis.Text == null || text_path == null) { MessageBox.Show("请完善距离、单位、路径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } data_operate dop = new data_operate(); feaLyr = dop.GetLayerByName(map, combo_layer.SelectedItem.ToString()) as IFeatureLayer; distance = System.Convert.ToDouble(text_dis.Text); unit = combo_unit.SelectedItem.ToString(); MapAnalysis.BufferAnalysis(feaLyr, path, distance, unit); }
private void btn_ok_Click(object sender, EventArgs e) { FileInfo fileinfo = new FileInfo(shppath); data_operate dop = new data_operate(); IFeatureClass fc = dop.CreateShapefile(fileinfo.DirectoryName, fileinfo.Name, Ref_relay, combo_type.SelectedItem.ToString()); }