private void terminateGesture()
        {
            List <Gesture_Event> waitToRemove = new List <Gesture_Event>();

            lock (Gesture_List.GestureList)
            {
                foreach (Gesture_Event gesture in Gesture_List.GestureList)
                {
                    if (gesture.Status == GESTURESTATUS.TERMINATE || gesture.Status == GESTURESTATUS.FAIL)
                    {
                        waitToRemove.Add(gesture);
                    }
                }

                foreach (Gesture_Event gesture in waitToRemove)
                {
                    foreach (My_Point point in gesture.Points)
                    {
                        control.MainWindow.GestureIndicatorLayer.Remove(point.ID);
                        Gesture_List.removeGesture(gesture);
                    }
                }
            }
            waitToRemove.Clear();
        }
Example #2
0
        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);
        }