using System; using System.Collections.Generic; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmFlow : Office2007Form { private GSOGlobeControl globeControl; private GSOLayer layer; List<string> pipelineLayerNames; public FrmFlow(GSOGlobeControl ctl,List<string> pipeLayers) { InitializeComponent(); globeControl = ctl; pipelineLayerNames = pipeLayers; } /// <summary> /// 窗体初始化事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmFlow_Load(object sender, EventArgs e) { cboxLayer.Items.Clear(); for (int i = 0; i < pipelineLayerNames.Count; i++) { cboxLayer.Items.Add(pipelineLayerNames[i]); } } /// <summary> /// 设置管线显示箭头 /// </summary> /// <param name="sender"></param> /// <param name="pipelineNameCN"></param> /* private void Flow(object sender, string pipelineNameCN)//流向 { //if (checkBox1.Checked == true) //{ GSOFeatures feats = layer.GetAllFeatures(); if (feats.Length == 0) return; for (int i = 0; i < feats.Length; i++) { GSOFeature feat = feats[i]; GSOLineStyle3D lineStyle = feat.Geometry.Style as GSOLineStyle3D; if (lineStyle != null) { if (lineStyle.ArrowStyle == null) { lineStyle.ArrowStyle = new GSOArrowStyle(); } lineStyle.ArrowStyle.BodyWidth = 2; lineStyle.ArrowStyle.BodyLen = 6; lineStyle.ArrowStyle.HeadWidth = 8; lineStyle.ArrowStyle.HeadLen = 10; lineStyle.ArrowStyle.OutlineVisible = true; lineStyle.ArrowStyle.OutlineColor = Color.Red; lineStyle.ArrowStyle.Speed = 25; lineStyle.ArrowStyle.Play(); lineStyle.ArrowVisible = true; feat.Geometry.SetModified(true); } } //} globeControl.Globe.Refresh(); } * **/ /// <summary> /// 确定按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OK_Click(object sender, EventArgs e) { if (cboxLayer.SelectedIndex == -1) { MessageBox.Show("请选择管线图层"); return; } // Flow(sender, cboxLayer.SelectedItem.ToString()); NetworkAnalysisTool.FlowDirectionAnalysis(layer); // this.Close(); } /// <summary> /// 下拉框选中项改变事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboxLayer_SelectedIndexChanged(object sender, EventArgs e) { if (cboxLayer.SelectedIndex != -1) { layer = globeControl.Globe.Layers.GetLayerByCaption(cboxLayer.SelectedItem.ToString()); } } /// <summary> /// 取消事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Cancel_Click(object sender, EventArgs e) { Close(); } private void FrmFlow_FormClosed(object sender, FormClosedEventArgs e) { NetworkAnalysisTool.ClearFlowDirectionAnalysis(); } } }