public static Gesture_Event_Sorting_Group Detect(List <My_Point> points, Gesture_Controler controler) { List <My_Point> result = new List <My_Point>(); Gesture_Event_Grouping resturedCluster = null; Gesture_Event_Sorting_Group sortingGroupEvent = null; foreach (My_Point p in points) { if (p.Sender is Menu_Sort_Box) { foreach (Gesture_Event gesture in Gesture_List.GestureList) { if (gesture is Gesture_Event_Grouping) { Gesture_Event_Grouping cluster = gesture as Gesture_Event_Grouping; if (cluster.IsGrouping()) { My_Point[] clusterPoints = cluster.Points; if (Enclose_Helper.PNPoly(clusterPoints, p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y)) { resturedCluster = cluster; result.Add(p); foreach (My_Point clusterPoint in clusterPoints) { result.Add(clusterPoint); } My_Point[] argPoints = result.ToArray(); object[] objects = new object[cluster.Senders.Length + 1]; objects[0] = cluster.Points[0].Sender; for (int i = 0; i < cluster.Senders.Length; i++) { objects[i + 1] = cluster.Senders[i]; } sortingGroupEvent = new Gesture_Event_Sorting_Group(); sortingGroupEvent.Points = cluster.Points; Gesture_List.addGesture(sortingGroupEvent); Gesture_SortingGroup_Listener listener = new Gesture_SortingGroup_Listener(controler, sortingGroupEvent); sortingGroupEvent.Register(objects, argPoints); } } } } } } if (resturedCluster != null) { Gesture_List.removeGesture(resturedCluster); controler.Control.MainWindow.GroupingGestureLayer.Remove(resturedCluster); foreach (My_Point p in result) { points.Remove(p); } return(sortingGroupEvent); } return(null); }
public static Gesture_Event_Sorting_Group Detect(List<My_Point> points,Gesture_Controler controler) { List<My_Point> result = new List<My_Point>(); Gesture_Event_Grouping resturedCluster = null; Gesture_Event_Sorting_Group sortingGroupEvent = null; foreach (My_Point p in points) { if (p.Sender is Menu_Sort_Box) { foreach (Gesture_Event gesture in Gesture_List.GestureList) { if (gesture is Gesture_Event_Grouping) { Gesture_Event_Grouping cluster = gesture as Gesture_Event_Grouping; if (cluster.IsGrouping()) { My_Point[] clusterPoints = cluster.Points; if (Enclose_Helper.PNPoly(clusterPoints, p.CurrentPoint.Position.X, p.CurrentPoint.Position.Y)) { resturedCluster = cluster; result.Add(p); foreach (My_Point clusterPoint in clusterPoints) { result.Add(clusterPoint); } My_Point[] argPoints = result.ToArray(); object[] objects = new object[cluster.Senders.Length + 1]; objects[0] = cluster.Points[0].Sender; for (int i = 0; i < cluster.Senders.Length; i++) { objects[i + 1] = cluster.Senders[i]; } sortingGroupEvent = new Gesture_Event_Sorting_Group(); sortingGroupEvent.Points = cluster.Points; Gesture_List.addGesture(sortingGroupEvent); Gesture_SortingGroup_Listener listener = new Gesture_SortingGroup_Listener(controler, sortingGroupEvent); sortingGroupEvent.Register(objects, argPoints); } } } } } } if (resturedCluster != null) { Gesture_List.removeGesture(resturedCluster); controler.Control.MainWindow.GroupingGestureLayer.Remove(resturedCluster); foreach (My_Point p in result) { points.Remove(p); } return sortingGroupEvent; } return null; }