コード例 #1
0
 /// <summary>
 /// Handles the GestureRecognized event of the g control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="KinectSkeltonTracker.GestureEventArgs"/> instance containing the event data.</param>
 //private void Gesture_GestureRecognized(object sender, GestureEventArgs e)
 private void OnGestureRecognized(object sender, GestureEventArgs e)
 {
     if (this.GestureRecognized != null)
     {
         this.GestureRecognized(this, e);
     }
 }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Gesture event arguments.</param>
        private void OnGestureRecognized(object sender, GestureEventArgs e)
        {
            Debug.WriteLine(e.GestureType);

            switch (e.GestureType)
            {
                case GestureType.HandCloseOrOpen:
                    //Gesture = "HandCloseOrOpen";
                    break;
                case GestureType.MenuIn:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MenuIn);
                    Gesture = "MenuIn";
                    break;
                case GestureType.MenuOut:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MenuOut);
                    Gesture = "MenuOut";
                    break;
                case GestureType.MoveDown:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveDown);
                    Gesture = "MoveDown";
                    break;
                case GestureType.MoveIn:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveIn);
                    Gesture = "MoveIn";
                    break;
                case GestureType.MoveLeft:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveLeft);
                    Gesture = "MoveLeft";
                    break;
                case GestureType.MoveOut:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveOut);
                    Gesture = "MoveOut";
                    break;
                case GestureType.MoveRight:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveRight);
                    Gesture = "MoveRight";
                    break;
                case GestureType.MoveUp:
                    drawingController.SendSingle(DrawingEnumTypes.Movement.MoveUp);
                    Gesture = "MoveUp";
                    break;
                case GestureType.HeadMoved:
                    Gesture = "HeadMoved: new position(" + e.GestureStatus.headPoint.X + "," + (e.GestureStatus.headPoint.Y + 0.2) + "," + e.GestureStatus.headPoint.Z + ")";
                    drawingStatus.eye.x = - e.GestureStatus.headPoint.Z;
                    drawingStatus.eye.y = e.GestureStatus.headPoint.Y;
                    drawingStatus.eye.z = e.GestureStatus.headPoint.X;

                    drawingController.ChangeStatus(drawingStatus);

                    this.txtEyex.Text = e.GestureStatus.headPoint.X + "";
                    this.txtEyey.Text = e.GestureStatus.headPoint.Y + "";
                    this.txtEyez.Text = e.GestureStatus.headPoint.Z + "";
                    this.txtKinectx.Text = "0";
                    this.txtKinecty.Text = "0.2";
                    this.txtKinectz.Text = "0";
                    //dt.SetLookat(e.GestureStatus.headPoint.X, e.GestureStatus.headPoint.Y+2, e.GestureStatus.headPoint.Z);
                    break;
                default:
                    break;
            }

            End.Text = Gesture;
        }