middleware/src/Debug/DebugWindow.xaml.cs
changeset 3 92f19af39024
parent 0 6fefd4afe506
child 5 d40f84d77db4
--- a/middleware/src/Debug/DebugWindow.xaml.cs	Fri Mar 09 18:15:12 2012 +0100
+++ b/middleware/src/Debug/DebugWindow.xaml.cs	Thu Mar 15 13:33:21 2012 +0100
@@ -1,5 +1,5 @@
 /*
- * Projet : KINECT PROJECTS
+ * Projet : TraKERS
  * Module : MIDDLEWARE
  * Sous-Module : Debug
  * Classe : DebugWindow
@@ -31,6 +31,8 @@
 
 using Trakers.Tracking;
 using System.Threading;
+using Trakers.Tracking.Events;
+using Trakers.Tracking.Gestures;
 
 namespace Trakers.Debug
 {
@@ -142,6 +144,18 @@
             //Si on a des données dans le tableau et que la kinect est allumée.
             if (receivedData && on)
             {
+                /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel)
+                {
+                    byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]);
+                    gray = Math.Min(gray, colorPixelData[i + 2]);
+                    colorPixelData[i] = gray;
+                    colorPixelData[i + 1] = gray;
+
+                    colorPixelData[i] = colorPixelData[i + 1];
+                    colorPixelData[i + 1] = colorPixelData[i];
+                    colorPixelData[i + 2] = (byte)~colorPixelData[i + 2];
+                }*/
+
                 //On met à jour l'image de la caméra.
                 DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel);
                 DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
@@ -158,7 +172,12 @@
         {
             DistanceLbl.Content = "Distance : " + distance;
 
-            if (distance > 0 && distance < 1)
+            /*R1.Fill = System.Windows.Media.Brushes.Transparent;
+            R2.Fill = System.Windows.Media.Brushes.Transparent;
+            R3.Fill = System.Windows.Media.Brushes.Transparent;
+            R4.Fill = System.Windows.Media.Brushes.Transparent;*/
+
+            /*if (distance > 0 && distance < 1)
             {
                 R1.Fill = System.Windows.Media.Brushes.Red;
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
@@ -185,7 +204,7 @@
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
                 R3.Fill = System.Windows.Media.Brushes.DarkGray;
                 R4.Fill = System.Windows.Media.Brushes.White;
-            }
+            }*/
         }
 
         /*
@@ -262,6 +281,7 @@
             line.Y2 = j2.Position.Y;
             line.StrokeThickness = 8;
             DebugCanvas.Children.Add(line);
+            ExceptionLbl.Content = DebugCanvas.Children.Count;
         }
 
         /*
@@ -307,9 +327,40 @@
             RightHand.Content = coord;
         }
 
-        public void showSwipe()
+        public void showSwipe(SwipeEventArgs e)
+        {
+            if(e.direction == Tracking.Gestures.SwipeDetector.Direction.LEFT)
+                ExceptionLbl.Background = System.Windows.Media.Brushes.Red;
+            else if(e.direction == Tracking.Gestures.SwipeDetector.Direction.RIGHT)
+                ExceptionLbl.Background = System.Windows.Media.Brushes.Purple;
+        }
+
+        public void showPush(PushEventArgs e)
         {
-            ExceptionLbl.Background = System.Windows.Media.Brushes.Red;
+            if (e.direction == Tracking.Gestures.PushDetector.Direction.PUSH)
+            {
+                if(e.hand == Tracking.Gestures.PushDetector.Hand.LEFT)
+                    LeftHand.Background = System.Windows.Media.Brushes.White;
+                else if(e.hand == Tracking.Gestures.PushDetector.Hand.RIGHT)
+                    RightHand.Background = System.Windows.Media.Brushes.White;
+                else
+                {
+                    LeftHand.Background = System.Windows.Media.Brushes.White;
+                    RightHand.Background = System.Windows.Media.Brushes.White;
+                }
+            }
+            else
+            {
+                if (e.hand == Tracking.Gestures.PushDetector.Hand.LEFT)
+                    LeftHand.Background = System.Windows.Media.Brushes.Black;
+                else if (e.hand == Tracking.Gestures.PushDetector.Hand.RIGHT)
+                    RightHand.Background = System.Windows.Media.Brushes.Black;
+                else
+                {
+                    LeftHand.Background = System.Windows.Media.Brushes.Black;
+                    RightHand.Background = System.Windows.Media.Brushes.Black;
+                }
+            }
         }
     }
 }