private void btnAddPath_Click(object sender, EventArgs e)
        {
            Path           path = _wpg.PathIntId(_current_intid);
            PolygonGridGUI gui  = new PolygonGridGUI();

            gui.name             = txtPolyPathName.Text;
            gui.video            = radioVideo.Checked;
            gui.startend         = chkRectHome.Checked;
            gui.altitude         = Convert.ToDouble(txtGridAlt.Text);
            gui.heading          = Convert.ToDouble(txtHeading.Text);
            gui.polyname         = _wpg.ShapeWithId(_poly_intid).name;
            gui.poly_internal_id = _poly_intid;
            path.polygridgui     = gui;
            _poly.visible        = false;
            _poly.selected       = false;
            this.Close();
        }
        public DialogAddPolyGridPath(Waypoint_Path_Gen wpg, GMAP gmap, Options options, Path path, double lat, double lon)
        {
            _wpg         = wpg;
            _gmap        = gmap;
            _options     = options;
            _wp          = new WayPoints();
            _lat         = lat;
            _lon         = lon;
            _cam_ang_hor = _options.focal_angle_hor;
            _cam_ang_ver = _options.focal_angle_ver;
            _over_wid    = _options.hor_overlap_percent;
            _over_hgt    = _options.ver_overlap_percent;

            InitializeComponent();

            // Get selected Polygon


            int shape_count = _wpg.ShapeCount();

            for (int i = 0; i < shape_count; i++)
            {
                if (_wpg.ShapeAt(i).selected)
                {
                    _poly_index   = i;
                    _poly_intid   = _wpg.ShapeAt(i).internal_id;
                    _poly         = _wpg.ShapeAt(i);
                    _poly.visible = true;
                    break;
                }
            }

            if (path == null)
            {
                _new_path       = true;
                _first_pass     = true;
                _path           = new Path();
                _path.visible   = true;
                _path.selected  = false;
                _build          = false;
                txtGridAlt.Text = Convert.ToString(_options.def_altitude);
                _build          = true;
            }
            else
            {
                _new_path      = false;
                _path          = path;
                _path.selected = false;
                _current_intid = path.internal_id;
                _build         = false;
                PolygonGridGUI gui = _path.polygridgui;
                txtPolyPathName.Text = gui.name;
                radioVideo.Checked   = gui.video;
                chkRectHome.Checked  = gui.startend;
                txtGridAlt.Text      = Convert.ToString(gui.altitude);
                txtHeading.Text      = Convert.ToString(gui.heading);
                _poly_intid          = gui.poly_internal_id;
                _poly         = _wpg.ShapeWithId(_poly_intid);
                _poly.visible = true;
                _build        = true;
            }
            BuildPolyGridPath();
        }