Пример #1
0
        public void InitializeGestures()
        {
            nui.ElevationAngle = 15;
            comm = new CommunicationManager("9600");
            IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[6];
            WaveLeftSegment1 waveLeftSegment1 = new WaveLeftSegment1();
            WaveLeftSegment2 waveLeftSegment2 = new WaveLeftSegment2();
            waveLeftSegments[0] = waveLeftSegment1;
            waveLeftSegments[1] = waveLeftSegment2;
            waveLeftSegments[2] = waveLeftSegment1;
            waveLeftSegments[3] = waveLeftSegment2;
            waveLeftSegments[4] = waveLeftSegment1;
            waveLeftSegments[5] = waveLeftSegment2;
            this.gestureController.AddGesture(GestureType.WaveLeft, waveLeftSegments);
            IRelativeGestureSegment[] JoinedHandsSegments = new IRelativeGestureSegment[20];
            JoinedHandsSegment1 JoinedHandsSegment = new JoinedHandsSegment1();
            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 10 times
                JoinedHandsSegments[i] = JoinedHandsSegment;
            }
            //JoinedHandsSegment2 JoinedHandsSegment2 = new JoinedHandsSegment2();
            //JoinedHandsSegments[20] = JoinedHandsSegment2;
            this.gestureController.AddGesture(GestureType.JoinedHands, JoinedHandsSegments);

            IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
            swipeUpSegments[0] = new SwipeUpSegment1();
            swipeUpSegments[1] = new SwipeUpSegment2();
            swipeUpSegments[2] = new SwipeUpSegment3();
            gestureController.AddGesture(GestureType.SwipeUp, swipeUpSegments);

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeDownSegment1();
            swipeDownSegments[1] = new SwipeDownSegment2();
            swipeDownSegments[2] = new SwipeDownSegment3();
            gestureController.AddGesture(GestureType.SwipeDown, swipeDownSegments);

            IRelativeGestureSegment[] swipeLeftSegments = new IRelativeGestureSegment[3];
            swipeLeftSegments[0] = new SwipeLeftSegment1();
            swipeLeftSegments[1] = new SwipeLeftSegment2();
            swipeLeftSegments[2] = new SwipeLeftSegment3();
            gestureController.AddGesture(GestureType.SwipeLeft, swipeLeftSegments);

            IRelativeGestureSegment[] swipeRightSegments = new IRelativeGestureSegment[3];
            swipeRightSegments[0] = new SwipeRightSegment1();
            swipeRightSegments[1] = new SwipeRightSegment2();
            swipeRightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture(GestureType.SwipeRight, swipeRightSegments);
            //IRelativeGestureSegment[] raiseHandSegments = new IRelativeGestureSegment[2];
            //RaiseHandSegment1 raiseHandSegment1 = new RaiseHandSegment1();
            //RaiseHandSegment2 raiseHandSegment2 = new RaiseHandSegment2();
            //raiseHandSegments[0]=raiseHandSegment1;
            //raiseHandSegments[1]=raiseHandSegment2;
            //this.gestureController.AddGesture(GestureType.RaiseHand,raiseHandSegments);
        }
Пример #2
0
        public void InitializeGestures()
        {
            nui.ElevationAngle = 15;
            comm = new CommunicationManager("115200");
            IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[6];
            WaveLeftSegment1          waveLeftSegment1 = new WaveLeftSegment1();
            WaveLeftSegment2          waveLeftSegment2 = new WaveLeftSegment2();

            waveLeftSegments[0] = waveLeftSegment1;
            waveLeftSegments[1] = waveLeftSegment2;
            waveLeftSegments[2] = waveLeftSegment1;
            waveLeftSegments[3] = waveLeftSegment2;
            waveLeftSegments[4] = waveLeftSegment1;
            waveLeftSegments[5] = waveLeftSegment2;
            this.gestureController.AddGesture(GestureType.WaveLeft, waveLeftSegments);
            IRelativeGestureSegment[] JoinedHandsSegments = new IRelativeGestureSegment[20];
            JoinedHandsSegment1       JoinedHandsSegment  = new JoinedHandsSegment1();

            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 10 times
                JoinedHandsSegments[i] = JoinedHandsSegment;
            }
            //JoinedHandsSegment2 JoinedHandsSegment2 = new JoinedHandsSegment2();
            //JoinedHandsSegments[20] = JoinedHandsSegment2;
            this.gestureController.AddGesture(GestureType.JoinedHands, JoinedHandsSegments);

            IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
            swipeUpSegments[0] = new SwipeUpSegment1();
            swipeUpSegments[1] = new SwipeUpSegment2();
            swipeUpSegments[2] = new SwipeUpSegment3();
            gestureController.AddGesture(GestureType.SwipeUp, swipeUpSegments);

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeDownSegment1();
            swipeDownSegments[1] = new SwipeDownSegment2();
            swipeDownSegments[2] = new SwipeDownSegment3();
            gestureController.AddGesture(GestureType.SwipeDown, swipeDownSegments);

            IRelativeGestureSegment[] swipeLeftSegments = new IRelativeGestureSegment[3];
            swipeLeftSegments[0] = new SwipeLeftSegment1();
            swipeLeftSegments[1] = new SwipeLeftSegment2();
            swipeLeftSegments[2] = new SwipeLeftSegment3();
            gestureController.AddGesture(GestureType.SwipeLeft, swipeLeftSegments);

            IRelativeGestureSegment[] swipeRightSegments = new IRelativeGestureSegment[3];
            swipeRightSegments[0] = new SwipeRightSegment1();
            swipeRightSegments[1] = new SwipeRightSegment2();
            swipeRightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture(GestureType.SwipeRight, swipeRightSegments);
            IRelativeGestureSegment[] menuSegments = new IRelativeGestureSegment[20];
            MenuSegment1 menuSegment = new MenuSegment1();

            for (int i = 0; i < 20; i++)
            {
                // gesture consists of the same thing 20 times
                menuSegments[i] = menuSegment;
            }
            gestureController.AddGesture(GestureType.Menu, menuSegments);

            IRelativeGestureSegment[] joinedHandsSegments = new IRelativeGestureSegment[10];
            JoinedHandsSegment1       joinedHandsSegment  = new JoinedHandsSegment1();

            for (int i = 0; i < 10; i++)
            {
                // gesture consists of the same thing 10 times
                JoinedHandsSegments[i] = JoinedHandsSegment;
            }
            this.gestureController.AddGesture(GestureType.JoinedHands, JoinedHandsSegments);


            /*IRelativeGestureSegment[] joinedZoom = new IRelativeGestureSegment[13];
             * JoinedHandsSegment1 joinedHandsSegment = new JoinedHandsSegment1();
             * for (int i = 0; i < 10; i++)
             * {
             *  joinedZoom[i] = joinedHandsSegment;
             *  //joinedHandsSegments[i] = joinedHandsSegment;
             * }
             * //this.gestureController.AddGesture(GestureType.JoinedHands, joinedHandsSegments);
             *
             * joinedZoom[10] = new ZoomSegment1();
             * joinedZoom[11] = new ZoomSegment2();
             * joinedZoom[12] = new ZoomSegment3();
             * gestureController.AddGesture(GestureType.JoinedZoom, joinedZoom);
             */

            IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
            zoomOutSegments[0] = new ZoomSegment3();
            zoomOutSegments[1] = new ZoomSegment2();
            zoomOutSegments[2] = new ZoomSegment1();
            gestureController.AddGesture(GestureType.ZoomOut, zoomOutSegments);

            IRelativeGestureSegment[] zoomInSegments = new IRelativeGestureSegment[3];
            zoomInSegments[0] = new ZoomSegment1();
            zoomInSegments[1] = new ZoomSegment2();
            zoomInSegments[2] = new ZoomSegment3();
            gestureController.AddGesture(GestureType.ZoomIn, zoomInSegments);

            gestureController.GestureRecognized += OnGestureRecognized;
        }