00001 using System; 00002 using System.Collections.Generic; 00003 using System.ComponentModel; 00004 using System.Data; 00005 using System.Drawing; 00006 using System.Linq; 00007 using System.Text; 00008 using System.Windows.Forms; 00009 using UtmConvert; 00010 00011 namespace system_controller { 00012 public partial class WaypointInserter : Form { 00013 public delegate void waypointInsertEventHandler(); 00014 public event waypointInsertEventHandler waypointInsertEvent; 00015 00016 UtmPoint _pt; 00017 int _pntCnt = 0; 00018 00019 public WaypointInserter(UtmPoint pt, int ptCnt) { 00020 InitializeComponent(); 00021 _pt = new UtmPoint(); 00022 _pt = pt; 00023 _pntCnt = ptCnt; 00024 utmPointPropertyGrid.SelectedObject = _pt; 00025 for (int i = 1; i < _pntCnt; ++i) 00026 pointIndexListBox.Items.Add(i); 00027 pointIndexListBox.SelectedIndex = 0; 00028 this.Text = "Insert Waypoint: " 00029 + Math.Round(_pt.Point.X, 2).ToString() + ", " 00030 + Math.Round(_pt.Point.Y, 2).ToString(); 00031 } 00032 00033 private void insertButton_Click(object sender, EventArgs e) { 00034 if (waypointInsertEvent != null) 00035 waypointInsertEvent.Invoke(); 00036 this.Close(); 00037 } 00038 00039 private void canceBlutton_Click(object sender, EventArgs e) { 00040 this.Close(); 00041 } 00042 00043 public UtmPoint getInsertedWaypoint() { 00044 return _pt; 00045 } 00046 00047 public int getInsertedWaypointIndex() { 00048 return int.Parse(pointIndexListBox.SelectedItem.ToString()); 00049 } 00050 } 00051 }