From c54a3efd48eadd659f4ece987c57116189ce8dd1 Mon Sep 17 00:00:00 2001 From: "louis.dufour" Date: Wed, 7 Feb 2024 08:15:19 +0100 Subject: [PATCH] =?UTF-8?q?ToFix(dev):=20d=C3=A9but=20archi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/KinectUtils/AllGesturesFactory.cs | 8 +++- Sources/KinectUtils/GestureManager.cs | 29 +++++++++----- Sources/KinectUtils/KinectUtils.csproj | 4 ++ .../LibMyGesturesBank/MyGesturesBank.csproj | 5 +-- Sources/LibMyGesturesBank/RightHandUp.cs | 2 +- Sources/LibMyGesturesBank/SwipeRightHand.cs | 38 +++++++++++++++++++ Sources/LibMyGesturesBank/TwoHandsDragon.cs | 2 +- 7 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 Sources/LibMyGesturesBank/SwipeRightHand.cs diff --git a/Sources/KinectUtils/AllGesturesFactory.cs b/Sources/KinectUtils/AllGesturesFactory.cs index 970478a..719a15e 100644 --- a/Sources/KinectUtils/AllGesturesFactory.cs +++ b/Sources/KinectUtils/AllGesturesFactory.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using MyGesturesBank; namespace KinectUtils { @@ -10,7 +11,12 @@ namespace KinectUtils { public IEnumerable CreateGestures() { - throw new NotImplementedException(); + return new List + { + new SwipeRightHand(), + new ClapHands() + // Ajoutez d'autres gestes ici + }; } } } diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs index d9e08a5..8599a34 100644 --- a/Sources/KinectUtils/GestureManager.cs +++ b/Sources/KinectUtils/GestureManager.cs @@ -7,27 +7,36 @@ using Lib; namespace KinectUtils { - static class GestureManager + public static class GestureManager { - static event EventHandler GestureRecognized; - static KinectManager KinectManager { get; set; } - static List KnownGestures { get; set; } + public static event EventHandler GestureRecognized; + public static List KnownGestures = new List(); - static public void AddGestures(IGestureFactory factory) + public static void AddGestures(IGestureFactory factory) { - KnownGestures = (List)factory.CreateGestures(); + var gestures = factory.CreateGestures(); + foreach (var gesture in gestures) + { + AddGesture(gesture); + } } - static public void AddGestures(params BaseGesture[] gestures) + public static void AddGesture(BaseGesture gesture) { - foreach (var gesture in gestures) + if (!KnownGestures.Contains(gesture)) { KnownGestures.Add(gesture); + gesture.GestureRecognized += (sender, e) => GestureRecognized?.Invoke(sender, e); } } - static public void RemoveGesture(BaseGesture gesture) + public static void RemoveGesture(BaseGesture gesture) { - KnownGestures.Remove(gesture); + if (KnownGestures.Contains(gesture)) + { + KnownGestures.Remove(gesture); + gesture.GestureRecognized -= (sender, e) => GestureRecognized?.Invoke(sender, e); + } } + static public void StartAcquiringFrames(KinectManager kinectManager) { throw new NotImplementedException(); diff --git a/Sources/KinectUtils/KinectUtils.csproj b/Sources/KinectUtils/KinectUtils.csproj index c64f282..8343b15 100644 --- a/Sources/KinectUtils/KinectUtils.csproj +++ b/Sources/KinectUtils/KinectUtils.csproj @@ -52,6 +52,10 @@ + + {2496dfb1-eb55-47a1-a780-211e079b289d} + MyGesturesBank + {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/MyGesturesBank.csproj b/Sources/LibMyGesturesBank/MyGesturesBank.csproj index 7a43ab1..0601293 100644 --- a/Sources/LibMyGesturesBank/MyGesturesBank.csproj +++ b/Sources/LibMyGesturesBank/MyGesturesBank.csproj @@ -48,13 +48,10 @@ + - - {2d44487e-f514-4063-9494-2af1e8c9e9c8} - KinectUtils - {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/RightHandUp.cs b/Sources/LibMyGesturesBank/RightHandUp.cs index 259d3a5..1c6734a 100644 --- a/Sources/LibMyGesturesBank/RightHandUp.cs +++ b/Sources/LibMyGesturesBank/RightHandUp.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LibMyGesturesBank +namespace MyGesturesBank { internal class RightHandUp { diff --git a/Sources/LibMyGesturesBank/SwipeRightHand.cs b/Sources/LibMyGesturesBank/SwipeRightHand.cs new file mode 100644 index 0000000..d58ddd0 --- /dev/null +++ b/Sources/LibMyGesturesBank/SwipeRightHand.cs @@ -0,0 +1,38 @@ +using KinectUtils; +using Microsoft.Kinect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyGesturesBank +{ + public class SwipeRightHand : Gesture + { + protected override bool TestInitialConditions(Body body) + { + // Implémentez la logique pour vérifier les conditions initiales du balayage à droite + return false; + } + + protected override bool TestPosture(Body body) + { + // Implémentez la vérification de la posture pour le balayage à droite + return false; + } + + protected override bool TestRunningGesture(Body body) + { + // Implémentez la dynamique du geste de balayage à droite + return false; + } + + protected override bool TestEndConditions(Body body) + { + // Vérifiez si les conditions de fin du geste de balayage à droite sont remplies + return false; + } + } + +} diff --git a/Sources/LibMyGesturesBank/TwoHandsDragon.cs b/Sources/LibMyGesturesBank/TwoHandsDragon.cs index a5e9d5f..6cafd63 100644 --- a/Sources/LibMyGesturesBank/TwoHandsDragon.cs +++ b/Sources/LibMyGesturesBank/TwoHandsDragon.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LibMyGesturesBank +namespace MyGesturesBank { internal class TwoHandsDragon {