using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using GeoScene.Globe; using GeoScene.Data; using System.Collections; using System.IO; namespace Cyberpipe { public partial class FrmBoosterValvers : DevComponents.DotNetBar.Office2007Form { GSOGlobeControl globeControl1; GSOFeatures m_BoosterValvesAnalyResFeatures; ArrayList m_BoosterValvesList; private static FrmBoosterValvers form = null; GSOFeatures m_AffectedPipeLines; public static FrmBoosterValvers getForm(GSOGlobeControl globe, GSOFeatures features, ArrayList list, GSOFeatures m_AffectedPipeLines1) { if (form == null) { form = new FrmBoosterValvers(globe, features, list, m_AffectedPipeLines1); } else { form.m_BoosterValvesAnalyResFeatures = features; form.m_BoosterValvesList = list; form.m_AffectedPipeLines = m_AffectedPipeLines1; } return form; } public FrmBoosterValvers(GSOGlobeControl globe, GSOFeatures features, ArrayList list,GSOFeatures m_AffectedPipeLines1) { InitializeComponent(); globeControl1 = globe; m_BoosterValvesAnalyResFeatures = features; m_BoosterValvesList = list; m_AffectedPipeLines = m_AffectedPipeLines1; } private void ClearAffectedPipeLine() { if (m_AffectedPipeLines != null) { int nCount = m_AffectedPipeLines.Length; for (int i = 0; i < nCount; i++) { m_AffectedPipeLines[i].HighLight = false; } m_AffectedPipeLines = null; } } public void setLstValvesName() { lstValvesName.Items.Clear(); int ncount = m_BoosterValvesAnalyResFeatures.Length; if (ncount > 0) { for (int i = 0; i < ncount; i++) { lstValvesName.Items.Add(m_BoosterValvesAnalyResFeatures[i].Name); } } } /// <summary> /// 列表项双击事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstValvesName_MouseDoubleClick(object sender, MouseEventArgs e) { int i = this.lstValvesName.SelectedIndex; if (i < 0) { return; } GSOFeature m_BoosterValvesAnalyResFeature = m_BoosterValvesAnalyResFeatures[i]; globeControl1.Globe.FlyToFeature(m_BoosterValvesAnalyResFeature, 0, 45, 3); GSOLabel newLabel = new GSOLabel(); newLabel.Text = "关闭此阀门"; newLabel.Style = new GSOLabelStyle(); newLabel.Style.Opaque = 0.8; newLabel.Style.OutlineColor = Color.Red; //newLabel.Style.TractionLineEndPos = new GSOPoint2d(150, 120); newLabel.Style.OutlineWidth = 1; newLabel.Style.TracktionLineWidth = 1; newLabel.Style.BackBeginColor = Color.Orange; newLabel.Style.BackEndColor = Color.PaleGreen; m_BoosterValvesAnalyResFeature.Label = newLabel; m_BoosterValvesList.Add(m_BoosterValvesAnalyResFeature); globeControl1.Refresh(); } /// <summary> /// 清除阀门结果 /// </summary> private void ClearBoosterValvesAnalysis()//清楚阀门分析结果 { if (m_BoosterValvesAnalyResFeatures != null) { for (int i = 0; i < m_BoosterValvesList.Count; i++) { GSOFeature feature = m_BoosterValvesList[i] as GSOFeature; feature.Label.Text = ""; } globeControl1.Refresh(); m_BoosterValvesAnalyResFeatures = null; m_BoosterValvesList = new ArrayList(); } } /// <summary> /// 窗体关闭事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmBoosterValvers_FormClosing(object sender, FormClosingEventArgs e) { ClearBoosterValvesAnalysis(); ClearAffectedPipeLine(); form = null; } /// <summary> /// 右键飞行按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FlyToMenu_Click(object sender, EventArgs e) { int i = this.lstValvesName.SelectedIndex; if (i < 0) { return; } GSOFeature m_BoosterValvesAnalyresFeature = m_BoosterValvesAnalyResFeatures[i]; globeControl1.Globe.FlyToFeature(m_BoosterValvesAnalyresFeature, 0, 45, 3); LightMenu_Click(sender, e); GSOLabel newLabel = new GSOLabel(); newLabel.Text = "关闭此阀门"; newLabel.Style = new GSOLabelStyle(); newLabel.Style.Opaque = 0.8; newLabel.Style.OutlineColor = Color.Red; //newLabel.Style.TractionLineEndPos = new GSOPoint2d(150, 120); newLabel.Style.OutlineWidth = 1; newLabel.Style.TracktionLineWidth = 1; newLabel.Style.BackBeginColor = Color.Orange; newLabel.Style.BackEndColor = Color.PaleGreen; m_BoosterValvesAnalyresFeature.Label = newLabel; m_BoosterValvesList.Add(m_BoosterValvesAnalyresFeature); globeControl1.Refresh(); } string flashflag = ""; /// <summary> /// 右键高亮按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LightMenu_Click(object sender, EventArgs e) { flashflag = "single"; timer1.Start(); } /// <summary> /// 列表项右键单击事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstValvesName_MouseDown(object sender, MouseEventArgs e) { int i = this.lstValvesName.SelectedIndex; if (i < 0) { return; } if (e.Button == MouseButtons.Right) { lstValvesName.ContextMenuStrip = contextMenuStrip1; foreach (ToolStripItem item in contextMenuStrip1.Items) { item.Visible = true; } } } int count=0; /// <summary> /// 定时器事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer1_Tick(object sender, EventArgs e) { int i = this.lstValvesName.SelectedIndex; if (i < 0) { return; } GSOFeature m_feature = m_BoosterValvesAnalyResFeatures[i]; if (count < 40) { count++; if (flashflag == "single") { if (m_feature != null) { if (count % 2 != 0) { m_feature.HighLight = true; globeControl1.Refresh(); } else { m_feature.HighLight = false; globeControl1.Refresh(); } } } else if (flashflag == "all") { } } else { timer1.Stop(); count = 0; } } } }