public override bool Equals(object o2) { if (o2 is UserRegionViewController.State) { UserRegionViewController.State state = (UserRegionViewController.State)o2; return(this.center == state.center && this.size == state.size && this.valid == state.valid); } return(false); }
private void UpdateState(UserRegionViewController.State state) { if (state.Equals(this.lastState)) { return; } TracedScreenPoint[] path = this.GetUserRegion().GetPath(CoordinateSystemUtilities.GetBounds(this.csi, state.center, state.size), state.center.zoom, this.csi); List <TracedScreenPoint> list = new List <TracedScreenPoint>(); int length = path.GetLength(0); for (int i = 0; i < length; i++) { D.Assert(path[i].originalIndex >= 0); int num = (i + length - 1) % length; if (!(path[num].pointf == path[i].pointf)) { list.Add(path[i]); } } list.ToArray(); int count = list.Count; List <UserRegionViewController.ClickableThing> list2 = new List <UserRegionViewController.ClickableThing>(); List <UserRegionViewController.ClickableThing> list3 = new List <UserRegionViewController.ClickableThing>(); for (int j = 0; j < count; j++) { UserRegionViewController.ClickableThing clickableThing = new UserRegionViewController.ClickableThing(); list2.Add(clickableThing); clickableThing.vertexLocation = list[j]; clickableThing.path = new GraphicsPath(); clickableThing.path.AddEllipse(list[j].pointf.X - 4f, list[j].pointf.Y - 4f, 8f, 8f); clickableThing.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Vertex; clickableThing.pointIndex = j; UserRegionViewController.ClickableThing clickableThing2 = new UserRegionViewController.ClickableThing(); list3.Add(clickableThing2); clickableThing2.vertexLocation = list[j]; clickableThing2.path = new GraphicsPath(); clickableThing2.path.AddLine(list[j].pointf, list[(j + 1) % count].pointf); clickableThing2.path.Widen(new Pen(Color.Black, 4f)); clickableThing2.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Segment; clickableThing2.pointIndex = j; } list2.AddRange(list3); this.clickableThings = list2.ToArray(); this.lastState = new UserRegionViewController.State(state); }
private void UpdateState(UserRegionViewController.State state) { if (state.Equals(this.lastState)) { return; } TracedScreenPoint[] path = this.GetUserRegion().GetPath(CoordinateSystemUtilities.GetBounds(this.csi, state.center, state.size), state.center.zoom, this.csi); List<TracedScreenPoint> list = new List<TracedScreenPoint>(); int length = path.GetLength(0); for (int i = 0; i < length; i++) { D.Assert(path[i].originalIndex >= 0); int num = (i + length - 1) % length; if (!(path[num].pointf == path[i].pointf)) { list.Add(path[i]); } } list.ToArray(); int count = list.Count; List<UserRegionViewController.ClickableThing> list2 = new List<UserRegionViewController.ClickableThing>(); List<UserRegionViewController.ClickableThing> list3 = new List<UserRegionViewController.ClickableThing>(); for (int j = 0; j < count; j++) { UserRegionViewController.ClickableThing clickableThing = new UserRegionViewController.ClickableThing(); list2.Add(clickableThing); clickableThing.vertexLocation = list[j]; clickableThing.path = new GraphicsPath(); clickableThing.path.AddEllipse(list[j].pointf.X - 4f, list[j].pointf.Y - 4f, 8f, 8f); clickableThing.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Vertex; clickableThing.pointIndex = j; UserRegionViewController.ClickableThing clickableThing2 = new UserRegionViewController.ClickableThing(); list3.Add(clickableThing2); clickableThing2.vertexLocation = list[j]; clickableThing2.path = new GraphicsPath(); clickableThing2.path.AddLine(list[j].pointf, list[(j + 1) % count].pointf); clickableThing2.path.Widen(new Pen(Color.Black, 4f)); clickableThing2.clickedWhich = UserRegionViewController.ClickableThing.ClickedWhich.Segment; clickableThing2.pointIndex = j; } list2.AddRange(list3); this.clickableThings = list2.ToArray(); this.lastState = new UserRegionViewController.State(state); }
public State(UserRegionViewController.State state) { this.center = state.center; this.size = new Size(state.size.Width, state.size.Height); this.valid = state.valid; }