private void dataGridView1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo hittestinfo = dataGridView1.HitTest(e.X, e.Y); if (hittestinfo.RowIndex > -1) { contextMenuStrip1.Show(dataGridView1, e.X, e.Y); if (layer == null) { return; } GSOFeatureLayer pFeatureLayer = layer as GSOFeatureLayer; if (pFeatureLayer != null) { features = layer.GetFeatureByName(dataGridView1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(), true); if (features != null) { for (int i = 0; i < features.Length; i++) { m_feature = features[i]; m_feature.HighLight = false; } globeControl1.Globe.Refresh(); } } } } }
private void dataGridView1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridView.HitTestInfo hittestinfo = dataGridView1.HitTest(e.X, e.Y); if (hittestinfo.RowIndex > -1) { string featureName = dataGridView1.Rows[hittestinfo.RowIndex].Cells["编号"].Value.ToString(); contextMenuStrip1.Show(dataGridView1, e.X, e.Y); featureName = featureName.Trim(); if (geoLayer == null) { return; } GSOFeatures features = geoLayer.GetFeatureByName(featureName, false); for (int j = 0; j < features.Length; j++) { if (features[j].Name == featureName) { m_feature = features[j]; if (m_feature != null && m_feature.HighLight == true) { m_feature.HighLight = false; globeControl1.Globe.Refresh(); } break; } } } } }
public static GSOFeatures Table2Features(DataTable table, string currentQueryLayer, GeoScene.Globe.GSOGlobeControl globeControl1) { GSOFeatures features = new GSOFeatures(); for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; string featureName = row["编号"].ToString(); featureName = featureName.Trim(); GSOLayer layer = globeControl1.Globe.Layers.GetLayerByCaption(currentQueryLayer); GSOFeatures tempfeatures = layer.GetFeatureByName(featureName, false); if (tempfeatures.Length > 0) { features.Add(tempfeatures[0]); } } return(features); }