Documentations (readme)
authorbastiena
Mon, 19 Mar 2012 10:21:56 +0100
changeset 5 d40f84d77db4
parent 4 f4e52a4c34b3
child 6 93dfb08dcc97
Documentations (readme) Installer Deletion of useless comments and code lines
.hgignore
front_processing/doc/readme.txt
front_processing/src/Trakers/Trakers.pde
middleware/dist/TraKERS.iss
middleware/doc/readme.txt
middleware/src/App.config
middleware/src/Communication/Server.cs
middleware/src/Debug/DebugParameters.xaml
middleware/src/Debug/DebugParameters.xaml.cs
middleware/src/Debug/DebugWindow.xaml
middleware/src/Debug/DebugWindow.xaml.cs
middleware/src/Properties/Resources.Designer.cs
middleware/src/Properties/Resources.resx
middleware/src/Tracking/Events/PushListener.cs
middleware/src/Tracking/Gestures/GestureDetector.cs
middleware/src/Tracking/Gestures/JumpDetector.cs
middleware/src/Tracking/Gestures/PushDetector.cs
middleware/src/Tracking/Gestures/SwipeDetector.cs
middleware/src/Tracking/KinectMain.cs
middleware/src/Trakers.csproj
--- a/.hgignore	Thu Mar 15 13:35:25 2012 +0100
+++ b/.hgignore	Mon Mar 19 10:21:56 2012 +0100
@@ -6,3 +6,10 @@
 front_processing/src/Trakers_gestures/code/*
 front_processing/src/Trakers/code/*
 front_processing/extern/TUIO_PROCESSING/library/*
+front_processing/extern/TUIO_JAVA/TuioDemo.jar
+front_processing/extern/TUIO_JAVA/libTUIO.jar
+front_processing/src/Trakers/application.windows/lib/*
+front_processing/src/Trakers_gestures/application.windows/lib/*
+middleware/dist/Output/*
+front_processing/src/Trakers_gestures/application.windows/Trakers_gestures.exe
+front_processing/src/Trakers/application.windows/Trakers.exe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/front_processing/doc/readme.txt	Mon Mar 19 10:21:56 2012 +0100
@@ -0,0 +1,95 @@
+TraKERS (Tracking using Kinect and Extracting Robust Skeletons) est une interface basée sur la détection de gestures / positions du squelette envoyé par le SDK Microsoft (1.0) de Kinect.
+
+Auteur : Alexandre BASTIEN.
+
+I) TraKERS - Eléments requis :
+
+Dans cette partie, il vous faudra installer Processing, disponible ici : http://processing.org/download/
+
+Vous les trouverez ici si vous le souhaitez : http://www.microsoft.com/en-us/kinectforwindows/develop/release-notes.aspx
+
+II) TraKERS - Structure :
+
+Dans le Front, se trouvent deux exécutables "Trakers" et "Trakers_gestures", respectivement pour le tracé de courbes via les coordonnées des positions des mains récupérées du Middleware et pour l'affichage des gestes détectés. Il aurait été possible de les rassembler en un programme, mais pour des raisons de clarté lors de l'utilisation, j'ai préféré procéder ainsi.
+
+III) TraKERS - Utilisation :
+
+Si le Middleware est lancé, le programme de Front lancé fait office de client, et récupère les notifications envoyées. Détaillons les deux programmes :
+
+A) Trakers
+Comme indiqué plus haut, il reçoit et affiche les coordonnées des mains entrant dans le champ délimité par le Middleware.
+Afin d'indiquer les limites de zone de dessin, un masque noir a été appliqué, et se met à jour.
+Les notifications du client s'affichent en blanc en haut du masque, et indique si une ou deux mains sont détectées.
+Lorsque l'on dessine, une série d'ellipses apparaissent à l'écran, formant des courbes.
+Lorsque deux mains sont détectées, la gauche est rouge et l'autre verte.
+Si une main et une seule est détectée, la courbe sera rouge.
+Si la ou les mains s'approchent et atteignent une certaine proximité, le segment dessiné deviendra bleu à partir de ce moment-là.
+
+B) Trakers_gestures
+Le même masque a été appliqué dans ce programme d'affichage de notifications de gestes indiqués par le Middleware.
+Le programme indique simplement dans la partie supérieure du masque s'il détecte ou non une gesture, et s'il en détecte une, donne le code envoyé par le Middleware.
+
+IV) Fonctionnement :
+
+Les programmes sont découpés en fonctions, afin de rendre leur structure plus cohérente.
+
+Il existe deux fonctions principales sous Processing.
+void setup(), qui permet d'initialiser des variables, la taille de la fenêtre, etc.
+void draw(), qui est raffraichie constamment et sert principalement à dessiner ou faire appel aux fonctions amenées à être appelées toutes les N ms.
+Il est bien entendu possible de dessiner via des fonctions déjà implémentées et prêtes à l'emploi, dont la documentation se trouve ici :
+
+http://processing.org/reference/
+
+Ils reçoivent des messages OSC de la part du Middleware. Ceux-ci sont contenus dans des objets qui sont des TuioCursors (en 3D) pour gérer la position des mains et des TuioStrings (objets personnalisés, ajoutés aux dll client et serveur TUIO).
+
+Dans les programmes, les curseurs 3D sont principalement utilisés pour transmettre les coordonnées X, Y et Z (X et Y étant des pixels, et Z une distance en mètres). Les strings, quant à eux, ne véhiculent que de simples messages textuels.
+
+Ils sont envoyés par des listes présentes dans le client TUIO.
+
+Voici un bout de code expliquant comment obtenir la position des mains :
+
+TuioProcessing tuioClient;
+tuioClient = new TuioProcessing(host, port; //host pourrait être this par défaut et port le numéro du port au format int.
+//On récupère les curseurs.
+Vector tuioCursorList = tuioClient.getTuioCursors();
+//Si aucune main n'est repérée.
+if(tuioCursorList.size() <= 0)
+{
+	//fonction_1();
+}
+//Si une main est repérée.
+else if (tuioCursorList.size() == 1)
+{
+	TuioCursor cursor = (TuioCursor)tuioCursorList.elementAt(0);
+	//fonctionAffiche1Main(cursor);
+}
+//Si c'est les 2.
+else if(tuioCursorList.size() == 2)
+{
+	//fonctionAffiche2Mains(tuioCursorList);
+}
+
+Voici à présent comment extraire les positions d'une main, via un tuioCursor :
+
+//On obtient la liste des points (déplacements) du curseur TUIO.
+Vector pointList = cursor.getPath();
+for (int j=0;j<pointList.size();j++)
+{
+	//On prend chaque point pour les afficher.
+	TuioPoint pt = (TuioPoint)pointList.get(j);
+	//On affiche les coordonnées dans la fenêtre à la position (100 ; j*20), j allant de 20 à N.
+	text(pt.getX() + " " + pt.getY() + " " + pt.getZ(), 100, j*20+20);
+	//Si deux mains sont détectées, on quitte la fonction.
+	if(tuioClient.getTuioCursors().size() == 2)
+		break;
+}
+
+Il est à noter que plusieurs projets existent sous Processing, notamment dans l'affichage de fluides ou de fumée par exemple :
+
+http://processing.org/discourse/yabb/YaBB.cgi?board=Contribution_Simlation;action=display;num=1045166270
+http://bodytag.org/nav.php?u=fluid3/
+http://bodytag.org/fluid3/fluid3.pde
+http://bodytag.org/nav.php?u=smoke2/
+http://bodytag.org/smoke2/smoke2.pde
+
+Si vous expérimentez des difficultés ou souhaitez me soumettre une requête, voici mon adresse : alexandre.bastien@iri.centrepompidou.fr
\ No newline at end of file
--- a/front_processing/src/Trakers/Trakers.pde	Thu Mar 15 13:35:25 2012 +0100
+++ b/front_processing/src/Trakers/Trakers.pde	Mon Mar 19 10:21:56 2012 +0100
@@ -1,5 +1,4 @@
 import TUIO.*;
-//import TrakersNavierStokes;
 TuioProcessing tuioClient;
 boolean oneHandLeft;
 
@@ -32,7 +31,6 @@
 void tuioInput()
 {
     noFill();
-    //rect(0, 0, 50, 50);
   
     Vector tuioCursorList = tuioClient.getTuioCursors();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/middleware/dist/TraKERS.iss	Mon Mar 19 10:21:56 2012 +0100
@@ -0,0 +1,38 @@
+; Script generated by the Inno Setup Script Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+#define MyAppName "TraKERS"
+#define MyAppVersion "1.0"
+#define MyAppPublisher "IRI"
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{31E24F4A-3E24-47CF-8FB7-FBDE41DAB367}
+AppName={#MyAppName}
+AppVersion={#MyAppVersion}
+;AppVerName={#MyAppName} {#MyAppVersion}
+AppPublisher={#MyAppPublisher}
+DefaultDirName={pf}\{#MyAppName}
+DefaultGroupName={#MyAppName}
+AllowNoIcons=yes
+OutputBaseFilename=setup
+Compression=lzma
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+Name: "french"; MessagesFile: "compiler:Languages\French.isl"
+
+[Run]
+Filename: "{app}\Dependancies\dotNetFx40_Client_x86_x64.exe"
+
+[Files]
+Source: "C:\Users\bastiena\Desktop\TraKERS\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "C:\Users\bastiena\Desktop\TraKERS\Dependancies\dotNetFx40_Client_x86_x64.exe"; Flags: dontcopy
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/middleware/doc/readme.txt	Mon Mar 19 10:21:56 2012 +0100
@@ -0,0 +1,77 @@
+TraKERS (Tracking using Kinect and Extracting Robust Skeletons) est une interface basée sur la détection de gestures / positions du squelette envoyé par le SDK Microsoft (1.0) de Kinect.
+
+Auteur : Alexandre BASTIEN.
+
+I) TraKERS - Eléments requis :
+
+Les spécifications de Microsoft font état des éléments matériels et logiciels requis afin de pouvoir utiliser le SDK :
+
+Besoins matériels :
+	Capteur Kinect.
+	Processeur32-bit (x86) ou 64-bit (x64).
+	Dual-core 2.66-GHz ou plus rapide.
+	Bus USB 2.0 dédié.
+	2 GB RAM.
+Besoins logiciels :
+	Microsoft® Visual Studio® 2010 Express ou une autre édition de Visual Studio 2010 (si vous souhaitez développer).
+	Windows 7.
+	NET Framework 4.0.
+
+Vous les trouverez ici si vous le souhaitez : http://www.microsoft.com/en-us/kinectforwindows/develop/release-notes.aspx
+
+La version 4.0 du Framework est présente dans l'installation de TraKERS.
+Néanmoins, par soucis de taille de l'installeur, il vous sera nécessaire d'installer le SDK 1.0 de Microsoft ici :
+http://www.microsoft.com/en-us/kinectforwindows/develop/overview.aspx
+
+II) TraKERS - Structure :
+
+TraKERS v1.0 est composé de deux modules, le Middleware (utilisant la Kinect afin de détecter des gestes et de suivre la position des mains et le Front (développé en Processing), permettant de récupérer les messages OSC du Middleware. Pour plus d'informations sur le Front, veuillez consulter la documentation située dans le dossier Front Processing.
+
+Afin de permettre au Middleware d'envoyer des messages au Front, un client TUIO a été installé dans le Front et un serveur TUIO dans le Middleware.
+
+Le middleware dispose d'une interface de debug permettant de connaître en temps réel la position de l'utilisateur à la Kinect. Ces fonctionnalités seront vues plus avant dans la partie Utilisation.
+
+Les sources des modules sont fournies lors de l'installation, n'hésitez pas à les consulter si besoin est.
+
+III) TraKERS - Utilisation :
+
+Vous pouvez démarrer le Middleware ou bien le Front dans l'ordre que vous voulez.
+Lorsque le Middleware est démarré, la Kinect ne s'allume pas encore. Il faut pour cela appuyer sur le bouton ON en bas de la fenêtre de debug. Le capteur (situé le plus à gauche sur la Kinect) va alors s'allumer en rouge, signe que vous serez détecté si vous entrez dans son champ.
+Lorsque le bouton a été appuyé, il devient un bouton OFF, et permet d'éteindre la Kinect. Il est à noter que le fait de fermer la fenêtre ou de quitter via le menu éteignent également le capteur de la Kinect, avant de quitter.
+(Plus de détails sur la Kinect : http://fr.wikipedia.org/wiki/Kinect).
+
+Lorsque vous êtes détectés, le squelette de la personne la plus proche s'affiche. Les rectangles sur la droite indiquent la proximité de l'utilisateur par rapport à la Kinect, lorsque l'utilisateur est à moins de 1m, le rectangle du haut est rouge ; entre 1m et 2m, le second est orange ; entre 2m et 3m, le troisième est jaune et au delà de 3m, le dernier rectangle est blanc.
+
+Il existe une zone de détection des mains, située par défaut entre 1m et 1,5m de la Kinect mais configurable. En dehors de cette zone, les mains sont toujours détectées, mais aucun signal n'est envoyé via le serveur TUIO. Il y a deux rectangles en haut de cette fenêtre, permettant d'indiquer si une main est entrée dans ce champ (main gauche/droite dans le champ se traduit par la coloration du rectangle gauche/droit en bleu, et par l'affichage en pixels des coordonnées de la main (sauf pour la profondeur, qui est en mètres).
+
+Il est possible de paramétrer des éléments du Middleware, comme la délimitation du champ pour les mains, le host et le port pour le serveur et l'intervalle de temps minimum qui sépare deux détections de gestes.
+
+Si des erreurs surviennent durant le fonctionnement du Middleware, ceux-ci seront affichés en bas de la fenêtre. Lorsqu'un geste est détecté, une couleur est affichée en bas de la fenêtre, au niveau des exceptions. Pour des raisons de lisibilité au niveau de la détection, la couleur restera affichée tant que la main gauche sera dans le champ. Autrement, la couleur apparaîtra, puis disparaîtra.
+
+A) Position des mains :
+
+Lorsqu'au moins une main entre dans le champ, ses/leurs coordonnées sont envoyées par le serveur au front. Si le front n'est pas lancé, il n'y aura pas d'erreur.
+
+B) Détection de gestes :
+
+Pour l'instant, plusieurs gestes peuvent être détectés :
+
+	SWIPE - Désigne un mouvement de claque horizontal, partant de la droite vers la gauche avec la main droite (et inversement pour la gauche). Durant le geste, la main ne doit pas descendre sous la hanche ni aller au dessus de la tête. Il lui faut une certaine longueur de parcours et elle ne doit aller que vers la gauche pour la main droite et vers la droite pour la main gauche. Le swipe peut donc être pour l'instant gauche ou droit.
+	Lorsque ce geste est détecté, le bas de la fenêtre se colore en rouge si le swipe est vers la gauche.
+	Lorsque ce geste est détecté, le bas de la fenêtre se colore en violet si le swipe est vers la droite.
+	
+	PUSH/PULL - Mouvement de poussée/traction rectiligne dirigé vers la kinect à partir de l'emplacement actuel de la main effectuant le geste.
+	Lorsque ce geste est détecté, le bas de la fenêtre se colore en blanc s'il s'agit d'un push.
+	Lorsque ce geste est détecté, le bas de la fenêtre se colore en noir s'il s'agit d'un pull.
+	
+	En développement :
+		JUMP - Action de sauter à pieds vers le haut.
+
+IV) Mentions importantes pour le debug :
+
+Il demeure quelques problèmes dans cette version de TraKERS, qui seront réglés à l'occasion d'une autre phase de développement.
+
+1) Instabilité du logiciel lorsqu'un utilisateur se trouve trop proche de la Kinect durant un certain laps de temps (moins d'un mètre).
+2) Le premier client Processing à se connecter au Middleware est le seul à recevoir des messages. Je ne pense pas que cela soit problématique dans la mesure où l'on peut implémenter différentes fonctions de dessins sous processing qui seront appelées suivant les messages reçus par le client.
+
+Si vous expérimentez des difficultés ou souhaitez me soumettre une requête, voici mon adresse : alexandre.bastien@iri.centrepompidou.fr
\ No newline at end of file
--- a/middleware/src/App.config	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/App.config	Mon Mar 19 10:21:56 2012 +0100
@@ -5,26 +5,6 @@
     <add key="searchMaxDistance" value="1,5"/>
     <add key="connexionHost" value="127.0.0.1"/>
     <add key="connexionPort" value="80"/>
-    <add key="hipCenterID" value="0"/>
-    <add key="spineID" value="1"/>
-    <add key="shoulderCenterID" value="2"/>
-    <add key="headID" value="3"/>
-    <add key="shoulderLeftID" value="4"/>
-    <add key="elbowLeftID" value="5"/>
-    <add key="wristLeftID" value="6"/>
-    <add key="handLeftID" value="7"/>
-    <add key="shoulderRightID" value="8"/>
-    <add key="elbowRightID" value="9"/>
-    <add key="wristRightID" value="10"/>
-    <add key="handRightID" value="11"/>
-    <add key="hipLeftID" value="12"/>
-    <add key="kneeLeftID" value="13"/>
-    <add key="ankleLeftID" value="14"/>
-    <add key="footLeftID" value="15"/>
-    <add key="hipRightID" value="16"/>
-    <add key="kneeRightID" value="17"/>
-    <add key="ankleRightID" value="18"/>
-    <add key="footRightID" value="19"/>
     <add key="timerElapsing" value="1000"/>
   </appSettings>
 </configuration>
\ No newline at end of file
--- a/middleware/src/Communication/Server.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Communication/Server.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -27,6 +27,9 @@
 using System.Windows.Media.Media3D;
 using Trakers.Tracking.Events;
 using System.Timers;
+using Trakers.Debug;
+using System.Resources;
+using System.Reflection;
 
 namespace Trakers.Communication
 {
@@ -34,29 +37,30 @@
     {
         //Serveur TUIO, provenant de la DLL TuioServer créé par Bespoke.
         private TuioServer server;
+        //Affichage de debug.
+        private DebugWindow debug;
 
         //Permet de savoir si un curseur pour la main gauche/droite a été créé.
         private bool leftHandCursorCreated;
         private bool rightHandCursorCreated;
         private bool messageCreated;
         private bool gestureLocked;
-
+        //Intervalle minimum entre les gestures.
         private int timerElapsing;
-
-        System.Timers.Timer _timer;
+        //Timer.
+        private System.Timers.Timer _timer;
+        //Gestionnaire de ressources.
+        private ResourceManager rm;
 
         /*
         * Constructeur : On initialise le serveur avec une adresse et un port, au début les curseurs
         * ne sont pas créés et on indique au ThreadPool une fonction de callback de manière à vérifier
         * s'il reçoit des notifications.
         */
-        public Server(String host, int port, int _timerElapsing)
+        public Server(String host, int port, int _timerElapsing, DebugWindow _debug)
         {
-            //On démarre le serveur TUIO.
-            server = new TuioServer(host, port);
-            //On initialise le threadPool (appelé toutes les N ms).
-            ThreadPool.QueueUserWorkItem(ThreadPoolCallback);
-
+            debug = _debug;
+            rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
             //Au départ, aucune main n'est dans le champ de recherche et aucune gesture n'est détectée.
             leftHandCursorCreated = false;
             rightHandCursorCreated = false;
@@ -65,10 +69,22 @@
 
             timerElapsing = _timerElapsing;
 
-            //On instancie le timer à N ms.
-            _timer = new System.Timers.Timer(timerElapsing);
-            //Dès que le timer est expiré, on appelle _timer_Elapsed.
-            _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
+            try
+            {
+                //On démarre le serveur TUIO.
+                server = new TuioServer(host, port);
+                //On initialise le threadPool (appelé toutes les N ms).
+                ThreadPool.QueueUserWorkItem(ThreadPoolCallback);
+
+                //On instancie le timer à N ms.
+                _timer = new System.Timers.Timer(timerElapsing);
+                //Dès que le timer est expiré, on appelle _timer_Elapsed.
+                _timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed);
+            }
+            catch (Exception)
+            {
+                debug.ExceptionLbl.Content = rm.GetString("serverCantStart");
+            }
         }
 
         /*
@@ -95,7 +111,6 @@
         */
         public void LeftHandTracked(object sender, LeftHandTrackedEventArgs e)
         {
-            return;
             //Si le curseur de la main gauche n'est pas créé, alors on le crée.
             if (!leftHandCursorCreated)
             {
@@ -114,19 +129,16 @@
         */
         public void RightHandTracked(object sender, RightHandTrackedEventArgs e)
         {
-            return;
             //Si le curseur de la main droite n'est pas créé, alors on le crée.
             if (!rightHandCursorCreated)
             {
                 server.AddTuioCursor(1, SkeletonPointToPoint3D(e.handJoint.Position));
-                //server.AddTuioString(1, "BOO");
                 rightHandCursorCreated = true;
             }
             //S'il existe, on le met simplement à jour.
             else
             {
                 server.UpdateTuioCursor(1, SkeletonPointToPoint3D(e.handJoint.Position));
-                //server.UpdateTuioString(1, "BOO");
             }
         }
 
@@ -135,7 +147,6 @@
         */
         public void LeftHandQuit(object sender, LeftHandQuitEventArgs e)
         {
-            return;
             //Si le curseur de la main gauche existe, alors on le supprime.
             if (leftHandCursorCreated)
             {
@@ -149,12 +160,10 @@
         */
         public void RightHandQuit(object sender, RightHandQuitEventArgs e)
         {
-            return;
             //Si le curseur de la main droite existe, alors on le supprime.
             if (rightHandCursorCreated)
             {
                 server.DeleteTuioCursor(1);
-                //server.DeleteTuioString(1);
                 rightHandCursorCreated = false;
             }
         }
@@ -191,8 +200,6 @@
             else
                 hand = "BOTH";
 
-            Console.Out.WriteLine(pushPull + "-" + hand);
-
             GesturePerformed(pushPull + "-" + hand);
         }
 
@@ -210,7 +217,7 @@
                 if (!messageCreated)
                 {
                     messageCreated = true;
-                    server.AddTuioString(1, code);
+                    server.AddTuioString(2, code);
                     //On démarre le timer.
                     _timer.Start();
                 }
@@ -246,7 +253,7 @@
                 {
                     //On débloque la détection de gesture et on supprime l'objet envoyant les messages OSC de gesture.
                     messageCreated = false;
-                    server.DeleteTuioString(1);
+                    server.DeleteTuioString(2);
                 }
             }
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/middleware/src/Debug/DebugParameters.xaml	Mon Mar 19 10:21:56 2012 +0100
@@ -0,0 +1,62 @@
+<!--
+Projet : TraKERS
+Module : MIDDLEWARE
+Sous-Module : Debug
+Classe : DebugParameters
+
+Auteur : alexandre.bastien@iri.centrepompidou.fr
+
+Fonctionnalités : Affiche la fenêtre de paramétrage du Middleware, contenant :
+    La distance min et max du champ de recherche.
+    L'host et le port du serveur TUIO.
+    L'intervalle de temps entre le début et la fin du timer pour la détection des gestures.
+-->
+    
+<Window x:Class="Trakers.Debug.DebugParameters" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="DebugParameters" Height="300" Width="300" Closed="Window_Closed">
+    <Grid>
+        <StackPanel>
+            <Label Content="Limites du champ de recherche (ex : 1.5 - 2) [1, 4] :" Height="30" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" Width="300" />
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="30" />
+                    <RowDefinition Height="30" />
+                </Grid.RowDefinitions>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="20*" />
+                    <ColumnDefinition Width="80*" />
+                </Grid.ColumnDefinitions>
+                
+                <!-- Limites min et max du champ de recherche. -->
+                <Label Grid.Row="0" Grid.Column="0" Content="Min :" Height="25" HorizontalAlignment="Left" Name="label2" VerticalAlignment="Top" />
+                <TextBox Grid.Row="0" Grid.Column="1" Height="25" HorizontalAlignment="Left" Name="searchMinDistanceTB" VerticalAlignment="Top" Width="120" />
+                <Label Grid.Row="1" Grid.Column="0" Content="Max :" Height="25" HorizontalAlignment="Left" Name="label3" VerticalAlignment="Top" />
+                <TextBox Grid.Row="1" Grid.Column="1" Height="25" HorizontalAlignment="Left" Name="searchMaxDistanceTB" VerticalAlignment="Top" Width="120" />
+            </Grid>
+            
+            <Label Content="Serveur TUIO :" Height="30" HorizontalAlignment="Left" Name="label4" VerticalAlignment="Top" Width="300" />
+
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="30" />
+                    <RowDefinition Height="30" />
+                    <RowDefinition Height="30" />
+                </Grid.RowDefinitions>
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="50*" />
+                    <ColumnDefinition Width="50*" />
+                </Grid.ColumnDefinitions>
+
+                <!-- Paramètres du serveur TUIO. -->
+                <Label Grid.Row="0" Grid.Column="0" Content="Host (ip) :" HorizontalAlignment="Left" Name="label5" VerticalAlignment="Top" />
+                <TextBox Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Name="connexionHostTB" VerticalAlignment="Top" Width="120" />
+                <Label Grid.Row="1" Grid.Column="0" Content="Port :" HorizontalAlignment="Left" Name="label6" VerticalAlignment="Top" />
+                <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Name="connexionPortTB" VerticalAlignment="Top" Width="120" />
+                <Label Grid.Row="2" Grid.Column="0" Content="Timer (temps en ms) :" Height="30" HorizontalAlignment="Left" Name="label7" VerticalAlignment="Top" />
+                <TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Name="timerElapsingTB" VerticalAlignment="Top" Width="120" />
+            </Grid>
+            <Button Content="Modifier" Click="Button_Click" />
+            <!-- Affichage des problèmes éventuels lors de la saisie des paramètres. -->
+            <Label Content="" Name="ExceptionInParametersLbl" Height="28" />
+        </StackPanel>
+    </Grid>
+</Window>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/middleware/src/Debug/DebugParameters.xaml.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -0,0 +1,118 @@
+/*
+ * Projet : TraKERS
+ * Module : MIDDLEWARE
+ * Sous-Module : Debug
+ * Classe : DebugParameters
+ * 
+ * Auteur : alexandre.bastien@iri.centrepompidou.fr
+ * 
+ * Fonctionnalités : Code source attaché à la fenêtre de paramétrage du Middleware.
+ * Celui-ci permet de charger/sauvegarder les paramètres stockés dans KinectMain.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using Trakers.Tracking;
+using System.Reflection;
+using System.Resources;
+
+namespace Trakers.Debug
+{
+    /// <summary>
+    /// Interaction logic for DebugParameters.xaml
+    /// </summary>
+    public partial class DebugParameters : Window
+    {
+        //Membre d'accès à KinectMain.
+        private KinectMain kinectMain;
+        private ResourceManager rm;
+
+        /*
+         * Constructeur : On ouvre la fenêtre et on charge les paramètres.
+         */
+        public DebugParameters(KinectMain _kinectMain)
+        {
+            rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
+            kinectMain = _kinectMain;
+            InitializeComponent();
+            getParameters();
+        }
+
+        /*
+         * Permet de charger les paramètres depuis KinectMain et les affiche dans la fenêtre de paramétrage.
+         */
+        public void getParameters()
+        {
+            searchMinDistanceTB.Text = kinectMain.getMinDistHands().ToString();
+            searchMaxDistanceTB.Text = kinectMain.getMaxDistHands().ToString();
+            connexionHostTB.Text = kinectMain.getConnexionHost();
+            connexionPortTB.Text = kinectMain.getConnexionPort().ToString();
+            timerElapsingTB.Text = kinectMain.getTimerElapsing().ToString();
+        }
+
+        /*
+         * Permet de sauvegarder les paramètres de la fenêtre de paramétrage vers KinectMain.
+         */
+        public void setParameters()
+        {
+            try
+            {
+                ExceptionInParametersLbl.Content = "";
+
+                float minDistHands = float.Parse(searchMinDistanceTB.Text);
+                float maxDistHands = float.Parse(searchMaxDistanceTB.Text);
+                int connexionPort = int.Parse(connexionPortTB.Text);
+                int timerElapsing = int.Parse(timerElapsingTB.Text);
+
+                if (maxDistHands <= 0 || minDistHands <= 0 || maxDistHands > 4 || minDistHands > 4 || minDistHands >= maxDistHands || connexionPort < 0 || timerElapsing < 0)
+                {
+                    ExceptionInParametersLbl.Content = rm.GetString("loadParametersIncorrect");
+                }
+                else
+                {
+                    kinectMain.setMinDistHands(minDistHands);
+                    kinectMain.setMaxDistHands(maxDistHands);
+                    kinectMain.setConnexionHost(connexionHostTB.Text);
+                    kinectMain.setConnexionPort(connexionPort);
+                    kinectMain.setTimerElapsing(timerElapsing);
+
+                    kinectMain.updateParameters();
+                }
+            }
+            catch (Exception)
+            {
+                //S'il y a eu un problème de parsing (i.e si l'utilisateur a entré une mauvaise valeur),
+                //Alors on affiche l'erreur, puis on recharge les paramètres précédents.
+                ExceptionInParametersLbl.Content = rm.GetString("loadParametersFail");
+                getParameters();
+            }
+        }
+
+        /*
+         * Méthode attachée à l'événement click sur le bouton de validation de la fenêtre de paramétrage.
+         * Les données sont sauvegardées vers KinectMain, puis rechargées dans la fenêtre.
+         */
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            setParameters();
+        }
+
+        /*
+         * Méthode appelée à la fermeture de la fenêtre de paramétrage.
+         */
+        private void Window_Closed(object sender, EventArgs e)
+        {
+            
+        }
+    }
+}
--- a/middleware/src/Debug/DebugWindow.xaml	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Debug/DebugWindow.xaml	Mon Mar 19 10:21:56 2012 +0100
@@ -2,7 +2,7 @@
 Projet : TraKERS
 Module : MIDDLEWARE
 Sous-Module : Debug
-Classe : Debug
+Classe : DebugWindow
 
 Auteur : alexandre.bastien@iri.centrepompidou.fr
 
@@ -28,10 +28,20 @@
 
         <Grid Grid.Row="0" Grid.Column="0">
             <Grid.RowDefinitions>
+                <RowDefinition Height="20" />
                 <RowDefinition Height="40" />
                 <RowDefinition />
             </Grid.RowDefinitions>
-            <Grid Grid.Row="0">
+            <Grid Grid.Row="0" Background="LightGray">
+                <!-- Menu de la fenêtre de debug. -->
+                <Menu Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left" Height="20" Width="50" Background="LightGray" Foreground="White">
+                    <MenuItem Header="Fichier" Background="Black">
+                        <MenuItem Header="Paramètres" Background="White" Foreground="Black" Click="Parameters_Click" />
+                        <MenuItem Header="Quitter" Background="White" Foreground="Black" Click="Quit_Click" />
+                    </MenuItem>
+                </Menu>
+            </Grid>
+            <Grid Grid.Row="1">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition />
                     <ColumnDefinition />
@@ -42,7 +52,7 @@
                 <Label Name="RightHand" Grid.Column="1" Background="DarkGray" FontSize="14" FontWeight="Bold" />
             </Grid>
             <!-- Cette partie permet d'afficher les erreurs survenant dans le programme. -->
-            <Label Name="ExceptionLbl" Height="30" VerticalAlignment="Bottom" Grid.Row="1" Content="" HorizontalContentAlignment="Center" />
+            <Label Name="ExceptionLbl" Height="30" VerticalAlignment="Bottom" Grid.Row="2" Content="" HorizontalContentAlignment="Center" />
         </Grid>
 
         <!-- Ce bouton permet d'allumer/éteindre la Kinect. -->
@@ -52,21 +62,14 @@
         <!-- 0-1 m : Rouge. 1-2 : Orange. 2-3 : Jaune. 3-4 : Blanc. -->
         <StackPanel Grid.Row="0" Grid.Column="1" Name="List">
             <Label Name="DistanceLbl" Content="Distance :" />
-            <Rectangle Name="R1" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R2" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R3" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R4" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R5" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R6" Height="50" Fill="DarkGray" />
-            <Rectangle Name="R7" Height="50" Fill="DarkGray" />
-            <!--<Label Name="D1" Content="0 &lt; D &lt; 1" />
+            <Label Name="D1" Content="0 &lt; D &lt; 1" />
             <Rectangle Name="R1" Height="70" Fill="DarkGray" />
             <Label Name="D2" Content="1 &lt; D &lt; 2" />
             <Rectangle Name="R2" Height="70" Fill="DarkGray" />
             <Label Name="D3" Content="2 &lt; D &lt; 3" />
             <Rectangle Name="R3" Height="70" Fill="DarkGray" />
             <Label Name="D4" Content="3 &lt; D &lt; 4" />
-            <Rectangle Name="R4" Height="70" Fill="DarkGray" />-->
+            <Rectangle Name="R4" Height="70" Fill="DarkGray" />
         </StackPanel>
     </Grid>
 </Window>
--- a/middleware/src/Debug/DebugWindow.xaml.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Debug/DebugWindow.xaml.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -33,11 +33,15 @@
 using System.Threading;
 using Trakers.Tracking.Events;
 using Trakers.Tracking.Gestures;
+using System.Resources;
+using System.Reflection;
 
 namespace Trakers.Debug
 {
     public partial class DebugWindow : Window
     {
+        //Gestionnaire de ressources.
+        private ResourceManager rm;
         //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking.
         private KinectMain kinectMain;
         //Tableau contenant une image en couleurs.
@@ -54,6 +58,7 @@
         */
         public DebugWindow(KinectMain main)
         {
+            rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
             InitializeComponent();
             kinectMain = main;
             on = false;
@@ -144,6 +149,9 @@
             //Si on a des données dans le tableau et que la kinect est allumée.
             if (receivedData && on)
             {
+                //Exemples de modifications de l'affichage :
+                //Zombies apocalypse.
+                //Black & White movie.
                 /*for (int i = 0; i < colorPixelData.Length; i += colorImageFrameData.BytesPerPixel)
                 {
                     byte gray = Math.Min(colorPixelData[i], colorPixelData[i + 1]);
@@ -172,12 +180,7 @@
         {
             DistanceLbl.Content = "Distance : " + distance;
 
-            /*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)
+            if (distance > 0 && distance < 1)
             {
                 R1.Fill = System.Windows.Media.Brushes.Red;
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
@@ -204,7 +207,7 @@
                 R2.Fill = System.Windows.Media.Brushes.DarkGray;
                 R3.Fill = System.Windows.Media.Brushes.DarkGray;
                 R4.Fill = System.Windows.Media.Brushes.White;
-            }*/
+            }
         }
 
         /*
@@ -362,5 +365,33 @@
                 }
             }
         }
+
+        /*
+         * Méthode associée à l'événement : Ouvrir la fenêtre de paramétrage via le menu.
+         */
+        private void Parameters_Click(object sender, RoutedEventArgs e)
+        {
+            DebugParameters param = new DebugParameters(kinectMain);
+
+            try
+            {
+                param.ShowDialog();
+            }
+            catch (Exception)
+            {
+                ExceptionLbl.Content = rm.GetString("loadParamFail");
+            }
+        }
+
+        /*
+         * Méthode associée à l'événement : Quitter via le menu.
+         */
+        private void Quit_Click(object sender, RoutedEventArgs e)
+        {
+            closing = true;
+            //On éteint la Kinect (pour éviter qu'elle reste allumée même lorsque le programme est éteint).
+            kinectMain.KinectClose();
+            Application.Current.Shutdown();
+        }
     }
 }
--- a/middleware/src/Properties/Resources.Designer.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Properties/Resources.Designer.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.239
+//     Runtime Version:4.0.30319.261
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -86,5 +86,23 @@
                 return ResourceManager.GetString("loadParametersIncorrect", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Impossible de charger la fenêtre de paramétrage..
+        /// </summary>
+        internal static string loadParamFail {
+            get {
+                return ResourceManager.GetString("loadParamFail", resourceCulture);
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized string similar to Impossible de démarrer le serveur TUIO (peut-être host ou port invalide ?)..
+        /// </summary>
+        internal static string serverCantStart {
+            get {
+                return ResourceManager.GetString("serverCantStart", resourceCulture);
+            }
+        }
     }
 }
--- a/middleware/src/Properties/Resources.resx	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Properties/Resources.resx	Mon Mar 19 10:21:56 2012 +0100
@@ -129,4 +129,12 @@
     <value>Paramètres incorrects. Paramètres par défaut.</value>
     <comment>S'affiche si les paramètres sont incorrects.</comment>
   </data>
+  <data name="loadParamFail" xml:space="preserve">
+    <value>Impossible de charger la fenêtre de paramétrage.</value>
+    <comment>S'affiche si l'affichage de la fenêtre de paramétrage a échoué.</comment>
+  </data>
+  <data name="serverCantStart" xml:space="preserve">
+    <value>Impossible de démarrer le serveur TUIO (peut-être host ou port invalide ?).</value>
+    <comment>S'affiche si le serveur ne peut pas démarrer.</comment>
+  </data>
 </root>
\ No newline at end of file
--- a/middleware/src/Tracking/Events/PushListener.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/Events/PushListener.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -26,7 +26,6 @@
         */
         public void ShowOnScreen(object o, PushEventArgs e)
         {
-            //Console.Out.WriteLine("3");
             //On l'indique dans le debug.
             e.debug.showPush(e);
             //e.debug.ExceptionLbl.Content = "SWIPE";
--- a/middleware/src/Tracking/Gestures/GestureDetector.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/Gestures/GestureDetector.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -28,11 +28,11 @@
         //protected JointCollection previousSkeleton;
 
         //Voici les ID des noeuds d'un squelette : variables magiques en attente de factorisation.
-        protected int hipCenterID = 0, spineID = 1, shoulderCenterID = 2, headID = 3;
+        /*protected int hipCenterID = 0, spineID = 1, shoulderCenterID = 2, headID = 3;
         protected int shoulderLeftID = 4, elbowLeftID = 5, wristLeftID = 6, handLeftID = 7;
         protected int shoulderRightID = 8, elbowRightID = 9, wristRightID = 10, handRightID = 11;
         protected int hipLeftID = 12, kneeLeftID = 13, ankleLeftID = 14, footLeftID = 15;
-        protected int hipRightID = 16, kneeRightID = 17, ankleRightID = 18, footRightID = 19;
+        protected int hipRightID = 16, kneeRightID = 17, ankleRightID = 18, footRightID = 19;*/
 
         //Elements nécessaires à la reconnaissance du geste :
         //Distance du parcours du geste (va dépendre de la distance de l'utilisateur).
--- a/middleware/src/Tracking/Gestures/JumpDetector.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/Gestures/JumpDetector.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -8,6 +8,8 @@
  * 
  * Fonctionnalités : Permet de détecter si l'utilisateur a sauté, en se basant sur
  * des règles appliquées à la positions des noeuds dans le temps.
+ * 
+ * P.S : Cette partie est encore en développement.
  */
 
 using System;
@@ -61,13 +63,14 @@
              */
 
             //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules.
-            refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y);
+            refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y);
             //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière).
 
             int beginIdx = localHistory.Count - indexesToCheck + 1;
             int middleIdx = localHistory.Count - indexesToCheck / 2;
 
-            bool middleOK = true, topOfJump = false;
+            //bool middleOK = true
+            bool topOfJump = false;
 
             
 
@@ -75,14 +78,14 @@
             for (int i = beginIdx ; i < localHistory.Count ; i++)
             {
 
-                if (localHistory[i][handRightID].Position.Y < localHistory[beginIdx][handRightID].Position.Y + refDistance &&
-                   localHistory[i - 1][handRightID].Position.Y < localHistory[i][handRightID].Position.Y)
+                if (localHistory[i][(int)JointType.HandRight].Position.Y < localHistory[beginIdx][(int)JointType.HandRight].Position.Y + refDistance &&
+                   localHistory[i - 1][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.HandRight].Position.Y)
                 {
                     topOfJump = true;
                     //Console.Out.WriteLine("TOP");
                 }
 
-                if (localHistory[i - 1][handRightID].Position.Y > localHistory[i][handRightID].Position.Y && !topOfJump)
+                if (localHistory[i - 1][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HandRight].Position.Y && !topOfJump)
                     return false;
 
                 //Si la position Y de la main est plus haute que la tête
@@ -91,8 +94,8 @@
                 //OU si la nouvelle position X de la main est plus éloignée de la distance N par rapport à la première position X
                 //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y
                 //Alors la main en question ne fait pas de push.
-                if (localHistory[i-1][handRightID].Position.Y > localHistory[i][handRightID].Position.Y &&
-                    topOfJump || localHistory[i - 1][handRightID].Position.Y < localHistory[i][handRightID].Position.Y &&
+                if (localHistory[i - 1][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HandRight].Position.Y &&
+                    topOfJump || localHistory[i - 1][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.HandRight].Position.Y &&
                     !topOfJump)
                     return false;
             }
@@ -109,14 +112,10 @@
             //OU si la première position calculée de la main droite/gauche est sur le côté gauche/droit du corps
             //Alors on retourne faux.
             
-            //if(
-
             //On supprime l'historique local.
-            //localHistory.Clear(Math.Abs(localHistory[i-1][handRightID].Position.Y));
-
+            
             debug.ExceptionLbl.Background = System.Windows.Media.Brushes.Yellow;
-            Console.WriteLine("{" + n++ + "}" + "JUMP");
-
+            
             return false;
         }
     }
--- a/middleware/src/Tracking/Gestures/PushDetector.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/Gestures/PushDetector.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -51,10 +51,10 @@
                 return Hand.NONE;
 
             //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules.
-            refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y);
+            refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y);
             //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière).
-            SkeletonPoint startPointLeft = localHistory[localHistory.Count - indexesToCheck][handLeftID].Position;
-            SkeletonPoint startPointRight = localHistory[localHistory.Count - indexesToCheck][handRightID].Position;
+            SkeletonPoint startPointLeft = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position;
+            SkeletonPoint startPointRight = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position;
 
             //Booléens indiquant si le mouvement serait valide pour la main gauche ou droite.
             bool leftHandOK = true, rightHandOK = true;
@@ -62,106 +62,55 @@
             //De la position p1 à pn, on suit l'algorithme.
             for (int i = localHistory.Count - indexesToCheck + 1; i < localHistory.Count; i++)
             {
-                if (localHistory[i][handRightID].Position.Y > localHistory[i][headID].Position.Y)
-                    debug.R1.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R1.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if (localHistory[i][handRightID].Position.Y < localHistory[i][hipCenterID].Position.Y)
-                    debug.R2.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R2.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if (localHistory[i][handRightID].Position.Z < localHistory[i - 1][handRightID].Position.Z)
-                    debug.R3.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R3.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                //Console.Out.WriteLine(Math.Abs(localHistory[i][handRightID].Position.X - startPointRight.X) + " " + Math.Abs(localHistory[i][handRightID].Position.Y - startPointRight.Y) + " " + refDistance / 10);
-
-                if (Math.Abs(localHistory[i][handRightID].Position.X - startPointRight.X) < refDistance / 5 &&
-                    Math.Abs(localHistory[i][handRightID].Position.Y - startPointRight.Y) < refDistance / 5)
-                    debug.R4.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R4.Fill = System.Windows.Media.Brushes.DarkGray;
-
                 //Si la position Y de la main est plus haute que la tête
                 //OU si la position Y de la main est plus basse que la hanche
                 //OU si la nouvelle position Z de la main est moins profonde que la précédente
                 //OU si la nouvelle position X de la main est plus éloignée de la distance N par rapport à la première position X
                 //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y
                 //Alors la main en question ne fait pas de push.
-                if (localHistory[i][handLeftID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handLeftID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handLeftID].Position.Z > localHistory[i - 1][handLeftID].Position.Z ||
-                Math.Abs(localHistory[i][handLeftID].Position.X - startPointLeft.X) > refDistance / 5 ||
-                Math.Abs(localHistory[i][handLeftID].Position.Y - startPointLeft.Y) > refDistance / 5)
+                if (localHistory[i][(int)JointType.HandLeft].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.Z > localHistory[i - 1][(int)JointType.HandLeft].Position.Z ||
+                Math.Abs(localHistory[i][(int)JointType.HandLeft].Position.X - startPointLeft.X) > refDistance / 5 ||
+                Math.Abs(localHistory[i][(int)JointType.HandLeft].Position.Y - startPointLeft.Y) > refDistance / 5)
                     leftHandOK = false;
-                if (localHistory[i][handRightID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handRightID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handRightID].Position.Z > localHistory[i - 1][handRightID].Position.Z ||
-                Math.Abs(localHistory[i][handRightID].Position.X - startPointRight.X) > refDistance / 5 ||
-                Math.Abs(localHistory[i][handRightID].Position.Y - startPointRight.Y) > refDistance / 5)
+                if (localHistory[i][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.Z > localHistory[i - 1][(int)JointType.HandRight].Position.Z ||
+                Math.Abs(localHistory[i][(int)JointType.HandRight].Position.X - startPointRight.X) > refDistance / 5 ||
+                Math.Abs(localHistory[i][(int)JointType.HandRight].Position.Y - startPointRight.Y) > refDistance / 5)
                     rightHandOK = false;
 
                 if (!leftHandOK && !rightHandOK)
                     return Hand.NONE;
             }
 
-            //Console.Out.WriteLine("OK");
-
-            if (Math.Abs(localHistory[localHistory.Count - 1][handRightID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.Z) * 100 > 20)
-                debug.R5.Fill = System.Windows.Media.Brushes.Blue;
-            else
-                debug.R5.Fill = System.Windows.Media.Brushes.DarkGray;
-
-            if (localHistory[localHistory.Count - 1][handRightID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X)
-                debug.R6.Fill = System.Windows.Media.Brushes.Blue;
-            else
-                debug.R6.Fill = System.Windows.Media.Brushes.DarkGray;
-
             //Si la distance en Z du geste a été plus courte que la distance N
             //Alors on retourne faux.
-            //float dist = (localHistory[localHistory.Count - 1][handRightID].Position.X - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X);
-
-            //Console.WriteLine(Math.Abs(localHistory[0][handLeftID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.Z) * 100 + " " + refDistance);
-
-            if (Math.Abs(localHistory[localHistory.Count - 1][handLeftID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.Z) * 100 < 20)
+            if (Math.Abs(localHistory[localHistory.Count - 1][(int)JointType.HandLeft].Position.Z - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.Z) * 100 < 20)
                 leftHandOK = false;
-            if (Math.Abs(localHistory[localHistory.Count - 1][handRightID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.Z) * 100 < 20)
+            if (Math.Abs(localHistory[localHistory.Count - 1][(int)JointType.HandRight].Position.Z - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.Z) * 100 < 20)
                 rightHandOK = false;
             
-            /*if(rightHandOK || leftHandOK)
-                Console.Out.WriteLine("000000000");*/
-
             //Si la dernière position de la main droite/gauche est sur le côté gauche/droit du corps
             //OU si la première position calculée de la main droite/gauche est sur le côté gauche/droit du corps
             //Alors on retourne faux.
-            if (localHistory[localHistory.Count - 1][handLeftID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandLeft].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 leftHandOK = false;
-            if (localHistory[localHistory.Count - 1][handRightID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandRight].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 rightHandOK = false;
 
-            /*if (rightHandOK || leftHandOK)
-                Console.Out.WriteLine("11111111111");*/
-
             if (!leftHandOK && !rightHandOK)
                 return Hand.NONE;
 
-            /*if (rightHandOK || leftHandOK)
-                Console.Out.WriteLine("================");*/
-
             //On supprime l'historique local.
             localHistory.Clear();
 
             debug.ExceptionLbl.Background = System.Windows.Media.Brushes.White;
-            //Console.WriteLine("PUSH");
-            //Console.Read();
-
             //Si on est arrivé jusqu'ici, toutes les conditions pour un push ont été remplies.
+            
             if (leftHandOK && rightHandOK)
                 return Hand.BOTH;
             else if (leftHandOK)
@@ -190,10 +139,10 @@
                 return Hand.NONE;
 
             //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules.
-            refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y);
+            refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y);
             //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière).
-            SkeletonPoint startPointLeft = localHistory[localHistory.Count - indexesToCheck][handLeftID].Position;
-            SkeletonPoint startPointRight = localHistory[localHistory.Count - indexesToCheck][handRightID].Position;
+            SkeletonPoint startPointLeft = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position;
+            SkeletonPoint startPointRight = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position;
 
             //Booléens indiquant si le mouvement serait valide pour la main gauche ou droite.
             bool leftHandOK = true, rightHandOK = true;
@@ -207,76 +156,48 @@
                 //OU si la nouvelle position X de la main est plus éloignée de la distance N par rapport à la première position X
                 //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y
                 //Alors la main en question ne fait pas de push.
-                if (localHistory[i][handLeftID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handLeftID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handLeftID].Position.Z < localHistory[i - 1][handLeftID].Position.Z ||
-                Math.Abs(localHistory[i][handLeftID].Position.X - startPointLeft.X) > refDistance / 5 ||
-                Math.Abs(localHistory[i][handLeftID].Position.Y - startPointLeft.Y) > refDistance / 5)
+                if (localHistory[i][(int)JointType.HandLeft].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.Z < localHistory[i - 1][(int)JointType.HandLeft].Position.Z ||
+                Math.Abs(localHistory[i][(int)JointType.HandLeft].Position.X - startPointLeft.X) > refDistance / 5 ||
+                Math.Abs(localHistory[i][(int)JointType.HandLeft].Position.Y - startPointLeft.Y) > refDistance / 5)
                     leftHandOK = false;
-                if (localHistory[i][handRightID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handRightID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handRightID].Position.Z < localHistory[i - 1][handRightID].Position.Z ||
-                Math.Abs(localHistory[i][handRightID].Position.X - startPointRight.X) > refDistance / 5 ||
-                Math.Abs(localHistory[i][handRightID].Position.Y - startPointRight.Y) > refDistance / 5)
+                if (localHistory[i][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.Z < localHistory[i - 1][(int)JointType.HandRight].Position.Z ||
+                Math.Abs(localHistory[i][(int)JointType.HandRight].Position.X - startPointRight.X) > refDistance / 5 ||
+                Math.Abs(localHistory[i][(int)JointType.HandRight].Position.Y - startPointRight.Y) > refDistance / 5)
                     rightHandOK = false;
 
                 if (!leftHandOK && !rightHandOK)
                     return Hand.NONE;
             }
 
-            //Console.Out.WriteLine("OK");
-
-            if (Math.Abs(localHistory[localHistory.Count - 1][handRightID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.Z) * 100 > 20)
-                debug.R5.Fill = System.Windows.Media.Brushes.Blue;
-            else
-                debug.R5.Fill = System.Windows.Media.Brushes.DarkGray;
-
-            if (localHistory[localHistory.Count - 1][handRightID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X)
-                debug.R6.Fill = System.Windows.Media.Brushes.Blue;
-            else
-                debug.R6.Fill = System.Windows.Media.Brushes.DarkGray;
-
             //Si la distance en Z du geste a été plus courte que la distance N
             //Alors on retourne faux.
-            //float dist = (localHistory[localHistory.Count - 1][handRightID].Position.X - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X);
-
-            //Console.WriteLine(Math.Abs(localHistory[0][handLeftID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.Z) * 100 + " " + refDistance);
-
-            if (Math.Abs(localHistory[localHistory.Count - 1][handLeftID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.Z) * 100 < 20)
+            if (Math.Abs(localHistory[localHistory.Count - 1][(int)JointType.HandLeft].Position.Z - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.Z) * 100 < 20)
                 leftHandOK = false;
-            if (Math.Abs(localHistory[localHistory.Count - 1][handRightID].Position.Z - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.Z) * 100 < 20)
+            if (Math.Abs(localHistory[localHistory.Count - 1][(int)JointType.HandRight].Position.Z - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.Z) * 100 < 20)
                 rightHandOK = false;
 
-            /*if (rightHandOK || leftHandOK)
-                Console.Out.WriteLine("000000000");*/
-
             //Si la dernière position de la main droite/gauche est sur le côté gauche/droit du corps
             //OU si la première position calculée de la main droite/gauche est sur le côté gauche/droit du corps
             //Alors on retourne faux.
-            if (localHistory[localHistory.Count - 1][handLeftID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandLeft].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 leftHandOK = false;
-            if (localHistory[localHistory.Count - 1][handRightID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandRight].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 rightHandOK = false;
 
-            /*if (rightHandOK || leftHandOK)
-                Console.Out.WriteLine("11111111111");*/
-
             if (!leftHandOK && !rightHandOK)
                 return Hand.NONE;
 
-            /*if (rightHandOK || leftHandOK)
-                Console.Out.WriteLine("================");*/
-
             //On supprime l'historique local.
             localHistory.Clear();
 
             debug.ExceptionLbl.Background = System.Windows.Media.Brushes.Black;
-            //Console.WriteLine("PUSH");
-            //Console.Read();
-
+            
             //Si on est arrivé jusqu'ici, toutes les conditions pour un push ont été remplies.
             if (leftHandOK && rightHandOK)
                 return Hand.BOTH;
--- a/middleware/src/Tracking/Gestures/SwipeDetector.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/Gestures/SwipeDetector.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -50,61 +50,37 @@
                 return false;
             
             //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules.
-            refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y);
+            refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y);
             //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière).
-            startPoint = localHistory[localHistory.Count - indexesToCheck][handRightID].Position;
+            startPoint = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position;
 
             //De la position p1 à pn, on suit l'algorithme.
             for (int i = localHistory.Count - indexesToCheck + 1; i < localHistory.Count; i++)
             {
-                //Debug temporaire pour vérifier la validité de certaines contraintes durant la gesture.
-               /*if (localHistory[i][handRightID].Position.Y > localHistory[i][headID].Position.Y)
-                    debug.R1.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R1.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if(localHistory[i][handRightID].Position.Y < localHistory[i][hipCenterID].Position.Y)
-                    debug.R2.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R2.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if(localHistory[i][handRightID].Position.X < localHistory[i - 1][handRightID].Position.X)
-                    debug.R3.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R3.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if(Math.Abs(localHistory[i][handRightID].Position.Y - startPoint.Y) < refDistance/2)
-                    debug.R4.Fill = System.Windows.Media.Brushes.Blue;
-                else
-                    debug.R4.Fill = System.Windows.Media.Brushes.DarkGray;*/
-
                 //Si la position Y de la main est plus haute que la tête
                 //OU si la position Y de la main est plus basse que la hanche
                 //OU si la nouvelle position X de la main est à droite de la précédente
                 //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y
                 //Alors on retourne faux.
-                if (localHistory[i][handRightID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handRightID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handRightID].Position.X > localHistory[i - 1][handRightID].Position.X ||
-                Math.Abs(localHistory[i][handRightID].Position.Y - startPoint.Y) > refDistance/2)
+                if (localHistory[i][(int)JointType.HandRight].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandRight].Position.X > localHistory[i - 1][(int)JointType.HandRight].Position.X ||
+                Math.Abs(localHistory[i][(int)JointType.HandRight].Position.Y - startPoint.Y) > refDistance / 2)
                     return false;
             }
 
             //Si la distance horizontale du geste a été plus courte que la distance N
             //Alors on retourne faux.
-            //float dist = (localHistory[localHistory.Count - 1][handRightID].Position.X - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X);
-            
-            if (Math.Abs(localHistory[0][handRightID].Position.X - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X) < refDistance/2)
+            if (Math.Abs(localHistory[0][(int)JointType.HandRight].Position.X - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.X) < refDistance / 2)
                 return false;
 
             //Si la dernière position de la main droite est sur le côté droit du corps
             //OU si la première position calculée de la main droite est sur le côté gauche du corps
             //Alors on retourne faux.
-            if(localHistory[localHistory.Count - 1][handRightID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandRight].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandRight].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 return false;
 
-            //System.Console.Out.WriteLine(Math.Abs(localHistory[0][handRightID].Position.X - localHistory[localHistory.Count - indexesToCheck][handRightID].Position.X) + " < " + refDistance/2);
             //On supprime l'historique local.
             localHistory.Clear();
             //Si on est arrivé jusqu'ici, toutes les conditions pour un swipe left ont été remplies.
@@ -129,61 +105,37 @@
                 return false;
 
             //La distance de référence est ici la distance entre le milieu du dos et le milieu des épaules.
-            refDistance = Math.Abs(localHistory[0][spineID].Position.Y - localHistory[0][shoulderCenterID].Position.Y);
+            refDistance = Math.Abs(localHistory[0][(int)JointType.Spine].Position.Y - localHistory[0][(int)JointType.ShoulderCenter].Position.Y);
             //On commence la position pour les indexesToCheck dernières postures (celle à l'index 0 étant la dernière).
-            startPoint = localHistory[localHistory.Count - indexesToCheck][handLeftID].Position;
+            startPoint = localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position;
 
             //De la position p1 à pn, on suit l'algorithme.
             for (int i = localHistory.Count - indexesToCheck + 1; i < localHistory.Count; i++)
             {
-                //Debug temporaire pour vérifier la validité de certaines contraintes durant la gesture.
-                /*if (localHistory[i][handLeftID].Position.Y > localHistory[i][headID].Position.Y)
-                    debug.R1.Fill = System.Windows.Media.Brushes.Cyan;
-                else
-                    debug.R1.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if (localHistory[i][handLeftID].Position.Y < localHistory[i][hipCenterID].Position.Y)
-                    debug.R2.Fill = System.Windows.Media.Brushes.Cyan;
-                else
-                    debug.R2.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if (localHistory[i][handLeftID].Position.X > localHistory[i - 1][handLeftID].Position.X)
-                    debug.R3.Fill = System.Windows.Media.Brushes.Cyan;
-                else
-                    debug.R3.Fill = System.Windows.Media.Brushes.DarkGray;
-
-                if (Math.Abs(localHistory[i][handLeftID].Position.Y - startPoint.Y) < refDistance / 2)
-                    debug.R4.Fill = System.Windows.Media.Brushes.Cyan;
-                else
-                    debug.R4.Fill = System.Windows.Media.Brushes.DarkGray;*/
-
                 //Si la position Y de la main est plus haute que la tête
                 //OU si la position Y de la main est plus basse que la hanche
                 //OU si la nouvelle position X de la main est à gauche de la précédente
                 //OU si la nouvelle position Y de la main est plus éloignée de la distance N par rapport à la première position Y
                 //Alors on retourne faux.
-                if (localHistory[i][handLeftID].Position.Y < localHistory[i][headID].Position.Y ||
-                localHistory[i][handLeftID].Position.Y > localHistory[i][hipCenterID].Position.Y ||
-                localHistory[i][handLeftID].Position.X < localHistory[i - 1][handLeftID].Position.X ||
-                Math.Abs(localHistory[i][handLeftID].Position.Y - startPoint.Y) > refDistance / 2)
+                if (localHistory[i][(int)JointType.HandLeft].Position.Y < localHistory[i][(int)JointType.Head].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.Y > localHistory[i][(int)JointType.HipCenter].Position.Y ||
+                localHistory[i][(int)JointType.HandLeft].Position.X < localHistory[i - 1][(int)JointType.HandLeft].Position.X ||
+                Math.Abs(localHistory[i][(int)JointType.HandLeft].Position.Y - startPoint.Y) > refDistance / 2)
                     return false;
             }
 
             //Si la distance horizontale du geste a été plus courte que la distance N
             //Alors on retourne faux.
-            //float dist = (localHistory[localHistory.Count - 1][handLeftID].Position.X - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X);
-
-            if (Math.Abs(localHistory[0][handLeftID].Position.X - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X) < refDistance / 2)
+            if (Math.Abs(localHistory[0][(int)JointType.HandLeft].Position.X - localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.X) < refDistance / 2)
                 return false;
 
             //Si la dernière position de la main droite est sur le côté gauche du corps
             //OU si la première position calculée de la main droite est sur le côté droit du corps
             //Alors on retourne faux.
-            if (localHistory[localHistory.Count - 1][handLeftID].Position.X < localHistory[localHistory.Count - 1][hipCenterID].Position.X ||
-               localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X > localHistory[localHistory.Count - 1][hipCenterID].Position.X)
+            if (localHistory[localHistory.Count - 1][(int)JointType.HandLeft].Position.X < localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X ||
+               localHistory[localHistory.Count - indexesToCheck][(int)JointType.HandLeft].Position.X > localHistory[localHistory.Count - 1][(int)JointType.HipCenter].Position.X)
                 return false;
 
-            //System.Console.Out.WriteLine(Math.Abs(localHistory[0][handLeftID].Position.X - localHistory[localHistory.Count - indexesToCheck][handLeftID].Position.X) + " < " + refDistance / 2);
             //On supprime l'historique local.
             localHistory.Clear();
             //Si on est arrivé jusqu'ici, toutes les conditions pour un swipe right ont été remplies.
--- a/middleware/src/Tracking/KinectMain.cs	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Tracking/KinectMain.cs	Mon Mar 19 10:21:56 2012 +0100
@@ -96,14 +96,7 @@
         public static event PushHandler PushEvent;
         //L'événement jump.
         public static event JumpHandler JumpEvent;
-            
-        //Voici les ID des noeuds d'un squelette.
-        public int hipCenterID = 0, spineID = 1, shoulderCenterID = 2, headID = 3;
-        public int shoulderLeftID = 4, elbowLeftID = 5, wristLeftID = 6, handLeftID = 7;
-        public int shoulderRightID = 8, elbowRightID = 9, wristRightID = 10, handRightID = 11;
-        public int hipLeftID = 12, kneeLeftID = 13, ankleLeftID = 14, footLeftID = 15;
-        public int hipRightID = 16, kneeRightID = 17, ankleRightID = 18, footRightID = 19;
-        
+
         private string connexionHost;
         private int connexionPort;
 
@@ -114,9 +107,8 @@
         */
         public KinectMain()
         {
-            //Si on n'a pas fait appel au gestionnaire de ressources avant, on le fait là.
-            if(rm == null)
-                rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
+            //On fait appel au gestionnaire de ressources.
+            rm = new ResourceManager("Trakers.Properties.resources", Assembly.GetExecutingAssembly());
             //On crée la fenêtre de debug.
             debug = new Debug.DebugWindow(this);
             
@@ -220,7 +212,7 @@
             JumpEvent += new JumpHandler(jumpListener.ShowOnScreen);
 
             //On connecte le serveur à l'adresse locale sur le port 80.
-            server = new Server(connexionHost, connexionPort, timerElapsing);
+            server = new Server(connexionHost, connexionPort, timerElapsing, debug);
         }
 
         /*
@@ -330,35 +322,35 @@
             if (first.TrackingState == SkeletonTrackingState.Tracked)
             {
                 //Ensemble des noeuds du squelette.
-                Joint hipCenter = getJoint(first, hipCenterID), spine = getJoint(first, spineID), shoulderCenter = getJoint(first, shoulderCenterID), head = getJoint(first, headID);
-                Joint shoulderLeft = getJoint(first, shoulderLeftID), elbowLeft = getJoint(first, elbowLeftID), wristLeft = getJoint(first, wristLeftID), handLeft = getJoint(first, handLeftID);
-                Joint shoulderRight = getJoint(first, shoulderRightID), elbowRight = getJoint(first, elbowRightID), wristRight = getJoint(first, wristRightID), handRight = getJoint(first, handRightID);
-                Joint hipLeft = getJoint(first, hipLeftID), kneeLeft = getJoint(first, kneeLeftID), ankleLeft = getJoint(first, ankleLeftID), footLeft = getJoint(first, footLeftID);
-                Joint hipRight = getJoint(first, hipRightID), kneeRight = getJoint(first, kneeRightID), ankleRight = getJoint(first, ankleRightID), footRight = getJoint(first, footRightID);
+                Joint hipCenter = getJoint(first, JointType.HipCenter), spine = getJoint(first, JointType.Spine), shoulderCenter = getJoint(first, JointType.ShoulderCenter), head = getJoint(first, JointType.Head);
+                Joint shoulderLeft = getJoint(first, JointType.ShoulderLeft), elbowLeft = getJoint(first, JointType.ElbowLeft), wristLeft = getJoint(first, JointType.WristLeft), handLeft = getJoint(first, JointType.HandLeft);
+                Joint shoulderRight = getJoint(first, JointType.ShoulderRight), elbowRight = getJoint(first, JointType.ElbowRight), wristRight = getJoint(first, JointType.WristRight), handRight = getJoint(first, JointType.HandRight);
+                Joint hipLeft = getJoint(first, JointType.HipLeft), kneeLeft = getJoint(first, JointType.KneeLeft), ankleLeft = getJoint(first, JointType.AnkleLeft), footLeft = getJoint(first, JointType.FootLeft);
+                Joint hipRight = getJoint(first, JointType.HipRight), kneeRight = getJoint(first, JointType.KneeRight), ankleRight = getJoint(first, JointType.AnkleRight), footRight = getJoint(first, JointType.FootRight);
 
                 //On construit l'historique des postures.
                 List<Joint> joints = new List<Joint>();
                 joints.Clear();
-                joints.Insert(hipCenterID, hipCenter);
-                joints.Insert(spineID, spine);
-                joints.Insert(shoulderCenterID, shoulderCenter);
-                joints.Insert(headID, head);
-                joints.Insert(shoulderLeftID, shoulderLeft);
-                joints.Insert(elbowLeftID, elbowLeft);
-                joints.Insert(wristLeftID, wristLeft);
-                joints.Insert(handLeftID, handLeft);
-                joints.Insert(shoulderRightID, shoulderRight);
-                joints.Insert(elbowRightID, elbowRight);
-                joints.Insert(wristRightID, wristRight);
-                joints.Insert(handRightID, handRight);
-                joints.Insert(hipLeftID, hipLeft);
-                joints.Insert(kneeLeftID, kneeLeft);
-                joints.Insert(ankleLeftID, ankleLeft);
-                joints.Insert(footLeftID, footLeft);
-                joints.Insert(hipRightID, hipRight);
-                joints.Insert(kneeRightID, kneeRight);
-                joints.Insert(ankleRightID, ankleRight);
-                joints.Insert(footRightID, footRight);
+                joints.Insert((int)JointType.HipCenter, hipCenter);
+                joints.Insert((int)JointType.Spine, spine);
+                joints.Insert((int)JointType.ShoulderCenter, shoulderCenter);
+                joints.Insert((int)JointType.Head, head);
+                joints.Insert((int)JointType.ShoulderLeft, shoulderLeft);
+                joints.Insert((int)JointType.ElbowLeft, elbowLeft);
+                joints.Insert((int)JointType.WristLeft, wristLeft);
+                joints.Insert((int)JointType.HandLeft, handLeft);
+                joints.Insert((int)JointType.ShoulderRight, shoulderRight);
+                joints.Insert((int)JointType.ElbowRight, elbowRight);
+                joints.Insert((int)JointType.WristRight, wristRight);
+                joints.Insert((int)JointType.HandRight, handRight);
+                joints.Insert((int)JointType.HipLeft, hipLeft);
+                joints.Insert((int)JointType.KneeLeft, kneeLeft);
+                joints.Insert((int)JointType.AnkleLeft, ankleLeft);
+                joints.Insert((int)JointType.FootLeft, footLeft);
+                joints.Insert((int)JointType.HipRight, hipRight);
+                joints.Insert((int)JointType.KneeRight, kneeRight);
+                joints.Insert((int)JointType.AnkleRight, ankleRight);
+                joints.Insert((int)JointType.FootRight, footRight);
                 GestureDetector.UpdateSkeletonHistory(joints);
                 
                 //On obtient sa distance à la Kinect.
@@ -437,9 +429,9 @@
         /*
         *  Change l'échelle des coordonnées d'un noeud pour qu'en X et Y il corresponde à la résolution et en Z à la distance à la Kinect.
         */
-        public Joint getJoint(Skeleton ske, int jointID)
+        public Joint getJoint(Skeleton ske, JointType jointID)
         {
-            return Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(ske.Joints.ElementAt(jointID), 600, 400, 0.75f, 0.75f);
+            return Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(ske.Joints[jointID], 600, 400, 0.75f, 0.75f);
         }
 
         /*
@@ -516,26 +508,6 @@
                 maxDistHands = (float)double.Parse(ConfigurationManager.AppSettings["searchMaxDistance"]);
                 connexionHost = ConfigurationManager.AppSettings["connexionHost"];
                 connexionPort = int.Parse(ConfigurationManager.AppSettings["connexionPort"]);
-                hipCenterID = int.Parse(ConfigurationManager.AppSettings["hipCenterID"]);
-                spineID = int.Parse(ConfigurationManager.AppSettings["spineID"]);
-                shoulderCenterID = int.Parse(ConfigurationManager.AppSettings["shoulderCenterID"]);
-                headID = int.Parse(ConfigurationManager.AppSettings["headID"]);
-                shoulderLeftID = int.Parse(ConfigurationManager.AppSettings["shoulderLeftID"]);
-                elbowLeftID = int.Parse(ConfigurationManager.AppSettings["elbowLeftID"]);
-                wristLeftID = int.Parse(ConfigurationManager.AppSettings["wristLeftID"]);
-                handLeftID = int.Parse(ConfigurationManager.AppSettings["handLeftID"]);
-                shoulderRightID = int.Parse(ConfigurationManager.AppSettings["shoulderRightID"]);
-                elbowRightID = int.Parse(ConfigurationManager.AppSettings["elbowRightID"]);
-                wristRightID = int.Parse(ConfigurationManager.AppSettings["wristRightID"]);
-                handRightID = int.Parse(ConfigurationManager.AppSettings["handRightID"]);
-                hipLeftID = int.Parse(ConfigurationManager.AppSettings["hipLeftID"]);
-                kneeLeftID = int.Parse(ConfigurationManager.AppSettings["kneeLeftID"]);
-                ankleLeftID = int.Parse(ConfigurationManager.AppSettings["ankleLeftID"]);
-                footLeftID = int.Parse(ConfigurationManager.AppSettings["footLeftID"]);
-                hipRightID = int.Parse(ConfigurationManager.AppSettings["hipRightID"]);
-                kneeRightID = int.Parse(ConfigurationManager.AppSettings["kneeRightID"]);
-                ankleRightID = int.Parse(ConfigurationManager.AppSettings["ankleRightID"]);
-                footRightID = int.Parse(ConfigurationManager.AppSettings["footRightID"]);
                 timerElapsing = int.Parse(ConfigurationManager.AppSettings["timerElapsing"]);
             }
             catch (Exception)
@@ -550,5 +522,74 @@
             }
             return true;
         }
+
+        /*
+         * Met à jour les nouveaux paramètres dans la configuration.
+         */
+        public void updateParameters()
+        {
+            //On récupère la config.
+            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
+            //On met à jour.
+            config.AppSettings.Settings.Remove("searchMinDistance");
+            config.AppSettings.Settings.Add("searchMinDistance", minDistHands.ToString());
+            config.AppSettings.Settings.Remove("searchMaxDistance");
+            config.AppSettings.Settings.Add("searchMaxDistance", maxDistHands.ToString());
+            config.AppSettings.Settings.Remove("connexionHost");
+            config.AppSettings.Settings.Add("connexionHost", connexionHost);
+            config.AppSettings.Settings.Remove("connexionPort");
+            config.AppSettings.Settings.Add("connexionPort", connexionPort.ToString());
+            config.AppSettings.Settings.Remove("timerElapsing");
+            config.AppSettings.Settings.Add("timerElapsing", timerElapsing.ToString());
+
+            //Sauvegarde la configuration.
+            config.Save(ConfigurationSaveMode.Modified);
+            ConfigurationManager.RefreshSection("appSettings");
+        }
+
+        /*
+         * Getters et setters des paramètres du Middleware.
+         */
+        public void setMinDistHands(float min)
+        {
+            minDistHands = min;
+        }
+        public void setMaxDistHands(float max)
+        {
+            maxDistHands = max;
+        }
+        public void setConnexionHost(String host)
+        {
+            connexionHost = host;
+        }
+        public void setConnexionPort(int port)
+        {
+            connexionPort = port;
+        }
+        public void setTimerElapsing(int time)
+        {
+            timerElapsing = time;
+        }
+
+        public float getMinDistHands()
+        {
+            return minDistHands;
+        }
+        public float getMaxDistHands()
+        {
+            return maxDistHands;
+        }
+        public String getConnexionHost()
+        {
+            return connexionHost;
+        }
+        public int getConnexionPort()
+        {
+            return connexionPort;
+        }
+        public int getTimerElapsing()
+        {
+            return timerElapsing;
+        }
     }
 }
--- a/middleware/src/Trakers.csproj	Thu Mar 15 13:35:25 2012 +0100
+++ b/middleware/src/Trakers.csproj	Mon Mar 19 10:21:56 2012 +0100
@@ -6,7 +6,7 @@
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{09EF8613-2F1B-4F1D-B6B1-22938EBB529A}</ProjectGuid>
-    <OutputType>Exe</OutputType>
+    <OutputType>WinExe</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Trakers</RootNamespace>
     <AssemblyName>Trakers</AssemblyName>
@@ -77,6 +77,9 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Communication\Server.cs" />
+    <Compile Include="Debug\DebugParameters.xaml.cs">
+      <DependentUpon>DebugParameters.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Debug\DebugWindow.xaml.cs">
       <DependentUpon>DebugWindow.xaml</DependentUpon>
     </Compile>
@@ -136,6 +139,10 @@
   </ItemGroup>
   <ItemGroup />
   <ItemGroup>
+    <Page Include="Debug\DebugParameters.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Debug\DebugWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>