public void Insert_Waypoint_List(Waypoint_Path_Gen wpg, double lat, double lon, bool before) { // Find Selected WP for (int path_id = 0; path_id < wpg.PathCount(); path_id++) { Path path = wpg.PathAt(path_id); LinkedList <WayPoints> wp_list = path.waypoints; LinkedListNode <WayPoints> node = wp_list.First; LinkedListNode <WayPoints> next_node; while (node != null) { next_node = node.Next; if (node.Value.selected) { WayPoints wp_new = new WayPoints(); wp_new.lat = lat; wp_new.lon = lon; wp_new.alt = node.Value.alt; wp_new.head = node.Value.head; wp_new.curvesize = node.Value.curvesize; wp_new.rotationdir = node.Value.rotationdir; wp_new.gimblemode = node.Value.gimblemode; wp_new.gimblepitch = node.Value.gimblepitch; wp_new.actions = node.Value.actions; wp_new.selected = true; wp_new.visible = true; wp_new.path_int_id = path.internal_id; if (before) { wp_list.AddBefore(node, wp_new); } else { wp_list.AddAfter(node, wp_new); } node.Value.selected = false; return; } node = next_node; } } }
public static void Update_GMapTree(Waypoint_Path_Gen _wpg, TreeView _tregmap) { // Add POI Items POIPoints pnt; Models.Path path; Models.Shape shape; _tregmap.Nodes.Clear(); TreeNode tNode; tNode = _tregmap.Nodes.Add("Objects"); _tregmap.Nodes[0].Nodes.Add("POIs"); _tregmap.Nodes[0].Nodes.Add("Paths"); _tregmap.Nodes[0].Nodes.Add("Polygons"); for (int i = 0; i < _wpg.POICount(); i++) { pnt = _wpg.POIPointAt(i); _tregmap.Nodes[0].Nodes[0].Nodes.Add(pnt.name); _tregmap.Nodes[0].Nodes[0].Nodes[i].Tag = i; _tregmap.Nodes[0].Nodes[0].Nodes[i].Checked = pnt.visible; } for (int i = 0; i < _wpg.PathCount(); i++) { path = _wpg.PathAt(i); _tregmap.Nodes[0].Nodes[1].Nodes.Add(path.name); _tregmap.Nodes[0].Nodes[1].Nodes[i].Tag = i; _tregmap.Nodes[0].Nodes[1].Nodes[i].Checked = path.visible; } for (int i = 0; i < _wpg.ShapeCount(); i++) { shape = _wpg.ShapeAt(i); _tregmap.Nodes[0].Nodes[2].Nodes.Add(shape.name); _tregmap.Nodes[0].Nodes[2].Nodes[i].Tag = i; _tregmap.Nodes[0].Nodes[2].Nodes[i].Checked = shape.visible; } }