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

            gui.name          = path.name;
            gui.video         = radioVideo.Checked;
            gui.startend      = chkRectHome.Checked;
            gui.altitude      = Convert.ToDouble(txtPathAlt.Text);
            gui.heading       = Convert.ToDouble(txtGridRotation.Text);
            gui.length        = Convert.ToDouble(txtGridLength.Text);
            gui.width         = Convert.ToDouble(txtGridWidth.Text);
            gui.single        = chkOnePass.Checked;
            gui.poimode       = chkRectCamPOI.Checked;
            gui.poiname       = cmbRectCamPOI.SelectedText;
            path.rectanglegui = gui;
            _gmap.Delete_gMapPoly(_poly);
            this.Close();
        }
        public DialogAddRectPath(Waypoint_Path_Gen wpg, GMAP gmap, Options options, Path path, double lat, double lon)
        {
            _wp               = new WayPoints();
            _wpg              = wpg;
            _gmap             = gmap;
            _options          = options;
            _lat              = lat;
            _lon              = lon;
            _camera_angle_hor = _options.focal_angle_hor;
            _camera_angle_ver = _options.focal_angle_ver;
            //_overlap_width = over_wid;
            //_overlap_height = over_hgt;
            _overlap_width  = _options.hor_overlap_percent;
            _overlap_height = _options.ver_overlap_percent;
            _poly           = new Shape();

            InitializeComponent();

            // Fill POI combobox
            cmbRectCamPOI.Items.Clear();
            for (int i = 0; i < _wpg.POICount(); i++)
            {
                cmbRectCamPOI.Items.Add(_wpg.POIPointAt(i).name);
            }

            // New or Redefine Path

            if (path == null)
            {
                _new_path        = true;
                _first_pass      = true;
                _path            = new Path();
                _path.visible    = true;
                _path.selected   = false;
                _build           = true;
                txtPathAlt.Text  = Convert.ToString(_options.def_altitude);
                trkRectAlt.Value = Convert.ToInt16(_options.def_altitude);
            }
            else
            {
                _new_path      = false;
                _path          = path;
                _path.selected = false;
                _current_intid = path.internal_id;
                RectanglarGUI gui = _path.rectanglegui;
                _build = false;
                txtRectPathName.Text  = gui.name;
                radioVideo.Checked    = Convert.ToBoolean(gui.video);
                chkRectHome.Checked   = Convert.ToBoolean(gui.startend);
                txtPathAlt.Text       = Convert.ToString(gui.altitude);
                txtGridRotation.Text  = Convert.ToString(gui.heading);
                txtGridLength.Text    = Convert.ToString(gui.length);
                txtGridWidth.Text     = Convert.ToString(gui.width);
                chkOnePass.Checked    = Convert.ToBoolean(gui.single);
                chkRectCamPOI.Checked = Convert.ToBoolean(gui.poimode);
                int index = cmbRectCamPOI.Items.IndexOf(gui.poiname);
                cmbRectCamPOI.SelectedIndex = index;
                _build = true;
            }
            _build = true;
            BuildRectPath();
        }