using System; using System.Drawing; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Data; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmCloseValves :Office2007Form { GSOGlobeControl globeControl1; GSOFeatures m_CloseValvesAnalyResFeatures; //ArrayList m_CloseValvesList; /* private static FrmCloseValves form=null; public static FrmCloseValves getForm(GSOGlobeControl globe, GSOFeatures features, ArrayList list) { if (form == null) { form = new FrmCloseValves(globe, features, list); } else { form.m_CloseValvesAnalyResFeatures = features; form.m_CloseValvesList = list; } return form; } * */ public FrmCloseValves(GSOGlobeControl globe, GSOFeatures features) { InitializeComponent(); globeControl1 = globe; m_CloseValvesAnalyResFeatures = features; } /* private FrmCloseValves(GSOGlobeControl globe,GSOFeatures features,ArrayList list) { InitializeComponent(); globeControl1 = globe; m_CloseValvesAnalyResFeatures = features; // m_CloseValvesList = list; } * **/ /// <summary> /// 窗体初始化事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmCloseValves_Load(object sender, EventArgs e) { setLstValvesName(); } public void setLstValvesName() { lstValvesName.Items.Clear(); int ncount = m_CloseValvesAnalyResFeatures.Length; for (int i = 0; i < ncount; i++) { if (m_CloseValvesAnalyResFeatures[i] != null) { lstValvesName.Items.Add(m_CloseValvesAnalyResFeatures[i].Name); } } } /// <summary> /// 列表框双击事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstValvesName_DoubleClick(object sender, EventArgs e) { int i = lstValvesName.SelectedIndex; if (i < 0) { return; } GSOFeature m_CloseValvesAnalyresFeature = m_CloseValvesAnalyResFeatures[i]; globeControl1.Globe.FlyToFeature(m_CloseValvesAnalyresFeature, 1, 45, 5); GSOLabel newLabel = new GSOLabel(); newLabel.Text = "关闭此阀门"; newLabel.Style = new GSOLabelStyle(); newLabel.Style.Opaque = 0.5; newLabel.Style.OutlineColor = Color.Red; newLabel.Style.TractionLineEndPos = new GSOPoint2d(0, 30); newLabel.Style.OutlineWidth = 1; newLabel.Style.TracktionLineWidth = 1; newLabel.Style.BackBeginColor = Color.Orange; newLabel.Style.BackEndColor = Color.PaleGreen; m_CloseValvesAnalyresFeature.Label = newLabel; //m_CloseValvesList.Add(m_CloseValvesAnalyresFeature); globeControl1.Refresh(); } /// <summary> /// 窗体关闭事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmCloseValves_FormClosing(object sender, FormClosingEventArgs e) { NetworkAnalysisTool.ClearValvesAnalysis(); //ClearCloseValvesAnalysis(); //form = null; } /// <summary> /// 清除阀门分析结果 /// </summary> /// /* private void ClearCloseValvesAnalysis() { if (m_CloseValvesAnalyResFeatures != null) { for (int i = 0; i < m_CloseValvesList.Count; i++) { GSOFeature feature = m_CloseValvesList[i] as GSOFeature; feature.Label.Text = ""; } globeControl1.Refresh(); m_CloseValvesAnalyResFeatures = null; m_CloseValvesList = new ArrayList(); } } * */ /// <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_CloseValvesAnalyresFeature = m_CloseValvesAnalyResFeatures[i]; globeControl1.Globe.FlyToFeature(m_CloseValvesAnalyresFeature, 1, 45, 5); 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_CloseValvesAnalyresFeature.Label = newLabel; //m_CloseValvesList.Add(m_CloseValvesAnalyresFeature); globeControl1.Refresh(); } * **/ /* /// <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; } } } string flashflag = ""; * **/ /// <summary> /// 右键菜单高亮按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// / /* private void LightMenu_Click(object sender, EventArgs e) { flashflag = "single"; timer1.Start(); } * */ /* 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_CloseValvesAnalyResFeatures[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; } } * */ } }