private void btnCancel_Click(object sender, EventArgs e)
 {
     _wpg.DeletePath(_path);
     GMAPTree.Update_GMapTree(_wpg, _treeview);
     _gmap.ReDrawgMap();
     this.Close();
 }
 private void bnCancelAddCircPath_Click(object sender, EventArgs e)
 {
     if (_new_path)
     {
         _wpg.DeletePath(_path);
     }
     _gmap.ReDrawgMap();
     this.Close();
 }
Esempio n. 3
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (_current_path_index != -1)
     {
         _wpg.DeletePath(_wpg.PathAt(_current_path_index));
     }
     _current_path_index = -1;
     _gmap.ReDrawgMap();
     this.Close();
 }
Esempio n. 4
0
 private void btnAcceptChange_Click(object sender, EventArgs e)
 {
     _poly.name = txtPolyName.Text;
     GMAPTree.Update_GMapTree(_wpg, _treeview);
     _gmap.ReDrawgMap();
     this.Close();
 }
 private void button1_Click(object sender, EventArgs e)
 {
     _path.name = txtPathName.Text;
     _path.type = txtPathType.Text;
     GMAPTree.Update_GMapTree(_wpg, _treeview);
     _gmap.ReDrawgMap();
     this.Close();
 }
Esempio n. 6
0
        public DialogAddHelixPath(Waypoint_Path_Gen wpg, GMAP gmap, Path path, double lat, double lon)
        {
            _wp   = new WayPoints();
            _wpg  = wpg;
            _gmap = gmap;
            _lat  = lat;
            _lon  = lon;

            InitializeComponent();

            if (path == null)
            {
                _new_path     = true;
                _first_pass   = true;
                _path         = new Path();
                _path.visible = true;
                _build        = true;
            }
            else
            {
                _new_path   = false;
                _first_pass = false;
                _build      = false;
                _path       = path;
                HelicalGUI gui = _path.helixgui;
                txtAddHelixPathName.Text = gui.name;
                _lat = gui.lat;
                _lon = gui.lon;
                txtHelixStartAlt.Text    = Convert.ToString(gui.start_alt);
                txtHelixEndAlt.Text      = Convert.ToString(gui.end_alt);
                txtHelixStartRadius.Text = Convert.ToString(gui.start_rad);
                txtHelixEndRadius.Text   = Convert.ToString(gui.end_rad);
                txtHelixStartAngle.Text  = Convert.ToString(gui.start_angle);
                txtHelixSpan.Text        = Convert.ToString(gui.helix_span);
                txtHelixNumPoints.Text   = Convert.ToString(gui.num_points);
                chkHelicalHome.Checked   = gui.startend;
                chkHelixPOI.Checked      = gui.poimode;
                cmbHelixPOI.SelectedText = gui.poiname;
                _build         = true;
                _path.selected = false;
            }

            buildHelicalPath();

            _gmap.ReDrawgMap();
            //_current_path_index = _wpg.PathCount() - 1;
            cmbHelixPOI.Items.Clear();
            for (int i = 0; i < _wpg.POICount(); i++)
            {
                cmbHelixPOI.Items.Add(_wpg.POIPointAt(i).name);
            }
        }
        public DialogManualPath(Waypoint_Path_Gen wpg, GMAP gmap, TreeView treeview, Path path, Options options, double lat, double lon)
        {
            _wpg            = wpg;
            _gmap           = gmap;
            _treeview       = treeview;
            _options        = options;
            _path           = path;
            _lat            = lat;
            _lon            = lon;
            int[,] _actions = new int[, ] {
                { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }
            };


            InitializeComponent();

            // Create new Path with a Single Waypoint

            _alt = _options.def_altitude;

            _handler_off           = true;
            txtManualAltitude.Text = Convert.ToString(_alt);
            _handler_off           = false;
            string name = txtPathName.Text;

            _path.name     = name;;
            _path.type     = "Manual";
            _path.visible  = true;
            _path.selected = true;
            _wp_list       = new LinkedList <WayPoints>();
            _wp            = new WayPoints();
            _wp.lat        = _lat;
            _wp.lon        = _lon;
            _wp.visible    = true;
            _wp.selected   = false;
            _wp.head       = 0;
            _wp.alt        = _alt;
            _wp.actions    = _actions;
            _wp_list.AddLast(_wp);
            _wp_list.AddLast(_wp);
            _path.waypoints = _wp_list;
            _wpg.AddPath(_path);


            GMAPTree.Update_GMapTree(_wpg, _treeview);
            _gmap.ReDrawgMap();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            POIPoints pnt = new POIPoints();

            pnt.name     = txtPOIName.Text;
            pnt.lat      = Convert.ToDouble(txtPOILatitude.Text);
            pnt.lon      = Convert.ToDouble(txtPOILongitude.Text);
            pnt.elev     = Convert.ToDouble(txtPOIElevation.Text);
            pnt.alt      = Convert.ToDouble(txtPOIAltitude.Text);
            pnt.cam_alt  = Convert.ToDouble(txtPOICameraAlt.Text);
            pnt.visible  = true;
            pnt.selected = true;
            _wpg.ReplacePOI(_poi_index, pnt);
            GMAPTree.Update_GMapTree(_wpg, _treeview);
            _gmap.ReDrawgMap();
            this.Close();
        }
        private void btnAccept_Click(object sender, EventArgs e)
        {
            _wp.alt         = Convert.ToDouble(txtwpalt.Text);
            _wp.head        = Convert.ToDouble(txtwphead.Text);
            _wp.curvesize   = Convert.ToDouble(txtwpcurvesize.Text);
            _wp.rotationdir = Convert.ToDouble(txtwprotdirection.Text);
            _wp.gimblemode  = Convert.ToInt16(txtwpgimblemode.Text);
            _wp.gimblepitch = Convert.ToDouble(txtgimblepitch.Text);
            int action_id = cmbActions.SelectedIndex;

            Models.Action action = _wpg.ActionAt(action_id);
            string        name   = action.name;

            int[,] actions = action.actions;
            _wp.actions    = actions;
            _gmap.ReDrawgMap();
            this.Close();
        }
        private void BuildKMLPath()
        {
            // Create Path

            if (_current_path_index != -1)
            {
                _wpg.DeletePath(_wpg.PathAt(_current_path_index));
            }

            string path_name = txtKMLName.Text;

            if (path_name == "")
            {
                path_name = _kml_filename;
            }

            LinkedList <WayPoints> wp_list = new LinkedList <WayPoints>();

            double lat, lon, alt;
            int    gimblemode  = 0;
            double gimblepitch = 0;
            double curvesize   = 0;
            double rotdir      = 0;

            int[,] actions = new int[, ] {
                { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }
            };

            LinkedList <WayPoints> new_list = new LinkedList <WayPoints>();

            /* Generate Waypoints for each coordinate */

            for (int i = 0; i < _kml_point_count; i++)
            {
                lat = _kml_points[i, 0];
                lon = _kml_points[i, 1];
                alt = _kml_points[i, 2];
                double heading = 0.0;
                double poi_lat = 0;
                double poi_lon = 0;

                /* Calculate Heading for each Waypoint */
                if (chKLMPOI.Checked)
                {
                    int poi_index = cmbKLMPOI.SelectedIndex;
                    if (poi_index == -1)
                    {
                        poi_lat = _lat;
                        poi_lon = _lon;
                    }
                    else
                    {
                        POIPoints tmp_point = _wpg.POIPointAt(poi_index);
                        poi_lat = tmp_point.lat;
                        poi_lon = tmp_point.lon;
                    }
                    heading    = GPS.GPS_Bearing(lat, lon, poi_lat, poi_lon);
                    gimblemode = 2;
                    double distance = GPS.GPS_Distance(lat, lon, poi_lat, poi_lon, Form1.Globals.gps_radius);
                    gimblepitch = -GPS.RadiansToDegrees(Math.Atan(alt / distance));
                    gimblemode  = 2;
                }
                else
                {
                    if (i != _kml_point_count - 1)
                    {
                        double lat_next = _kml_points[i + 1, 0];
                        double lon_next = _kml_points[i + 1, 1];
                        heading = GPS.GPS_Bearing(lat, lon, lat_next, lon_next);
                    }
                }
                _wp.Add_Waypoint_List(new_list, lat, lon, alt, heading, curvesize, rotdir, gimblemode, gimblepitch, actions);
                //dgvWaypoints.Rows.Add(Globals.waypoint_count + i+1, Convert.ToString(lat), Convert.ToString(lon), Convert.ToString(alt));
            }

            _path.Add_Path(_wpg, _gmap, path_name, "KML", new_list);
            int index = _wpg.PathCount() - 1;

            _current_path_index = index;

            Models.Path path          = _wpg.PathAt(index);
            string      exist_type    = path.type;
            bool        exist_select  = path.selected;
            bool        exist_visible = path.visible;

            if (exist_type == "KML")
            {
                _wpg.ChangePathWP(index, new_list);
                string pathname = path.name;
                int    id       = path.id;
                string type     = path.type;
                _gmap.Delete_gMapPath(path);
                Models.Path newpath = new Models.Path();
                newpath.name      = pathname;
                newpath.id        = id;
                newpath.type      = type;
                newpath.selected  = exist_select;
                newpath.visible   = exist_visible;
                newpath.waypoints = new_list;
                _gmap.Add_gMapPath(path, false);
            }

            _gmap.ReDrawgMap();
            GMAPTree.Update_GMapTree(_wpg, _treeview);
        }
 private void btnClose_Click(object sender, EventArgs e)
 {
     _gmap.ReDrawgMap();
     this.Close();
 }