using System; using System.Windows.Forms; using DevComponents.DotNetBar; using GeoScene.Data; using GeoScene.Globe; namespace Cyberpipe { public partial class FrmSetFlytoPos : Office2007Form { GSOGlobeControl globeControl1; static FrmSetFlytoPos frm; public static void ShowForm(GSOGlobeControl globecontrol) { if (frm == null) { frm = new FrmSetFlytoPos(globecontrol); frm.Show(globecontrol.Parent); } else { if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } } } public FrmSetFlytoPos(GSOGlobeControl globecontrol) { InitializeComponent(); globeControl1 = globecontrol; } private void SetLatLonPos_Load(object sender, EventArgs e) { } /// <summary> /// 确定按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { double m_strLon; double m_strLat; double m_strAlt; if (textbox1.Text == "") { MessageBox.Show("经度不能为空!"); return; } bool bl = double.TryParse(textbox1.Text,out m_strLon); if (!bl) { MessageBox.Show("请输入正确的经度!"); textbox1.Text = ""; return; } if (m_strLon > 180 || m_strLon < -180) { MessageBox.Show("请输入正确的经度!"); textbox1.Text = ""; return; } if (textBox2.Text == "") { MessageBox.Show("纬度不能为空!"); return; } bl = double.TryParse(textBox2.Text, out m_strLat); if (!bl) { MessageBox.Show("请输入正确的纬度!"); textBox2.Text = ""; return; } if (m_strLat > 85 || m_strLat < -85) { MessageBox.Show("请输入正确的纬度!"); textBox2.Text = ""; return; } if (textBox3.Text == "") { textBox3.Text = "1000"; } bool bl1 = double.TryParse(textBox3.Text, out m_strAlt); if (!bl1) { MessageBox.Show("请输入正确的高度!"); textBox3.Text = ""; return; } GSOPoint3d point3d = new GSOPoint3d(); point3d.X = m_strLon; point3d.Y = m_strLat; point3d.Z = m_strAlt; globeControl1.Globe.FlyToPosition(point3d, EnumAltitudeMode.RelativeToGround); } /// <summary> /// 窗体关闭事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmSetFlytoPos_FormClosing(object sender, FormClosingEventArgs e) { frm = null; } /// <summary> /// 取消按钮事件处理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX2_Click(object sender, EventArgs e) { Close(); } } }