Пример #1
0
        /// <summary>
        /// Defines the gestures.
        /// </summary>
        private void DefineGestures()
        {
            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[6];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            waveRightSegments[4] = waveRightSegment1;
            waveRightSegments[5] = waveRightSegment2;
            this.gestures.AddGesture(GestureType.WaveRight, waveRightSegments);

            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.gestures.AddGesture(GestureType.WaveLeft, waveLeftSegments);

            IRelativeGestureSegment[] swipeleftSegments = new IRelativeGestureSegment[3];
            swipeleftSegments[0] = new SwipeLeftSegment1();
            swipeleftSegments[1] = new SwipeLeftSegment2();
            swipeleftSegments[2] = new SwipeLeftSegment3();
            this.gestures.AddGesture(GestureType.LeftSwipe, swipeleftSegments);

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            this.gestures.AddGesture(GestureType.RightSwipe, swiperightSegments);

            IRelativeGestureSegment[] menuSegments = new IRelativeGestureSegment[20];
            MenuSegments1             menuSegment  = new MenuSegments1();

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

            this.gestures.AddGesture(GestureType.Menu, menuSegments);
        }
Пример #2
0
        /// <summary>
        /// Helper function to register all available
        /// </summary>
        #region registergestures
        private void RegisterGestures()
        {
            // define the gestures for the demo

            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;
            }
            gestureController.AddGesture("JoinedHands", joinedhandsSegments);

            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("Menu", menuSegments);

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

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture("SwipeRight", swiperightSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[6];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            waveRightSegments[4] = waveRightSegment1;
            waveRightSegments[5] = waveRightSegment2;
            gestureController.AddGesture("WaveRight", waveRightSegments);

            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;
            gestureController.AddGesture("WaveLeft", waveLeftSegments);

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

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

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

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeDownSegment1();
            swipeDownSegments[1] = new SwipeDownSegment2();
            swipeDownSegments[2] = new SwipeDownSegment3();
            gestureController.AddGesture("SwipeDown", swipeDownSegments);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GestureController"/> class.
        /// </summary>
        public GestureController()
        {
            // Define the gestures

            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;
            }
            AddGesture(GestureType.JoinedHands, joinedhandsSegments);

            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;
            }
            AddGesture(GestureType.Menu, menuSegments);

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

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            AddGesture(GestureType.SwipeRight, swiperightSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[6];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            waveRightSegments[4] = waveRightSegment1;
            waveRightSegments[5] = waveRightSegment2;
            AddGesture(GestureType.WaveRight, waveRightSegments);

            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;
            AddGesture(GestureType.WaveLeft, waveLeftSegments);

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

            IRelativeGestureSegment[] zoomOutSegments = new IRelativeGestureSegment[3];
            zoomOutSegments[0] = new ZoomSegment3();
            zoomOutSegments[1] = new ZoomSegment2();
            zoomOutSegments[2] = new ZoomSegment1();
            AddGesture(GestureType.ZoomOut, zoomOutSegments);
        }
        private void AddStatue(Statues name)
        {
            IGestureSegment[] segments = null;
            switch (name)
            {
            case Statues.HandUp:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new HandUpSegment();
                }
                break;

            case Statues.HandRight:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new HandRightSegment();
                }
                break;

            case Statues.HandLeft:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new HandLeftSegment();
                }
                break;

            case Statues.HandBottom:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new HandBottomSegment();
                }
                break;

            case Statues.Reset:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new ResetSegment();
                }
                break;

            case Statues.Jump:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new JumpSegment();
                }
                break;

            case Statues.TurnRight:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new TurnRightSegment();
                }
                break;

            case Statues.TurnLeft:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new TurnLeftSegment();
                }
                break;

            case Statues.OpenRepeat:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new OpenRepeatSegment();
                }
                break;

            case Statues.CloseRepeat:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new CloseRepeatSegment();
                }
                break;

            case Statues.Stop:
                segments = new IGestureSegment[15];
                for (int i = 0; i < 15; i++)
                {
                    segments[i] = new StopSegment();
                }
                break;

            case Statues.GreenFlag:
                segments = new IGestureSegment[15];
                for (int i = 0; i < 15; i++)
                {
                    segments[i] = new GreenFlagSegment();
                }
                break;

            case Statues.Grow:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new GrowSegment();
                }
                break;

            case Statues.Shrink:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new ShrinkSegment();
                }
                break;

            case Statues.ChangeScene:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new ChangeSceneSegment();
                }
                break;

            case Statues.NormalSize:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new NormalSizeSegment();
                }
                break;

            case Statues.Show:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new ShowSegment();
                }
                break;

            case Statues.Hide:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new HideSegment();
                }
                break;

            case Statues.Speed:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new SpeedSegment();
                }
                break;

            case Statues.Wait:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new WaitSegment();
                }
                break;

            case Statues.TouchAnotherSprite:
                segments = new IGestureSegment[NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new TouchAnotherSpriteSegment();
                }
                break;

            case Statues.WaveRight:
                segments = new IGestureSegment[2 * NB_FRAME];
                for (int i = 0; i < NB_FRAME; i++)
                {
                    segments[i] = new WaveRightSegment1();
                }
                for (int i = NB_FRAME; i < 2 * NB_FRAME; i++)
                {
                    segments[i] = new WaveRightSegment2();
                }
                break;

            case Statues.FingerCount:
                segments = new IGestureSegment[20];
                for (int i = 0; i < 20; i++)
                {
                    segments[i] = new FingerCount();
                }
                break;

            default:
                break;
            }

            Gesture gesture = new Gesture(name.ToString(), segments);

            gesture.GestureDetected += OnGestureDetected;

            _gestures.Add(gesture);
        }
        /// <summary>
        /// Adds the specified gesture for recognition.
        /// </summary>
        /// <param name="type">The predefined <see cref="GestureType" />.</param>
        public void AddGesture(GestureType type)
        {
            // Check whether the gesure is already added.
            if (_gestures.Where(g => g.GestureType == type).Count() > 0)
            {
                return;
            }

            IGestureSegment[] segments = null;

            // DEVELOPERS: If you add a new predefined gesture with a new GestureType,
            // simply add the proper segments to the switch statement here.
            switch (type)
            {
            case GestureType.JoinedHands:
                segments = new IGestureSegment[20];

                JoinedHandsSegment1 joinedhandsSegment = new JoinedHandsSegment1();
                for (int i = 0; i < 20; i++)
                {
                    segments[i] = joinedhandsSegment;
                }
                break;

            case GestureType.Menu:
                segments = new IGestureSegment[20];

                MenuSegment1 menuSegment = new MenuSegment1();
                for (int i = 0; i < 20; i++)
                {
                    segments[i] = menuSegment;
                }
                break;

            case GestureType.SwipeDown:
                segments = new IGestureSegment[3];

                segments[0] = new SwipeDownSegment1();
                segments[1] = new SwipeDownSegment2();
                segments[2] = new SwipeDownSegment3();
                break;

            case GestureType.SwipeLeft:
                segments = new IGestureSegment[3];

                segments[0] = new SwipeLeftSegment1();
                segments[1] = new SwipeLeftSegment2();
                segments[2] = new SwipeLeftSegment3();
                break;

            case GestureType.SwipeRight:
                segments = new IGestureSegment[3];

                segments[0] = new SwipeRightSegment1();
                segments[1] = new SwipeRightSegment2();
                segments[2] = new SwipeRightSegment3();
                break;

            case GestureType.SwipeUp:
                segments = new IGestureSegment[3];

                segments[0] = new SwipeUpSegment1();
                segments[1] = new SwipeUpSegment2();
                segments[2] = new SwipeUpSegment3();
                break;

            case GestureType.WaveLeft:
                segments = new IGestureSegment[6];

                WaveLeftSegment1 waveLeftSegment1 = new WaveLeftSegment1();
                WaveLeftSegment2 waveLeftSegment2 = new WaveLeftSegment2();

                segments[0] = waveLeftSegment1;
                segments[1] = waveLeftSegment2;
                segments[2] = waveLeftSegment1;
                segments[3] = waveLeftSegment2;
                segments[4] = waveLeftSegment1;
                segments[5] = waveLeftSegment2;
                break;

            case GestureType.WaveRight:
                segments = new IGestureSegment[6];

                WaveRightSegment1 waveRightSegment1 = new WaveRightSegment1();
                WaveRightSegment2 waveRightSegment2 = new WaveRightSegment2();

                segments[0] = waveRightSegment1;
                segments[1] = waveRightSegment2;
                segments[2] = waveRightSegment1;
                segments[3] = waveRightSegment2;
                segments[4] = waveRightSegment1;
                segments[5] = waveRightSegment2;
                break;

            case GestureType.ZoomIn:
                segments = new IGestureSegment[3];

                segments[0] = new ZoomSegment1();
                segments[1] = new ZoomSegment2();
                segments[2] = new ZoomSegment3();
                break;

            case GestureType.ZoomOut:
                segments = new IGestureSegment[3];

                segments[0] = new ZoomSegment3();
                segments[1] = new ZoomSegment2();
                segments[2] = new ZoomSegment1();
                break;

            default:
                break;
            }

            if (segments != null)
            {
                Gesture gesture = new Gesture(type, segments);
                gesture.GestureRecognized += OnGestureRecognized;

                _gestures.Add(gesture);
            }
        }
Пример #6
0
        private void RegisterGestures()
        {
            IRelativeGestureSegment[] swipeleftSegments = new IRelativeGestureSegment[3];
            swipeleftSegments[0] = new SwipeLeftSegment1();
            swipeleftSegments[1] = new SwipeLeftSegment2();
            swipeleftSegments[2] = new SwipeLeftSegment3();
            gestureController.AddGesture("SwipeLeft", swipeleftSegments);

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture("SwipeRight", swiperightSegments);

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

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

            IRelativeGestureSegment[] swipeUpSegments = new IRelativeGestureSegment[3];
            swipeUpSegments[0] = new SwipeVerticalSegment1();
            swipeUpSegments[1] = new SwipeVerticalSegment2();
            swipeUpSegments[2] = new SwipeVerticalSegment3();
            gestureController.AddGesture("SwipeUp", swipeUpSegments);

            IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            swipeDownSegments[0] = new SwipeVerticalSegment3();
            swipeDownSegments[1] = new SwipeVerticalSegment2();
            swipeDownSegments[2] = new SwipeVerticalSegment1();
            gestureController.AddGesture("SwipeDown", swipeDownSegments);

            IRelativeGestureSegment[] hideWindowSegments = new IRelativeGestureSegment[3];
            hideWindowSegments[0] = new HideWindowSegment1();
            hideWindowSegments[1] = new HideWindowSegment2();
            hideWindowSegments[2] = new HideWindowSegment3();
            gestureController.AddGesture("HideWindow", hideWindowSegments);

            IRelativeGestureSegment[] showWindowSegments = new IRelativeGestureSegment[3];
            showWindowSegments[0] = new HideWindowSegment3();
            showWindowSegments[1] = new HideWindowSegment2();
            showWindowSegments[2] = new HideWindowSegment1();
            gestureController.AddGesture("ShowWindow", showWindowSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[20];
            for (int i = 0; i < 20; i = i + 2)
            {
                if (i % 4 == 0)
                {
                    for (int j = i; j < i + 2; j++)
                    {
                        waveRightSegments[j] = new WaveRightSegment1();
                    }
                }
                else
                {
                    for (int j = i; j < i + 2; j++)
                    {
                        waveRightSegments[j] = new WaveRightSegment2();
                    }
                }
            }
            gestureController.AddGesture("WaveRight", waveRightSegments);
        }
Пример #7
0
        /// <summary>
        /// Helper function to register all available
        /// </summary>
        private void RegisterGestures()
        {
            // define the gestures for the demo

            IRelativeGestureSegment[] clearLeftSegments = new IRelativeGestureSegment[1];
            ClearLeftSegment          clearLeftSegment1 = new ClearLeftSegment();

            clearLeftSegments[0] = clearLeftSegment1;
            m_gestureController.AddGesture("Clear", clearLeftSegments);


            IRelativeGestureSegment[] rightHandSelectSegments = new IRelativeGestureSegment[16];
            RightHandSelectSegment    rightHandSelectSegment  = new RightHandSelectSegment();

            for (int i = 0; i < 16; i++)
            {
                // gesture consists of the same thing 10 times
                rightHandSelectSegments[i] = rightHandSelectSegment;
            }
            m_gestureController.AddGesture("Select", rightHandSelectSegments);

            IRelativeGestureSegment[] moveForwardSegments = new IRelativeGestureSegment[3];
            moveForwardSegments[0] = new MoveForwardSegment();
            moveForwardSegments[1] = new MoveForwardSegment();
            moveForwardSegments[2] = new MoveForwardSegment();
            m_gestureController.AddGesture("MoveForward", moveForwardSegments);

            IRelativeGestureSegment[] moveBackwardSegments = new IRelativeGestureSegment[3];
            moveBackwardSegments[0] = new MoveBackwardSegment();
            moveBackwardSegments[1] = new MoveBackwardSegment();
            moveBackwardSegments[2] = new MoveBackwardSegment();
            m_gestureController.AddGesture("MoveBackward", moveBackwardSegments);

            //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;
            //    }
            //m_gestureController.AddGesture ("JoinedHands", joinedhandsSegments);

            IRelativeGestureSegment[] turnLeftSegments = new IRelativeGestureSegment[10];
            TurnLeftSegment           turnLeftSegment  = new TurnLeftSegment();

            for (int i = 0; i < 10; i++)
            {
                // gesture consists of the same thing 20 times
                turnLeftSegments[i] = turnLeftSegment;
            }
            m_gestureController.AddGesture("TurnLeft", turnLeftSegments);


            IRelativeGestureSegment[] turnRightSegments = new IRelativeGestureSegment[10];
            TurnRightSegment          turnRightSegment  = new TurnRightSegment();

            for (int i = 0; i < 10; i++)
            {
                // gesture consists of the same thing 20 times
                turnRightSegments[i] = turnRightSegment;
            }
            m_gestureController.AddGesture("TurnRight", turnRightSegments);

            //IRelativeGestureSegment[] swipeleftSegments = new IRelativeGestureSegment[3];
            //swipeleftSegments[0] = new SwipeLeftSegment1 ();
            //swipeleftSegments[1] = new SwipeLeftSegment2 ();
            //swipeleftSegments[2] = new SwipeLeftSegment3 ();
            //m_gestureController.AddGesture ("SwipeLeft", swipeleftSegments);

            //IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            //swiperightSegments[0] = new SwipeRightSegment1 ();
            //swiperightSegments[1] = new SwipeRightSegment2 ();
            //swiperightSegments[2] = new SwipeRightSegment3 ();
            //m_gestureController.AddGesture ("SwipeRight", swiperightSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[4];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            m_gestureController.AddGesture("WaveRight", waveRightSegments);

            //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;
            //m_gestureController.AddGesture ("WaveLeft", waveLeftSegments);

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

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

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

            //IRelativeGestureSegment[] swipeDownSegments = new IRelativeGestureSegment[3];
            //swipeDownSegments[0] = new SwipeDownSegment1 ();
            //swipeDownSegments[1] = new SwipeDownSegment2 ();
            //swipeDownSegments[2] = new SwipeDownSegment3 ();
            //m_gestureController.AddGesture ("SwipeDown", swipeDownSegments);
        }
Пример #8
0
        /// <summary>
        /// Helper function to register all available
        /// </summary>
        private void RegisterGestures()
        {
            // define the gestures for the demo
            IRelativeGestureSegment[] mouseClick = new IRelativeGestureSegment[2];
            mouseClick[0] = new MouseClick();
            mouseClick[1] = new MouseClick2();
            gestureController.AddGesture("MouseClick", mouseClick);

            IRelativeGestureSegment[] mouseDownSegments = new IRelativeGestureSegment[2];
            mouseDownSegments[0] = new MouseDown();
            mouseDownSegments[1] = new MouseDown2();
            gestureController.AddGesture("MouseDown", mouseDownSegments);

            IRelativeGestureSegment[] mouseUpSegments = new IRelativeGestureSegment[2];
            mouseUpSegments[0] = new MouseUp();
            mouseUpSegments[1] = new MouseUp2();
            gestureController.AddGesture("MouseUp", mouseUpSegments);

            IRelativeGestureSegment[] handtoear = new IRelativeGestureSegment[50];
            for (int i = 0; i < handtoear.Count(); i++)
            {
                handtoear[i] = new HandToEar();
            }
            gestureController.AddGesture("HandtoEar", handtoear);


            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;
            }
            gestureController.AddGesture("JoinedHands", joinedhandsSegments);

            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("Menu", menuSegments);

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

            IRelativeGestureSegment[] swiperightSegments = new IRelativeGestureSegment[3];
            swiperightSegments[0] = new SwipeRightSegment1();
            swiperightSegments[1] = new SwipeRightSegment2();
            swiperightSegments[2] = new SwipeRightSegment3();
            gestureController.AddGesture("SwipeRight", swiperightSegments);

            IRelativeGestureSegment[] waveRightSegments = new IRelativeGestureSegment[6];
            WaveRightSegment1         waveRightSegment1 = new WaveRightSegment1();
            WaveRightSegment2         waveRightSegment2 = new WaveRightSegment2();

            waveRightSegments[0] = waveRightSegment1;
            waveRightSegments[1] = waveRightSegment2;
            waveRightSegments[2] = waveRightSegment1;
            waveRightSegments[3] = waveRightSegment2;
            waveRightSegments[4] = waveRightSegment1;
            waveRightSegments[5] = waveRightSegment2;
            gestureController.AddGesture("WaveRight", waveRightSegments);

            IRelativeGestureSegment[] waveLeftSegments = new IRelativeGestureSegment[5];
            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;
            gestureController.AddGesture("WaveLeft", waveLeftSegments);

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

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

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

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