Exemple #1
0
        public void FinishNotification()
        {
            var distinctHandlers = touchLinks
                                   .SelectMany(g => g.Value)
                                   .Distinct();

            foreach (MonoBehaviour h in distinctHandlers)
            {
                IGestureHandler handler = (IGestureHandler)h;
                handler.FinishNotification();
            }
            RemoveDeadLinks();
        }
Exemple #2
0
        public void UpdateTouch(Touch t)
        {
            if (!touchLinks.ContainsKey(t.fingerId))
            {
                return;
            }

            MonoBehaviour[] gestureHandlers = touchLinks[t.fingerId];

            // Notify all enabled handlers
            foreach (MonoBehaviour h in gestureHandlers)
            {
                IGestureHandler handler = (IGestureHandler)h;
                handler.UpdateTouch(t);
            }
        }
        /// <summary>
        /// Starts the controller and the main part of the application
        /// </summary>
        public void Start()
        {
            //load sensor
            sensor = KinectSensor.GetDefault();

            if (sensor != null)
            {
                sensor.Open();
            }


            _gestureHandler = new APIController();


            //create Handler objects
            this.colorFrameHandler     = new ColorFrameHandler();
            this.fingerTrackingHandler = new FingerTrackingHandler();

            //start handler
            this.colorFrameHandler.Start(this, sensor);
            this.fingerTrackingHandler.Start(this, sensor);

            //enables only the color handler
            this.colorFrameHandler.Enabled     = true;
            this.fingerTrackingHandler.Enabled = false;
            DisplayStatus();

            //add gesture Handlers
            _gestureHandler.SetRightHandClosed(fingerTrackingHandler.Gesture_RightHandClosedGesture);
            _gestureHandler.SetRightHandOpen(fingerTrackingHandler.Gesture_RightHandOpenGesture);
            _gestureHandler.SetRightHandQuicklyClosed(fingerTrackingHandler.Gesture_RightHandQuicklyClosedGesture);
            _gestureHandler.setRightHandQuicklyOpen(fingerTrackingHandler.Gesture_RightHandQuicklyOpenGesture);

            //Add all elements for drwaing paper to a list
            PaperElements = new List <UIElement>();
            PaperElements.Add(this.Ui.Papier);
            PaperElements.Add(this.Ui.Spirale);
            PaperElements.Add(this.Ui.Ecke_rechts_oben);
            PaperElements.Add(this.Ui.Seite_rechts);
            PaperElements.Add(this.Ui.Ecke_rechts_unten);
            PaperElements.Add(this.Ui.Kante_unten);

            this.Ui.color_background.Visibility = System.Windows.Visibility.Hidden;
        }
        /// <summary>
        /// Starts the controller and the main part of the application
        /// </summary>
        public void Start()
        {
            //load sensor
            sensor = KinectSensor.GetDefault();

            if (sensor != null)
            {
                sensor.Open();
            }

            _gestureHandler = new APIController();

            //create Handler objects
            this.colorFrameHandler = new ColorFrameHandler();
            this.fingerTrackingHandler = new FingerTrackingHandler();

            //start handler
            this.colorFrameHandler.Start(this, sensor);
            this.fingerTrackingHandler.Start(this, sensor);

            //enables only the color handler
            this.colorFrameHandler.Enabled = true;
            this.fingerTrackingHandler.Enabled = false;
            DisplayStatus();

            //add gesture Handlers
            _gestureHandler.SetRightHandClosed(fingerTrackingHandler.Gesture_RightHandClosedGesture);
            _gestureHandler.SetRightHandOpen(fingerTrackingHandler.Gesture_RightHandOpenGesture);
            _gestureHandler.SetRightHandQuicklyClosed(fingerTrackingHandler.Gesture_RightHandQuicklyClosedGesture);
            _gestureHandler.setRightHandQuicklyOpen(fingerTrackingHandler.Gesture_RightHandQuicklyOpenGesture);

            //Add all elements for drwaing paper to a list
            PaperElements = new List<UIElement>();
            PaperElements.Add(this.Ui.Papier);
            PaperElements.Add(this.Ui.Spirale);
            PaperElements.Add(this.Ui.Ecke_rechts_oben);
            PaperElements.Add(this.Ui.Seite_rechts);
            PaperElements.Add(this.Ui.Ecke_rechts_unten);
            PaperElements.Add(this.Ui.Kante_unten);

            this.Ui.color_background.Visibility = System.Windows.Visibility.Hidden;
        }