using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Data; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmAnalysisGuiHuaResult : Office2007Form { int count; GSOFeature hlfeature; public GSOGlobeControl globleControl1; string layerName; string redLineName; public FrmAnalysisGuiHuaResult(GSOGlobeControl _globleControl1, string _layerName,string _redLineName) { InitializeComponent(); globleControl1 = _globleControl1; layerName = _layerName; redLineName = _redLineName; } private void FrmAnalysisGuiHuaResult_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("图层类型"); dt.Columns.Add("编号"); if (RedLineAnalysisTool.redLineResultList.Count == 0) return; for (int i = 0; i < RedLineAnalysisTool.redLineResultList.Count; i++) { if (RedLineAnalysisTool.redLineResultList[i].LayerName == layerName && RedLineAnalysisTool.redLineResultList[i].RedLineName == redLineName) { addDataToDataTable(dt, RedLineAnalysisTool.redLineResultList[i].LineFeaturesInRedLine); if (RedLineAnalysisTool.redLineResultList[i].PointFeaturesInRedLine != null) addDataToDataTable(dt, RedLineAnalysisTool.redLineResultList[i].PointFeaturesInRedLine); } } dataGridView1.DataSource = dt; dataGridView1.Columns[1].Width = 200; } void addDataToDataTable(DataTable dt,GSOFeatures features) { for (int m = 0; m < features.Length; m++) { DataRow row = dt.NewRow(); row[0] = features[m].Dataset.Caption; row[1] = features[m].Name; dt.Rows.Add(row); } } private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex <= -1) return; string BH = dataGridView1.Rows[e.RowIndex].Cells["编号"].Value.ToString(); GSOLayer gsoLayer = globleControl1.Globe.Layers.GetLayerByCaption(layerName); GSOFeatures rowFeatures = gsoLayer.GetFeatureByName(BH, true); if (rowFeatures.Length == 0) { gsoLayer = globleControl1.Globe.Layers.GetLayerByCaption(layerName + "附属物"); rowFeatures = gsoLayer.GetFeatureByName(BH, true); } GSOFeature feature = rowFeatures[0]; hlfeature = feature; highlight(); globleControl1.Globe.JumpToFeature(feature, 10); } public void highlight() { timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { GSOFeature rowFeature = hlfeature;//as GSOFeature; if (rowFeature == null) return; if (count < 100) { count++; if (rowFeature != null) { if (count%2 != 0) { rowFeature.HighLight = true; globleControl1.Refresh(); } else { rowFeature.HighLight = false; globleControl1.Refresh(); } } } else { timer1.Stop(); rowFeature.HighLight = false; count = 0; } } private void FrmAnalysisGuiHuaResult_FormClosing(object sender, FormClosingEventArgs e) { timer1.Stop(); } } }