using System; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Globe; using GeoScene.Data; using GeoScene.Engine; namespace Cyberpipe { public partial class FrmDigPitSetting : Office2007Form { Double m_dDigPitValue = 3; Boolean m_bDigPitByDepth = true; Double m_dDigPitWidthAlongLine = 6; private GSOGlobeControl globeControl; private GSOGeoPolyline3D polyLine = null; public FrmDigPitSetting(GSOGlobeControl _globeControl, GSOGeoPolyline3D _polyLine) { InitializeComponent(); globeControl = _globeControl; polyLine = _polyLine; } /// <summary> /// 窗体初始化事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmDigPitSetting_Load(object sender, EventArgs e) { textBoxValue.Text = m_dDigPitValue.ToString(); textBoxWidthAlongLine.Text = m_dDigPitWidthAlongLine.ToString(); } /// <summary> /// 确定按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX1_Click(object sender, EventArgs e) { if (textBoxValue.Text.Trim() == "" || textBoxWidthAlongLine.Text.Trim() == "") { MessageBox.Show("请输入完整的参数信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information); return; } DigAlongLine(); globeControl.Refresh(); this.Close(); } private void DigAlongLine() { m_dDigPitValue = Convert.ToDouble(textBoxValue.Text); m_dDigPitWidthAlongLine = Convert.ToDouble(textBoxWidthAlongLine.Text); GSOGeoPolygon3D resPolygon = polyLine.CreateBuffer(m_dDigPitWidthAlongLine, false, 0, false, false); GSOGeoPit geoPit = new GSOGeoPit(); geoPit.PitPolygon = resPolygon; if (m_bDigPitByDepth) { geoPit.PitDepth = m_dDigPitValue; geoPit.PitDepthUsing = true; } else { geoPit.PitBottomAlt = m_dDigPitValue; geoPit.PitDepthUsing = false; } globeControl.Globe.AddPit("", geoPit); GSOLayer layerGround = globeControl.Globe.Layers.GetLayerByCaption(Utility.roadLayerName); if (layerGround != null) layerGround.Visible = false; // 清除当前TrackPolygonAnalysis的痕迹 globeControl.Globe.ClearLastTrackPolyline(); } /// <summary> /// 取消事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX2_Click(object sender, EventArgs e) { Close(); } } }