public void RebuildUI() { INodes.Clear(); IPath.Clear(); SetView.Nodes[0].Nodes.Clear(); foreach (var s in InImages) { SetView.Nodes[0].Nodes.Add(s.Name + "[" + s.Imgs.Count + "]"); foreach (var i in s.Imgs) { var nn = SetView.Nodes[0].Nodes[SetView.Nodes[0].Nodes.Count - 1].Nodes.Add("F:" + i.Name); INodes.Add(nn); IPath.Add(nn, i); } } SetView.Nodes[1].Nodes.Clear(); foreach (var s in OutImages) { SetView.Nodes[1].Nodes.Add(s.Name + "[" + s.Imgs.Count + "]"); foreach (var i in s.Imgs) { var nn = SetView.Nodes[1].Nodes[SetView.Nodes[1].Nodes.Count - 1].Nodes.Add("F:" + i.Name); ONodes.Add(nn); OPath.Add(nn, i); } } }
/// <summary> /// Update list of points to reach /// </summary> public bool UpdateWaypoints(IPath waypoints) { lock (plannerLock) { //If the new user path is the same as the old one, ignore it if (!PathUtils.CheckPathsEqual(waypoints, userDefinedPath)) { userDefinedPath.Clear(); activeWaypoints.Clear(); userWaypoints.Clear(); //Add the beginning of the path as a new node userWaypoints.Add(new SimpleTreeNode <Vector2>(waypoints.StartPoint.pt)); foreach (IPathSegment segment in waypoints) { userDefinedPath.Add(segment); //If the segment has the same start and endpoints ignore it, this deals with the case where //the HRI outputs a single segment with identical start and endpoints. if (segment.StartPoint.pt != segment.EndPoint.pt) { userWaypoints.Add(new SimpleTreeNode <Vector2>(segment.EndPoint.pt)); } } //If there is a new user path, then the last planned path is now invalid and should be reset to empty //until a new planning loop is finished UpdateLastPath(new List <SimpleTreeNode <Vector2> >()); } } return(false); }