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(); }
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(); }
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); }