From 5326981d8febc88acc04b86e5bc237cd372dfb50 Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Sat, 3 Feb 2024 11:23:58 +0100 Subject: [PATCH] UPDATE(AllStreamsWork): Add all classes, methods and variable with not implemented exceptions so the architecture's already done --- Sources/ConsoleApp/ConsoleApp.csproj | 4 --- Sources/ConsoleApp/Program.cs | 1 - Sources/KinectUtils/AllGesturesFactory.cs | 16 +++++++++ Sources/KinectUtils/BaseGesture.cs | 2 +- Sources/KinectUtils/BaseMapping.cs | 33 +++++++++++++++++ Sources/KinectUtils/Gesture.cs | 34 ++++++++++++++++++ Sources/KinectUtils/GestureManager.cs | 36 +++++++++++++++++++ Sources/KinectUtils/IGestureFactory.cs | 13 +++++++ Sources/KinectUtils/KinectUtils.csproj | 12 +++++++ .../Posture.cs | 9 ++--- Sources/LibMyGesturesBank/BaseGesture.cs | 29 --------------- .../LibMyGesturesBank/MyGesturesBank.csproj | 8 +++-- Sources/LibMyGesturesBank/PostureHandUp.cs | 6 +--- .../LibMyGesturesBank/PostureHandsOnHead .cs | 5 +-- Sources/LibMyGesturesBank/RightHandUp.cs | 12 +++++++ Sources/LibMyGesturesBank/TwoHandsDragon.cs | 12 +++++++ 16 files changed, 180 insertions(+), 52 deletions(-) create mode 100644 Sources/KinectUtils/AllGesturesFactory.cs create mode 100644 Sources/KinectUtils/BaseMapping.cs create mode 100644 Sources/KinectUtils/Gesture.cs create mode 100644 Sources/KinectUtils/GestureManager.cs create mode 100644 Sources/KinectUtils/IGestureFactory.cs rename Sources/{LibMyGesturesBank => KinectUtils}/Posture.cs (75%) delete mode 100644 Sources/LibMyGesturesBank/BaseGesture.cs create mode 100644 Sources/LibMyGesturesBank/RightHandUp.cs create mode 100644 Sources/LibMyGesturesBank/TwoHandsDragon.cs diff --git a/Sources/ConsoleApp/ConsoleApp.csproj b/Sources/ConsoleApp/ConsoleApp.csproj index 9d5a7f0..11b775b 100644 --- a/Sources/ConsoleApp/ConsoleApp.csproj +++ b/Sources/ConsoleApp/ConsoleApp.csproj @@ -54,10 +54,6 @@ - - {2496dfb1-eb55-47a1-a780-211e079b289d} - MyGesturesBank - {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/ConsoleApp/Program.cs b/Sources/ConsoleApp/Program.cs index b02defb..fb7ff8d 100644 --- a/Sources/ConsoleApp/Program.cs +++ b/Sources/ConsoleApp/Program.cs @@ -1,5 +1,4 @@ using Lib; -using LibMyGesturesBank; using Microsoft.Kinect; using System; using System.Collections.Generic; diff --git a/Sources/KinectUtils/AllGesturesFactory.cs b/Sources/KinectUtils/AllGesturesFactory.cs new file mode 100644 index 0000000..970478a --- /dev/null +++ b/Sources/KinectUtils/AllGesturesFactory.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KinectUtils +{ + public class AllGesturesFactory : IGestureFactory + { + public IEnumerable CreateGestures() + { + throw new NotImplementedException(); + } + } +} diff --git a/Sources/KinectUtils/BaseGesture.cs b/Sources/KinectUtils/BaseGesture.cs index 398b729..c12223a 100644 --- a/Sources/KinectUtils/BaseGesture.cs +++ b/Sources/KinectUtils/BaseGesture.cs @@ -1,7 +1,7 @@ using System; using Microsoft.Kinect; -namespace LibMyGesturesBank +namespace KinectUtils { public abstract class BaseGesture { diff --git a/Sources/KinectUtils/BaseMapping.cs b/Sources/KinectUtils/BaseMapping.cs new file mode 100644 index 0000000..8d16076 --- /dev/null +++ b/Sources/KinectUtils/BaseMapping.cs @@ -0,0 +1,33 @@ +using Microsoft.Kinect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KinectUtils +{ + class BaseMapping + { + public void SubscribeToStartGesture(BaseGesture gesture) + { + throw new NotImplementedException(); + } + public void SubscribeToEndGesture(BaseGesture gesture) + { + throw new NotImplementedException(); + } + public void SubscribeToToggleGesture(BaseGesture gesture) + { + throw new NotImplementedException(); + } + protected T Mapping(Body body) + { + throw new NotImplementedException(); + } + public bool TestMapping(Body body, out T output) + { + throw new NotImplementedException(); + } + } +} diff --git a/Sources/KinectUtils/Gesture.cs b/Sources/KinectUtils/Gesture.cs new file mode 100644 index 0000000..f1140b3 --- /dev/null +++ b/Sources/KinectUtils/Gesture.cs @@ -0,0 +1,34 @@ +using Microsoft.Kinect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KinectUtils +{ + abstract class Gesture : BaseGesture + { + protected int _maxNbOfFrames; + protected int _minNbOfFrames; + private int currentFrameCount; + public bool isRecognitionRunning { get; set; } + public int MinNbOfFrames { + get { return _minNbOfFrames; } + private set { _minNbOfFrames = value; } + } + public int MaxNbOfFrames + { + get { return _maxNbOfFrames; } + private set { _maxNbOfFrames = value; } + } + public override void TestGesture(Body body) + { + + } + abstract protected bool TestInitialConditions(Body body); + abstract protected bool TestPosture(Body body); + abstract protected bool TestRunningGesture(Body body); + abstract protected bool TestEndConditions(Body body); + } +} diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs new file mode 100644 index 0000000..d9e08a5 --- /dev/null +++ b/Sources/KinectUtils/GestureManager.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Lib; + +namespace KinectUtils +{ + static class GestureManager + { + static event EventHandler GestureRecognized; + static KinectManager KinectManager { get; set; } + static List KnownGestures { get; set; } + + static public void AddGestures(IGestureFactory factory) + { + KnownGestures = (List)factory.CreateGestures(); + } + static public void AddGestures(params BaseGesture[] gestures) + { + foreach (var gesture in gestures) + { + KnownGestures.Add(gesture); + } + } + static public void RemoveGesture(BaseGesture gesture) + { + KnownGestures.Remove(gesture); + } + static public void StartAcquiringFrames(KinectManager kinectManager) + { + throw new NotImplementedException(); + } + } +} diff --git a/Sources/KinectUtils/IGestureFactory.cs b/Sources/KinectUtils/IGestureFactory.cs new file mode 100644 index 0000000..f78c453 --- /dev/null +++ b/Sources/KinectUtils/IGestureFactory.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KinectUtils +{ + interface IGestureFactory + { + IEnumerable CreateGestures(); + } +} diff --git a/Sources/KinectUtils/KinectUtils.csproj b/Sources/KinectUtils/KinectUtils.csproj index edfe356..c64f282 100644 --- a/Sources/KinectUtils/KinectUtils.csproj +++ b/Sources/KinectUtils/KinectUtils.csproj @@ -42,8 +42,20 @@ + + + + + + + + + {0751c83e-7845-4e5f-a5d3-e11aba393aca} + Lib + + \ No newline at end of file diff --git a/Sources/LibMyGesturesBank/Posture.cs b/Sources/KinectUtils/Posture.cs similarity index 75% rename from Sources/LibMyGesturesBank/Posture.cs rename to Sources/KinectUtils/Posture.cs index 8b06698..a95b2c6 100644 --- a/Sources/LibMyGesturesBank/Posture.cs +++ b/Sources/KinectUtils/Posture.cs @@ -1,13 +1,12 @@ -using System; +using Microsoft.Kinect; +using System; using System.Collections.Generic; using System.Linq; using System.Text; -using Microsoft.Kinect; using System.Threading.Tasks; -namespace MyGesturesBank +namespace KinectUtils { - public abstract class Posture : BaseGesture { protected abstract bool TestPosture(Body body); @@ -21,7 +20,5 @@ namespace MyGesturesBank } } - // Ajoutez ici d'autres méthodes ou propriétés nécessaires } - } diff --git a/Sources/LibMyGesturesBank/BaseGesture.cs b/Sources/LibMyGesturesBank/BaseGesture.cs deleted file mode 100644 index 3134dd3..0000000 --- a/Sources/LibMyGesturesBank/BaseGesture.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Kinect; - -namespace MyGesturesBank -{ - public abstract class BaseGesture - { - // Événement déclenché lorsque le geste est reconnu - public event EventHandler GestureRecognized; - - // Nom du geste - marqué comme virtual pour permettre la substitution - public virtual string GestureName { get; protected set; } - - // Méthode abstraite pour tester le geste - public abstract void TestGesture(Body body); - - // Méthode protégée pour déclencher l'événement GestureRecognized - protected virtual void OnGestureRecognized() - { - GestureRecognized?.Invoke(this, EventArgs.Empty); - } - } - - -} diff --git a/Sources/LibMyGesturesBank/MyGesturesBank.csproj b/Sources/LibMyGesturesBank/MyGesturesBank.csproj index a3c5d5b..7a43ab1 100644 --- a/Sources/LibMyGesturesBank/MyGesturesBank.csproj +++ b/Sources/LibMyGesturesBank/MyGesturesBank.csproj @@ -44,13 +44,17 @@ - - + + + + {2d44487e-f514-4063-9494-2af1e8c9e9c8} + KinectUtils + {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/PostureHandUp.cs b/Sources/LibMyGesturesBank/PostureHandUp.cs index fae339f..54b1a6e 100644 --- a/Sources/LibMyGesturesBank/PostureHandUp.cs +++ b/Sources/LibMyGesturesBank/PostureHandUp.cs @@ -1,9 +1,5 @@ using Microsoft.Kinect; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using KinectUtils; namespace MyGesturesBank { diff --git a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs index c4937ce..7ad19b9 100644 --- a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs +++ b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs @@ -1,9 +1,6 @@ using Microsoft.Kinect; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using KinectUtils; namespace MyGesturesBank { diff --git a/Sources/LibMyGesturesBank/RightHandUp.cs b/Sources/LibMyGesturesBank/RightHandUp.cs new file mode 100644 index 0000000..259d3a5 --- /dev/null +++ b/Sources/LibMyGesturesBank/RightHandUp.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibMyGesturesBank +{ + internal class RightHandUp + { + } +} diff --git a/Sources/LibMyGesturesBank/TwoHandsDragon.cs b/Sources/LibMyGesturesBank/TwoHandsDragon.cs new file mode 100644 index 0000000..a5e9d5f --- /dev/null +++ b/Sources/LibMyGesturesBank/TwoHandsDragon.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibMyGesturesBank +{ + internal class TwoHandsDragon + { + } +}