|
28
|
1 |
/* |
|
15
|
2 |
* This file is part of the TraKERS\Middleware package. |
|
|
3 |
* |
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
|
5 |
* |
|
27
|
6 |
* For the full copyright and license information, please view the LICENSE |
|
15
|
7 |
* file that was distributed with this source code. |
|
|
8 |
*/ |
|
|
9 |
/* |
|
|
10 |
* Projet : TraKERS |
|
|
11 |
* Module : MIDDLEWARE |
|
|
12 |
* Sous-Module : Tracking |
|
|
13 |
* Classe : KinectMain |
|
|
14 |
* |
|
|
15 |
* Auteur : alexandre.bastien@iri.centrepompidou.fr |
|
|
16 |
* |
|
|
17 |
* Fonctionnalités : Récupère les trames de données de la Kinect, les squelettes détectés via le SDK 1.0 de Microsoft. |
|
|
18 |
* Interprète ces trames de façon à afficher le flux vidéo couleurs, et récupérer la distance de l'utilisateur et les |
|
|
19 |
* noeuds de son squelette. Lance des événements lorsque la main gauche/droite entre dans/quitte le champ. |
|
|
20 |
* Envoie des données au sous-module de debug de manière a afficher un retour visuel sur la position de l'utilisateur, |
|
|
21 |
* son squelette, la détection de ses mains. |
|
|
22 |
* Découpe l'interaction avec le middleware en différents modes. |
|
|
23 |
*/ |
|
|
24 |
using System; |
|
|
25 |
using System.Collections.Generic; |
|
|
26 |
using System.Linq; |
|
37
|
27 |
using System.Windows; |
|
15
|
28 |
using Microsoft.Kinect; |
|
|
29 |
using Trakers.Communication; |
|
37
|
30 |
using Trakers.Debug; |
|
15
|
31 |
using Trakers.MainModule.Events; |
|
17
|
32 |
using Trakers.Tracking.Gestures; |
|
|
33 |
using Trakers.Tracking.Postures; |
|
15
|
34 |
|
|
|
35 |
namespace Trakers.MainModule |
|
|
36 |
{ |
|
|
37 |
//Il s'agit des fonctions permettant d'appeler les fonctions des événements Main droite/gauche entre/quitte le champ. |
|
|
38 |
public delegate void LeftHandTrackedHandler(object o, LeftHandTrackedEventArgs e); |
|
|
39 |
public delegate void RightHandTrackedHandler(object o, RightHandTrackedEventArgs e); |
|
|
40 |
public delegate void LeftHandQuitHandler(object o, LeftHandQuitEventArgs e); |
|
|
41 |
public delegate void RightHandQuitHandler(object o, RightHandQuitEventArgs e); |
|
17
|
42 |
|
|
|
43 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Bend. |
|
|
44 |
public delegate void BendHandler(object o, BendEventArgs e); |
|
|
45 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Cross. |
|
|
46 |
public delegate void CrossHandler(object o, CrossEventArgs e); |
|
|
47 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements KneeUp. |
|
|
48 |
public delegate void KneeUpHandler(object o, KneeUpEventArgs e); |
|
|
49 |
|
|
15
|
50 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Swipe left/right/up/down. |
|
|
51 |
public delegate void SwipeHandler(object o, SwipeEventArgs e); |
|
|
52 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Push/Pull. |
|
|
53 |
public delegate void PushHandler(object o, PushEventArgs e); |
|
|
54 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Jump. |
|
|
55 |
public delegate void JumpHandler(object o, JumpEventArgs e); |
|
37
|
56 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Fall. |
|
|
57 |
public delegate void FallHandler(object o, FallEventArgs e); |
|
17
|
58 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Wave. |
|
|
59 |
public delegate void WaveHandler(object o, WaveEventArgs e); |
|
|
60 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements Circle. |
|
|
61 |
public delegate void CircleHandler(object o, CircleEventArgs e); |
|
15
|
62 |
//Il s'agit de la fonction permettant d'appeler les fonctions des événements de proximité. |
|
|
63 |
public delegate void UserPositionHandler(object o, UserPositionEventArgs e); |
|
|
64 |
|
|
|
65 |
public class KinectMain |
|
|
66 |
{ |
|
|
67 |
//Fenêtre de debug. |
|
|
68 |
private DebugWindow debug; |
|
|
69 |
//Squelettes (Il y en a 6 par défaut). |
|
|
70 |
private Skeleton[] skeletons; |
|
|
71 |
//Caméra infrarouge (sensor) de la Kinect. |
|
|
72 |
private KinectSensor kinectSensor; |
|
|
73 |
|
|
17
|
74 |
//Détecteur de penchés. |
|
|
75 |
private BendDetector bendDetector; |
|
|
76 |
//Détecteur de croisement de bras en X. |
|
|
77 |
private CrossDetector crossDetector; |
|
|
78 |
//Détecteur de levé de genou. |
|
|
79 |
private KneeUpDetector kneeUpDetector; |
|
37
|
80 |
//Détecteur de position correcte. |
|
|
81 |
private CorrectPosture correctPostureDetector; |
|
17
|
82 |
|
|
15
|
83 |
//Détecteur de swipes. |
|
|
84 |
private SwipeDetector swipeDetector; |
|
|
85 |
//Détecteur de pushes. |
|
|
86 |
private PushDetector pushDetector; |
|
|
87 |
//Détecteur de jumps. |
|
|
88 |
private JumpDetector jumpDetector; |
|
37
|
89 |
//Détecteur de falls. |
|
|
90 |
private FallDetector fallDetector; |
|
17
|
91 |
//Détecteur de waves. |
|
|
92 |
private WaveDetector waveDetector; |
|
|
93 |
//Détecteur de cercles. |
|
|
94 |
private CircleDetector circleDetector; |
|
15
|
95 |
//Détecteur de proximité. |
|
|
96 |
private UserPositionDetector userPositionDetector; |
|
|
97 |
|
|
|
98 |
//Serveur TUIO pour la connexion du Middleware vers le Front Atelier. |
|
|
99 |
private Server server; |
|
|
100 |
|
|
|
101 |
//Gestionnaire de modes. |
|
|
102 |
private ModeManagement modeManagement; |
|
|
103 |
|
|
|
104 |
//Les événements des mains pour la recherche. |
|
|
105 |
public static event LeftHandTrackedHandler LeftHandTrackedEvent; |
|
|
106 |
public static event RightHandTrackedHandler RightHandTrackedEvent; |
|
|
107 |
public static event LeftHandQuitHandler LeftHandQuitEvent; |
|
|
108 |
public static event RightHandQuitHandler RightHandQuitEvent; |
|
17
|
109 |
|
|
|
110 |
//L'événement bend. |
|
|
111 |
public static event BendHandler BendEvent; |
|
|
112 |
//L'événement cross. |
|
|
113 |
public static event CrossHandler CrossEvent; |
|
|
114 |
//L'événement kneeUp. |
|
|
115 |
public static event KneeUpHandler KneeUpEvent; |
|
|
116 |
|
|
15
|
117 |
//L'événement swipe. |
|
|
118 |
public static event SwipeHandler SwipeEvent; |
|
|
119 |
//L'événement push. |
|
|
120 |
public static event PushHandler PushEvent; |
|
|
121 |
//L'événement jump. |
|
|
122 |
public static event JumpHandler JumpEvent; |
|
37
|
123 |
//L'événement fall. |
|
|
124 |
public static event FallHandler FallEvent; |
|
17
|
125 |
//L'événement wave. |
|
|
126 |
public static event WaveHandler WaveEvent; |
|
|
127 |
//L'événement circle. |
|
|
128 |
public static event CircleHandler CircleEvent; |
|
15
|
129 |
//L'événement l'utilisateur se déplace dans la zone de détection. |
|
|
130 |
public static event UserPositionHandler UserPositionEvent; |
|
|
131 |
|
|
|
132 |
/* |
|
|
133 |
* Initialisation de la classe principale. |
|
|
134 |
* Affiche l'écran de debug dans lequel on voit la distance à la Kinect, |
|
|
135 |
* les mains détectées et le squelette de l'utilisateur. |
|
|
136 |
*/ |
|
|
137 |
public KinectMain() |
|
|
138 |
{ |
|
|
139 |
//On crée la fenêtre de debug. |
|
|
140 |
debug = new DebugWindow(); |
|
|
141 |
|
|
17
|
142 |
//On crée les détecteurs de postures. |
|
|
143 |
bendDetector = new BendDetector(debug); |
|
|
144 |
crossDetector = new CrossDetector(debug); |
|
|
145 |
kneeUpDetector = new KneeUpDetector(debug); |
|
37
|
146 |
correctPostureDetector = new CorrectPosture(debug); |
|
17
|
147 |
|
|
15
|
148 |
//On crée les détecteurs de gestes. |
|
17
|
149 |
swipeDetector = new SwipeDetector(debug); |
|
|
150 |
pushDetector = new PushDetector(debug); |
|
|
151 |
jumpDetector = new JumpDetector(debug); |
|
37
|
152 |
fallDetector = new FallDetector(debug); |
|
17
|
153 |
waveDetector = new WaveDetector(debug); |
|
|
154 |
circleDetector = new CircleDetector(debug); |
|
15
|
155 |
//On crée le détecteur de proximité. |
|
|
156 |
userPositionDetector = new UserPositionDetector(debug.getMinDist(), debug.getMaxDist(), debug.getZeroPoint(), debug.getMinDistHands(), debug.getMaxDistHands()); |
|
|
157 |
|
|
16
|
158 |
//On connecte le serveur à l'adresse locale sur le port 80. |
|
|
159 |
try |
|
|
160 |
{ |
|
|
161 |
server = new Server(debug.getConnexionHost(), debug.getConnexionPort(), debug.getTimerElapsing()); |
|
|
162 |
//On crée le gestionnaire de modes. |
|
|
163 |
modeManagement = new ModeManagement(server, debug, this); |
|
|
164 |
} |
|
|
165 |
catch (Exception) |
|
|
166 |
{ |
|
|
167 |
debug.ShowException("serverCantStart"); |
|
|
168 |
} |
|
|
169 |
|
|
15
|
170 |
//On écoute l'événement de clic sur le bouton on/off du debug. |
|
|
171 |
//Car on lancera l'intitialisation/fermeture de la kinect. |
|
|
172 |
debug.getSwitch().Click += new RoutedEventHandler(Switch_ClickInKinectMain); |
|
|
173 |
debug.Loaded += new RoutedEventHandler(Window_LoadedInKinectMain); |
|
|
174 |
debug.Closed += new EventHandler(Window_CloseInKinectMain); |
|
37
|
175 |
/*debug.getQuitMenu().Click += new RoutedEventHandler(Quit_ClickInKinectMain); |
|
|
176 |
debug.getParametersWindow().getModButton().Click += new RoutedEventHandler(updateParameters);*/ |
|
|
177 |
|
|
|
178 |
/*Console.WriteLine("DEBUG"); |
|
|
179 |
|
|
|
180 |
Console.WriteLine("searchMinDistance:" + debug.getMinDistHands()); |
|
|
181 |
Console.WriteLine("minDistance:" + debug.getMinDist()); |
|
|
182 |
Console.WriteLine("connexionHost:" + debug.getConnexionHost()); |
|
|
183 |
Console.WriteLine("timerElapsing:" + debug.getTimerElapsing()); |
|
|
184 |
Console.WriteLine("takenPoints:" + debug.getTakenPoints()); |
|
|
185 |
Console.WriteLine("directionChangeTresholdXY:" + debug.getDirectionChangeTresholdXY()); |
|
|
186 |
Console.WriteLine("connexionPort:" + debug.getConnexionPort()); |
|
|
187 |
Console.WriteLine("imagesToShow:" + debug.getImagesToShow()); |
|
|
188 |
Console.WriteLine("searchMaxDistance:" + debug.getMaxDistHands()); |
|
|
189 |
Console.WriteLine("maxDistance:" + debug.getMaxDist()); |
|
|
190 |
Console.WriteLine("zeroPoint:" + debug.getZeroPoint()); |
|
|
191 |
Console.WriteLine("directionChangeTresholdZ:" + debug.getDirectionChangeTresholdZ());*/ |
|
15
|
192 |
|
|
|
193 |
//On affiche la fenêtre de debug. |
|
|
194 |
try |
|
|
195 |
{ |
|
|
196 |
debug.ShowDialog(); |
|
|
197 |
} |
|
|
198 |
catch(Exception){ |
|
|
199 |
} |
|
|
200 |
} |
|
|
201 |
|
|
37
|
202 |
/*public bool loadParameters() |
|
|
203 |
{ |
|
|
204 |
try |
|
|
205 |
{ |
|
|
206 |
string[] lines = System.IO.File.ReadAllLines(@"config.txt"); |
|
|
207 |
|
|
|
208 |
foreach (string line in lines) |
|
|
209 |
{ |
|
|
210 |
Console.WriteLine(line); |
|
|
211 |
} |
|
|
212 |
|
|
|
213 |
/*minDistHands = Properties.Settings.Default.searchMinDistance; |
|
|
214 |
maxDistHands = Properties.Settings.Default.searchMaxDistance; |
|
|
215 |
minDist = Properties.Settings.Default.minDistance; |
|
|
216 |
maxDist = Properties.Settings.Default.maxDistance; |
|
|
217 |
zeroPoint = Properties.Settings.Default.zeroPoint; |
|
|
218 |
connexionHost = Properties.Settings.Default.connexionHost; |
|
|
219 |
connexionPort = Properties.Settings.Default.connexionPort; |
|
|
220 |
timerElapsing = Properties.Settings.Default.timerElapsing; |
|
|
221 |
imagesToShow = Properties.Settings.Default.imagesToShow; |
|
|
222 |
takenPoints = Properties.Settings.Default.takenPoints; |
|
|
223 |
directionChangeTresholdXY = Properties.Settings.Default.directionChangeTresholdXY; |
|
|
224 |
directionChangeTresholdZ = Properties.Settings.Default.directionChangeTresholdZ;*/ |
|
|
225 |
/*} |
|
|
226 |
catch (Exception) |
|
|
227 |
{ |
|
|
228 |
return false; |
|
|
229 |
} |
|
|
230 |
|
|
|
231 |
if (maxDistHands <= 0f || minDistHands <= 0f || maxDistHands > maxDist || minDistHands > maxDist || |
|
|
232 |
minDistHands >= maxDistHands || zeroPoint < maxDistHands || minDistHands > minDist || |
|
|
233 |
zeroPoint >= maxDist || connexionPort < 0 || timerElapsing < 0 || imagesToShow < 1 || |
|
|
234 |
takenPoints <= 0 || directionChangeTresholdXY < 0 || directionChangeTresholdZ < 0) |
|
|
235 |
{ |
|
|
236 |
ExceptionLbl.Content = rm.GetString("loadParametersIncorrect"); |
|
|
237 |
Console.WriteLine(ExceptionLbl.Content); |
|
|
238 |
return false; |
|
|
239 |
} |
|
|
240 |
return true; |
|
|
241 |
} |
|
|
242 |
|
|
15
|
243 |
/* |
|
16
|
244 |
* Envoi les paramètres mis à jour dans les différents modules. |
|
|
245 |
*/ |
|
|
246 |
public void updateParameters(object sender, RoutedEventArgs e) |
|
|
247 |
{ |
|
|
248 |
userPositionDetector.setParams(debug.getMinDist(), debug.getMaxDist(), debug.getMinDistHands(), debug.getMaxDistHands(), debug.getZeroPoint()); |
|
|
249 |
server = new Server(debug.getConnexionHost(), debug.getConnexionPort(), debug.getTimerElapsing()); |
|
|
250 |
} |
|
|
251 |
|
|
|
252 |
/* |
|
15
|
253 |
* Initialisation du sensor de la Kinect. |
|
|
254 |
*/ |
|
|
255 |
public void KinectInitialization() |
|
|
256 |
{ |
|
|
257 |
try |
|
|
258 |
{ |
|
|
259 |
//On sélectionne la première kinect détectée. |
|
|
260 |
kinectSensor = KinectSensor.KinectSensors.FirstOrDefault(s => s.Status == KinectStatus.Connected); |
|
|
261 |
//La caméra couleur est activée avec une résolution 640x480 et un framerate de 30 FPS. |
|
|
262 |
kinectSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); |
|
|
263 |
//La caméra de profondeur est activée. |
|
|
264 |
kinectSensor.DepthStream.Enable(); |
|
|
265 |
//Le squelette est activé. |
|
|
266 |
kinectSensor.SkeletonStream.Enable(); |
|
|
267 |
|
|
|
268 |
//Quand le Middleware reçoit des trames de la Kinect, on va dans cette fonction. |
|
|
269 |
kinectSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(AllFramesReady); |
|
|
270 |
|
|
|
271 |
//On applique des paramètres d'ajustement pour le squelette. |
|
|
272 |
TransformSmoothParameters parameters = new TransformSmoothParameters(); |
|
|
273 |
parameters.Smoothing = 0.2f; |
|
|
274 |
parameters.Correction = 0.8f; |
|
|
275 |
parameters.Prediction = 0.0f; |
|
|
276 |
parameters.JitterRadius = 0.5f; |
|
|
277 |
parameters.MaxDeviationRadius = 0.5f; |
|
|
278 |
kinectSensor.SkeletonStream.Enable(parameters); |
|
|
279 |
//On démarre la Kinect. |
|
|
280 |
kinectSensor.Start(); |
|
|
281 |
|
|
|
282 |
} |
|
|
283 |
catch (System.Exception) |
|
|
284 |
{ |
|
|
285 |
debug.ShowException("KinectNotConnected"); |
|
|
286 |
} |
|
|
287 |
|
|
|
288 |
//Pour les événements main gauche/droite entre dans/quitte le champ, on a 4 listeners. |
|
|
289 |
//Fonction appelée lorsque la main gauche entre dans le champ de recherche. |
|
|
290 |
LeftHandTrackedListener leftHandTrackedListener = new LeftHandTrackedListener(); |
|
|
291 |
LeftHandTrackedEvent += new LeftHandTrackedHandler(leftHandTrackedListener.showAndSend); |
|
|
292 |
|
|
|
293 |
//Fonction appelée lorsque la main droite entre dans le champ de recherche. |
|
|
294 |
RightHandTrackedListener rightHandTrackedListener = new RightHandTrackedListener(); |
|
|
295 |
RightHandTrackedEvent += new RightHandTrackedHandler(rightHandTrackedListener.showAndSend); |
|
|
296 |
|
|
|
297 |
//Fonction appelée lorsque la main gauche quitte le champ de recherche. |
|
|
298 |
LeftHandQuitListener leftHandQuitListener = new LeftHandQuitListener(); |
|
|
299 |
LeftHandQuitEvent += new LeftHandQuitHandler(leftHandQuitListener.showAndSend); |
|
|
300 |
|
|
|
301 |
//Fonction appelée lorsque la main droite quitte le champ de recherche. |
|
|
302 |
RightHandQuitListener rightHandQuitListener = new RightHandQuitListener(); |
|
|
303 |
RightHandQuitEvent += new RightHandQuitHandler(rightHandQuitListener.showAndSend); |
|
|
304 |
|
|
17
|
305 |
//Fonction appelée lorsque l'utilisateur se penche. |
|
|
306 |
BendListener bendListener = new BendListener(); |
|
|
307 |
BendEvent += new BendHandler(bendListener.showAndSend); |
|
|
308 |
|
|
|
309 |
//Fonction appelée lorsque l'utilisateur croise les bras en X. |
|
|
310 |
CrossListener crossListener = new CrossListener(); |
|
|
311 |
CrossEvent += new CrossHandler(crossListener.showAndSend); |
|
|
312 |
|
|
|
313 |
//Fonction appelée lorsque l'utilisateur lève le genou. |
|
|
314 |
KneeUpListener kneeUpListener = new KneeUpListener(); |
|
|
315 |
KneeUpEvent += new KneeUpHandler(kneeUpListener.showAndSend); |
|
|
316 |
|
|
15
|
317 |
//Fonction appelée lorsque l'utilisateur effectue un Swipe right/left/up/down. |
|
|
318 |
SwipeListener swipeListener = new SwipeListener(); |
|
|
319 |
SwipeEvent += new SwipeHandler(swipeListener.showAndSend); |
|
|
320 |
|
|
|
321 |
//Fonction appelée lorsque l'utilisateur effectue un Push/Pull. |
|
|
322 |
PushListener pushListener = new PushListener(); |
|
|
323 |
PushEvent += new PushHandler(pushListener.showAndSend); |
|
|
324 |
|
|
|
325 |
//Fonction appelée lorsque l'utilisateur effectue un Jump. |
|
|
326 |
JumpListener jumpListener = new JumpListener(); |
|
|
327 |
JumpEvent += new JumpHandler(jumpListener.showAndSend); |
|
|
328 |
|
|
37
|
329 |
//Fonction appelée lorsque l'utilisateur effectue un Fall. |
|
|
330 |
FallListener fallListener = new FallListener(); |
|
|
331 |
FallEvent += new FallHandler(fallListener.showAndSend); |
|
|
332 |
|
|
17
|
333 |
//Fonction appelée lorsque l'utilisateur effectue un Wave. |
|
|
334 |
WaveListener waveListener = new WaveListener(); |
|
|
335 |
WaveEvent += new WaveHandler(waveListener.showAndSend); |
|
|
336 |
|
|
|
337 |
//Fonction appelée lorsque l'utilisateur effectue un Circle. |
|
|
338 |
CircleListener circleListener = new CircleListener(); |
|
|
339 |
CircleEvent += new CircleHandler(circleListener.showAndSend); |
|
|
340 |
|
|
15
|
341 |
//Fonction appelée lorsque l'utilisateur se déplace dans la zone de détection. |
|
|
342 |
UserPositionListener userPositionListener = new UserPositionListener(); |
|
|
343 |
UserPositionEvent += new UserPositionHandler(userPositionListener.showAndSend); |
|
|
344 |
|
|
16
|
345 |
modeManagement.DetectProximityBasedModes(0); |
|
15
|
346 |
} |
|
|
347 |
|
|
|
348 |
/* |
|
|
349 |
* Bouton ON/OFF du debug écouté dans KinectMain. |
|
|
350 |
*/ |
|
|
351 |
public void Switch_ClickInKinectMain(object sender, RoutedEventArgs e) |
|
|
352 |
{ |
|
|
353 |
Console.Out.WriteLine(debug.getOn()); |
|
|
354 |
//Si la kinect est allumée. |
|
|
355 |
if (debug.getOn()) |
|
|
356 |
{ |
|
|
357 |
//On initialise la Kinect. |
|
|
358 |
KinectInitialization(); |
|
|
359 |
} |
|
|
360 |
else |
|
|
361 |
{ |
|
|
362 |
//On éteint la Kinect. |
|
|
363 |
KinectClose(); |
|
|
364 |
} |
|
|
365 |
} |
|
|
366 |
|
|
|
367 |
/* |
|
|
368 |
* Méthode associée à l'événement : Quitter via le menu écoutée dans KinectMain. |
|
|
369 |
*/ |
|
|
370 |
private void Quit_ClickInKinectMain(object sender, RoutedEventArgs e) |
|
|
371 |
{ |
|
|
372 |
KinectClose(); |
|
|
373 |
debug.Quit_Click(sender, e); |
|
|
374 |
} |
|
|
375 |
|
|
|
376 |
/* |
|
|
377 |
* Permet d'initialiser la Kinect dès que la fenêtre est lancée écoutée dans KinectMain. |
|
|
378 |
*/ |
|
|
379 |
private void Window_LoadedInKinectMain(object sender, RoutedEventArgs e) |
|
|
380 |
{ |
|
|
381 |
KinectInitialization(); |
|
|
382 |
} |
|
|
383 |
|
|
|
384 |
/* |
|
|
385 |
* Fermeture du debug écouté dans KinectMain. |
|
|
386 |
*/ |
|
|
387 |
private void Window_CloseInKinectMain(object sender, EventArgs e) |
|
|
388 |
{ |
|
|
389 |
//On éteint la Kinect. |
|
|
390 |
KinectClose(); |
|
|
391 |
debug.Window_Closed(sender, e); |
|
|
392 |
} |
|
|
393 |
|
|
|
394 |
/* |
|
|
395 |
* Fermeture du sensor de la Kinect. |
|
|
396 |
*/ |
|
|
397 |
public void KinectClose() |
|
|
398 |
{ |
|
|
399 |
try |
|
|
400 |
{ |
|
|
401 |
//On stoppe la Kinect. |
|
|
402 |
kinectSensor.Stop(); |
|
|
403 |
//On met a zero l'image d'affichage et le serveur. |
|
|
404 |
debug.ShutDownInterface(); |
|
|
405 |
} |
|
|
406 |
catch (System.Exception) |
|
|
407 |
{ |
|
|
408 |
debug.ShowException("KinectNotConnected"); |
|
|
409 |
} |
|
|
410 |
} |
|
|
411 |
|
|
|
412 |
/* |
|
|
413 |
* Récupère le premier squelette. |
|
|
414 |
*/ |
|
|
415 |
Skeleton GetFirstSkeleton(object sender, AllFramesReadyEventArgs e) |
|
|
416 |
{ |
|
|
417 |
using (SkeletonFrame skeletonFrameData = e.OpenSkeletonFrame()) |
|
|
418 |
{ |
|
|
419 |
if (skeletonFrameData == null) |
|
|
420 |
return null; |
|
|
421 |
if ((skeletons == null) || (skeletons.Length != skeletonFrameData.SkeletonArrayLength)) |
|
|
422 |
skeletons = new Skeleton[skeletonFrameData.SkeletonArrayLength]; |
|
|
423 |
skeletonFrameData.CopySkeletonDataTo(skeletons); |
|
|
424 |
|
|
|
425 |
//On obtient le premier skelette. |
|
|
426 |
Skeleton first = (from s in skeletons where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); |
|
|
427 |
|
|
|
428 |
return first; |
|
|
429 |
} |
|
|
430 |
} |
|
|
431 |
|
|
|
432 |
/* |
|
|
433 |
* Récupère le squelette le plus proche. |
|
|
434 |
*/ |
|
|
435 |
Skeleton GetNearestSkeleton(object sender, AllFramesReadyEventArgs e) |
|
|
436 |
{ |
|
|
437 |
using (SkeletonFrame skeletonFrameData = e.OpenSkeletonFrame()) |
|
|
438 |
{ |
|
|
439 |
if (skeletonFrameData == null) |
|
|
440 |
return null; |
|
|
441 |
if ((skeletons == null) || (skeletons.Length != skeletonFrameData.SkeletonArrayLength)) |
|
|
442 |
skeletons = new Skeleton[skeletonFrameData.SkeletonArrayLength]; |
|
|
443 |
skeletonFrameData.CopySkeletonDataTo(skeletons); |
|
|
444 |
|
|
|
445 |
Skeleton s; |
|
|
446 |
float minDist = (float)-1.0; |
|
|
447 |
int minID = 0; |
|
|
448 |
|
|
|
449 |
//Pour tous les squelettes. |
|
|
450 |
for(int i = 0 ; i < skeletons.Count() ; i++) |
|
|
451 |
{ |
|
|
452 |
s = skeletons.ElementAt(i); |
|
|
453 |
//S'il est tracké. |
|
|
454 |
if(s.TrackingState == SkeletonTrackingState.Tracked) |
|
|
455 |
{ |
|
|
456 |
//On récupère sa position et on obtient la distance min et l'ID du squelette qui est à la distance min. |
|
|
457 |
float dist = skeletons.ElementAt(i).Position.Z; |
|
|
458 |
if (minDist == -1) |
|
|
459 |
{ |
|
|
460 |
minDist = dist; |
|
|
461 |
minID = i; |
|
|
462 |
} |
|
|
463 |
else if(minDist > dist) |
|
|
464 |
{ |
|
|
465 |
minDist = dist; |
|
|
466 |
minID = i; |
|
|
467 |
} |
|
|
468 |
} |
|
|
469 |
} |
|
|
470 |
|
|
|
471 |
//On renvoie le skelette le plus proche. |
|
|
472 |
return skeletons.ElementAt(minID); |
|
|
473 |
} |
|
|
474 |
} |
|
|
475 |
|
|
|
476 |
/* |
|
|
477 |
* Récupère le squelette le plus proche. |
|
|
478 |
*/ |
|
|
479 |
private void AllFramesReady(object sender, AllFramesReadyEventArgs e) |
|
|
480 |
{ |
|
|
481 |
//On ne calcule rien si la fenêtre de debug se ferme. |
|
|
482 |
if (debug.isClosing()) |
|
|
483 |
return; |
|
|
484 |
|
|
|
485 |
//On écoute le debug pour savoir si les paramètres ont été modifiés. |
|
|
486 |
|
|
|
487 |
|
|
|
488 |
//On met à jour la vidéo de debug. |
|
|
489 |
debug.RefreshVideo(e); |
|
|
490 |
//On récupère le premier squelette tracké. |
|
|
491 |
//Skeleton first = GetFirstSkeleton(e); |
|
|
492 |
//On récupère le plus proche squelette tracké. |
|
|
493 |
Skeleton first = GetNearestSkeleton(sender, e); |
|
|
494 |
//Si celui-ci n’est pas nul |
|
|
495 |
if (first == null) |
|
|
496 |
return; |
|
|
497 |
|
|
|
498 |
//Si ce squelette est tracké (donc suivi et reconnu par la camera) |
|
|
499 |
if (first.TrackingState == SkeletonTrackingState.Tracked) |
|
|
500 |
{ |
|
|
501 |
//Ensemble des noeuds du squelette. |
|
|
502 |
Joint hipCenter = getJoint(first, JointType.HipCenter), spine = getJoint(first, JointType.Spine), shoulderCenter = getJoint(first, JointType.ShoulderCenter), head = getJoint(first, JointType.Head); |
|
|
503 |
Joint shoulderLeft = getJoint(first, JointType.ShoulderLeft), elbowLeft = getJoint(first, JointType.ElbowLeft), wristLeft = getJoint(first, JointType.WristLeft), handLeft = getJoint(first, JointType.HandLeft); |
|
|
504 |
Joint shoulderRight = getJoint(first, JointType.ShoulderRight), elbowRight = getJoint(first, JointType.ElbowRight), wristRight = getJoint(first, JointType.WristRight), handRight = getJoint(first, JointType.HandRight); |
|
|
505 |
Joint hipLeft = getJoint(first, JointType.HipLeft), kneeLeft = getJoint(first, JointType.KneeLeft), ankleLeft = getJoint(first, JointType.AnkleLeft), footLeft = getJoint(first, JointType.FootLeft); |
|
|
506 |
Joint hipRight = getJoint(first, JointType.HipRight), kneeRight = getJoint(first, JointType.KneeRight), ankleRight = getJoint(first, JointType.AnkleRight), footRight = getJoint(first, JointType.FootRight); |
|
|
507 |
|
|
|
508 |
//On construit l'historique des postures. |
|
|
509 |
List<Joint> joints = new List<Joint>(); |
|
|
510 |
joints.Clear(); |
|
|
511 |
joints.Insert((int)JointType.HipCenter, hipCenter); |
|
|
512 |
joints.Insert((int)JointType.Spine, spine); |
|
|
513 |
joints.Insert((int)JointType.ShoulderCenter, shoulderCenter); |
|
|
514 |
joints.Insert((int)JointType.Head, head); |
|
|
515 |
joints.Insert((int)JointType.ShoulderLeft, shoulderLeft); |
|
|
516 |
joints.Insert((int)JointType.ElbowLeft, elbowLeft); |
|
|
517 |
joints.Insert((int)JointType.WristLeft, wristLeft); |
|
|
518 |
joints.Insert((int)JointType.HandLeft, handLeft); |
|
|
519 |
joints.Insert((int)JointType.ShoulderRight, shoulderRight); |
|
|
520 |
joints.Insert((int)JointType.ElbowRight, elbowRight); |
|
|
521 |
joints.Insert((int)JointType.WristRight, wristRight); |
|
|
522 |
joints.Insert((int)JointType.HandRight, handRight); |
|
|
523 |
joints.Insert((int)JointType.HipLeft, hipLeft); |
|
|
524 |
joints.Insert((int)JointType.KneeLeft, kneeLeft); |
|
|
525 |
joints.Insert((int)JointType.AnkleLeft, ankleLeft); |
|
|
526 |
joints.Insert((int)JointType.FootLeft, footLeft); |
|
|
527 |
joints.Insert((int)JointType.HipRight, hipRight); |
|
|
528 |
joints.Insert((int)JointType.KneeRight, kneeRight); |
|
|
529 |
joints.Insert((int)JointType.AnkleRight, ankleRight); |
|
|
530 |
joints.Insert((int)JointType.FootRight, footRight); |
|
|
531 |
GestureDetector.UpdateSkeletonHistory(joints); |
|
17
|
532 |
PostureDetector.UpdateSkeletonState(joints); |
|
15
|
533 |
|
|
37
|
534 |
if (!correctPostureDetector.CheckForCorrectPosture()) |
|
|
535 |
{ |
|
|
536 |
debug.hideSkeleton(); |
|
|
537 |
modeManagement.DetectProximityBasedModes(0); |
|
|
538 |
//Console.WriteLine("NO-USER"); |
|
|
539 |
LeftHandQuitEventArgs leftHandQuitEvent = new LeftHandQuitEventArgs(server, debug); |
|
|
540 |
OnLeftHandQuitEvent(leftHandQuitEvent); |
|
|
541 |
RightHandQuitEventArgs rightHandQuitEvent = new RightHandQuitEventArgs(server, debug); |
|
|
542 |
OnRightHandQuitEvent(rightHandQuitEvent); |
|
|
543 |
|
|
|
544 |
return; |
|
|
545 |
} |
|
|
546 |
|
|
15
|
547 |
//Si la main gauche est dans le champ, on lance l'événement approprié. |
|
|
548 |
if (handLeft.Position.Z < debug.getMaxDistHands() && handLeft.Position.Z > debug.getMinDistHands()) |
|
|
549 |
{ |
|
|
550 |
LeftHandTrackedEventArgs leftHandTrackedEvent = new LeftHandTrackedEventArgs(server, debug, handLeft, handLeft.Position.Z); |
|
|
551 |
OnLeftHandTrackedEvent(leftHandTrackedEvent); |
|
17
|
552 |
/*if (circleDetector.CheckForLeftCircle()) |
|
|
553 |
{ |
|
|
554 |
CircleEventArgs circleEvent = new CircleEventArgs(server, debug); |
|
|
555 |
OnCircleEvent(circleEvent); |
|
|
556 |
}*/ |
|
15
|
557 |
} |
|
|
558 |
//Si la main gauche quitte le champ, on lance l'événement approprié. |
|
|
559 |
else |
|
|
560 |
{ |
|
|
561 |
LeftHandQuitEventArgs leftHandQuitEvent = new LeftHandQuitEventArgs(server, debug); |
|
|
562 |
OnLeftHandQuitEvent(leftHandQuitEvent); |
|
|
563 |
} |
|
|
564 |
//Si la main droite est dans le champ, on lance l'événement approprié. |
|
|
565 |
if (handRight.Position.Z < debug.getMaxDistHands() && handRight.Position.Z > debug.getMinDistHands()) |
|
|
566 |
{ |
|
|
567 |
RightHandTrackedEventArgs rightHandTrackedEvent = new RightHandTrackedEventArgs(server, debug, handRight, handRight.Position.Z); |
|
|
568 |
OnRightHandTrackedEvent(rightHandTrackedEvent); |
|
17
|
569 |
/*if (circleDetector.CheckForRightCircle()) |
|
|
570 |
{ |
|
|
571 |
CircleEventArgs circleEvent = new CircleEventArgs(server, debug); |
|
|
572 |
OnCircleEvent(circleEvent); |
|
|
573 |
//Console.Out.WriteLine("CIRCLE"); |
|
|
574 |
}*/ |
|
15
|
575 |
} |
|
|
576 |
//Si la main droite quitte le champ, on lance l'événement approprié. |
|
|
577 |
else |
|
|
578 |
{ |
|
|
579 |
RightHandQuitEventArgs rightHandQuitEvent = new RightHandQuitEventArgs(server, debug); |
|
|
580 |
OnRightHandQuitEvent(rightHandQuitEvent); |
|
|
581 |
} |
|
|
582 |
|
|
17
|
583 |
//Si l'utilisateur s'est penché. |
|
|
584 |
if (bendDetector.CheckForBend()) |
|
|
585 |
{ |
|
|
586 |
BendEventArgs bendEvent = new BendEventArgs(server, debug); |
|
|
587 |
OnBendEvent(bendEvent); |
|
|
588 |
} |
|
|
589 |
|
|
|
590 |
//Si l'utilisateur a croisé les bras en X. |
|
|
591 |
if (crossDetector.CheckForCross()) |
|
|
592 |
{ |
|
|
593 |
CrossEventArgs crossEvent = new CrossEventArgs(server, debug); |
|
|
594 |
OnCrossEvent(crossEvent); |
|
|
595 |
} |
|
|
596 |
|
|
|
597 |
//Si l'utilisateur a levé le genou. |
|
|
598 |
if (kneeUpDetector.CheckForKneeUp()) |
|
|
599 |
{ |
|
|
600 |
KneeUpEventArgs kneeUpEvent = new KneeUpEventArgs(server, debug); |
|
|
601 |
OnKneeUpEvent(kneeUpEvent); |
|
|
602 |
} |
|
|
603 |
|
|
37
|
604 |
//Si l'utilisateur a fait un jump. |
|
|
605 |
if (jumpDetector.CheckForJump()) |
|
|
606 |
{ |
|
|
607 |
JumpEventArgs jumpEvent = new JumpEventArgs(server, debug); |
|
|
608 |
OnJumpEvent(jumpEvent); |
|
|
609 |
} |
|
|
610 |
|
|
|
611 |
//Si l'utilisateur a fait un fall. |
|
|
612 |
if (fallDetector.CheckForFall()) |
|
|
613 |
{ |
|
|
614 |
FallEventArgs fallEvent = new FallEventArgs(server, debug); |
|
|
615 |
OnFallEvent(fallEvent); |
|
|
616 |
} |
|
|
617 |
|
|
15
|
618 |
//Si l'utilisateur effectue un swipe left. |
|
|
619 |
if (swipeDetector.CheckForSwipeLeft()) |
|
|
620 |
{ |
|
|
621 |
SwipeEventArgs swipeEvent = new SwipeEventArgs(server, debug, SwipeDetector.Direction.LEFT); |
|
|
622 |
OnSwipeEvent(swipeEvent); |
|
|
623 |
} |
|
|
624 |
|
|
|
625 |
//Si l'utilisateur effectue un swipe right. |
|
|
626 |
if (swipeDetector.CheckForSwipeRight()) |
|
|
627 |
{ |
|
|
628 |
SwipeEventArgs swipeEvent = new SwipeEventArgs(server, debug, SwipeDetector.Direction.RIGHT); |
|
|
629 |
OnSwipeEvent(swipeEvent); |
|
|
630 |
} |
|
|
631 |
|
|
|
632 |
//Enum sur la main qui effectue le geste. |
|
|
633 |
PushDetector.Hand handPush; |
|
|
634 |
//Si l'utilisateur effectue un push. |
|
|
635 |
if ((handPush = pushDetector.CheckForPush()) != PushDetector.Hand.NONE) |
|
|
636 |
{ |
|
|
637 |
PushEventArgs pushEvent = new PushEventArgs(server, debug, PushDetector.Direction.PUSH, handPush); |
|
|
638 |
OnPushEvent(pushEvent); |
|
|
639 |
} |
|
|
640 |
//Si l'utilisateur effectue un pull. |
|
|
641 |
if ((handPush = pushDetector.CheckForPull()) != PushDetector.Hand.NONE) |
|
|
642 |
{ |
|
|
643 |
PushEventArgs pushEvent = new PushEventArgs(server, debug, PushDetector.Direction.PULL, handPush); |
|
|
644 |
OnPushEvent(pushEvent); |
|
|
645 |
} |
|
|
646 |
|
|
17
|
647 |
//Si l'utilisateur effectue un wave. |
|
|
648 |
if (waveDetector.CheckForWave()) |
|
|
649 |
{ |
|
|
650 |
WaveEventArgs waveEvent = new WaveEventArgs(server, debug); |
|
|
651 |
OnWaveEvent(waveEvent); |
|
|
652 |
Console.Out.WriteLine("WAVE"); |
|
|
653 |
} |
|
|
654 |
|
|
15
|
655 |
//Si l'utilisateur se déplace dans la zone de détection. |
|
|
656 |
//On traite le problème en plusieurs limites, on discrétise la zone. |
|
|
657 |
if (first.TrackingState == SkeletonTrackingState.Tracked) |
|
|
658 |
{ |
|
|
659 |
float proximity = userPositionDetector.CalcProximity(first.Position.Z); |
|
|
660 |
int numberOfImages = userPositionDetector.ImagesToShow(proximity, debug.getImagesToShow()); |
|
|
661 |
|
|
|
662 |
modeManagement.DetectProximityBasedModes(proximity); |
|
|
663 |
|
|
37
|
664 |
if (proximity >= 10f) |
|
15
|
665 |
{ |
|
|
666 |
UserPositionEventArgs userPositionEvent = new UserPositionEventArgs(server, debug, proximity, numberOfImages); |
|
|
667 |
OnUserPositionEvent(userPositionEvent); |
|
|
668 |
} |
|
|
669 |
else if(proximity < 10f) |
|
|
670 |
{ |
|
|
671 |
debug.hideSkeleton(); |
|
|
672 |
modeManagement.DetectProximityBasedModes(0); |
|
|
673 |
LeftHandQuitEventArgs leftHandQuitEvent = new LeftHandQuitEventArgs(server, debug); |
|
|
674 |
OnLeftHandQuitEvent(leftHandQuitEvent); |
|
|
675 |
RightHandQuitEventArgs rightHandQuitEvent = new RightHandQuitEventArgs(server, debug); |
|
|
676 |
OnRightHandQuitEvent(rightHandQuitEvent); |
|
|
677 |
} |
|
|
678 |
} |
|
|
679 |
|
|
|
680 |
//Dessine le squelette dans le debug. |
|
|
681 |
debug.drawJoints(first.Joints, first); |
|
|
682 |
debug.showSkeleton(hipCenter, spine, shoulderCenter, head, shoulderLeft, elbowLeft, wristLeft, handLeft, shoulderRight, elbowRight, wristRight, handRight, hipLeft, kneeLeft, ankleLeft, footLeft, hipRight, kneeRight, ankleRight, footRight); |
|
|
683 |
} |
|
|
684 |
else |
|
|
685 |
{ |
|
|
686 |
debug.hideSkeleton(); |
|
|
687 |
modeManagement.DetectProximityBasedModes(0); |
|
|
688 |
LeftHandQuitEventArgs leftHandQuitEvent = new LeftHandQuitEventArgs(server, debug); |
|
|
689 |
OnLeftHandQuitEvent(leftHandQuitEvent); |
|
|
690 |
RightHandQuitEventArgs rightHandQuitEvent = new RightHandQuitEventArgs(server, debug); |
|
|
691 |
OnRightHandQuitEvent(rightHandQuitEvent); |
|
|
692 |
} |
|
|
693 |
} |
|
|
694 |
|
|
|
695 |
/* |
|
|
696 |
* 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. |
|
|
697 |
*/ |
|
|
698 |
public Joint getJoint(Skeleton ske, JointType jointID) |
|
|
699 |
{ |
|
|
700 |
return Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(ske.Joints[jointID], 600, 400, 0.75f, 0.75f); |
|
|
701 |
} |
|
|
702 |
|
|
|
703 |
/* |
|
|
704 |
* Initialise l'événement et fait appel aux fonctions du listener quand la main gauche entre dans le champ. |
|
|
705 |
*/ |
|
|
706 |
public static void OnLeftHandTrackedEvent(LeftHandTrackedEventArgs e) |
|
|
707 |
{ |
|
|
708 |
if (LeftHandTrackedEvent != null) |
|
|
709 |
LeftHandTrackedEvent(new object(), e); |
|
|
710 |
} |
|
|
711 |
|
|
|
712 |
/* |
|
|
713 |
* Initialise l'événement et fait appel aux fonctions du listener quand la main droite entre dans le champ. |
|
|
714 |
*/ |
|
|
715 |
public static void OnRightHandTrackedEvent(RightHandTrackedEventArgs e) |
|
|
716 |
{ |
|
|
717 |
if (RightHandTrackedEvent != null) |
|
|
718 |
RightHandTrackedEvent(new object(), e); |
|
|
719 |
} |
|
|
720 |
|
|
|
721 |
/* |
|
|
722 |
* Initialise l'événement et fait appel aux fonctions du listener quand la main gauche quitte le champ. |
|
|
723 |
*/ |
|
|
724 |
public static void OnLeftHandQuitEvent(LeftHandQuitEventArgs e) |
|
|
725 |
{ |
|
|
726 |
if (LeftHandQuitEvent != null) |
|
|
727 |
LeftHandQuitEvent(new object(), e); |
|
|
728 |
} |
|
|
729 |
|
|
|
730 |
/* |
|
|
731 |
* Initialise l'événement et fait appel aux fonctions du listener quand la main droite quitte le champ. |
|
|
732 |
*/ |
|
|
733 |
public static void OnRightHandQuitEvent(RightHandQuitEventArgs e) |
|
|
734 |
{ |
|
|
735 |
if (RightHandQuitEvent != null) |
|
|
736 |
RightHandQuitEvent(new object(), e); |
|
|
737 |
} |
|
|
738 |
|
|
|
739 |
/* |
|
17
|
740 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur se penche. |
|
|
741 |
*/ |
|
|
742 |
public static void OnBendEvent(BendEventArgs e) |
|
|
743 |
{ |
|
|
744 |
if (BendEvent != null) |
|
|
745 |
BendEvent(new object(), e); |
|
|
746 |
} |
|
|
747 |
|
|
|
748 |
/* |
|
|
749 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur croise les bras en X. |
|
|
750 |
*/ |
|
|
751 |
public static void OnCrossEvent(CrossEventArgs e) |
|
|
752 |
{ |
|
|
753 |
if (CrossEvent != null) |
|
|
754 |
CrossEvent(new object(), e); |
|
|
755 |
} |
|
|
756 |
|
|
|
757 |
/* |
|
|
758 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur lève le genou. |
|
|
759 |
*/ |
|
|
760 |
public static void OnKneeUpEvent(KneeUpEventArgs e) |
|
|
761 |
{ |
|
|
762 |
if (KneeUpEvent != null) |
|
|
763 |
KneeUpEvent(new object(), e); |
|
|
764 |
} |
|
|
765 |
|
|
|
766 |
/* |
|
15
|
767 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un swipe right. |
|
|
768 |
*/ |
|
|
769 |
public static void OnSwipeEvent(SwipeEventArgs e) |
|
|
770 |
{ |
|
|
771 |
if (SwipeEvent != null) |
|
|
772 |
SwipeEvent(new object(), e); |
|
|
773 |
} |
|
|
774 |
|
|
|
775 |
/* |
|
|
776 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un push. |
|
|
777 |
*/ |
|
|
778 |
public static void OnPushEvent(PushEventArgs e) |
|
|
779 |
{ |
|
|
780 |
if (PushEvent != null) |
|
|
781 |
PushEvent(new object(), e); |
|
|
782 |
} |
|
|
783 |
|
|
|
784 |
/* |
|
|
785 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un saut. |
|
|
786 |
*/ |
|
|
787 |
public static void OnJumpEvent(JumpEventArgs e) |
|
|
788 |
{ |
|
|
789 |
if (JumpEvent != null) |
|
|
790 |
JumpEvent(new object(), e); |
|
|
791 |
} |
|
|
792 |
|
|
|
793 |
/* |
|
37
|
794 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un fall. |
|
|
795 |
*/ |
|
|
796 |
public static void OnFallEvent(FallEventArgs e) |
|
|
797 |
{ |
|
|
798 |
if (FallEvent != null) |
|
|
799 |
FallEvent(new object(), e); |
|
|
800 |
} |
|
|
801 |
|
|
|
802 |
/* |
|
17
|
803 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un cercle. |
|
|
804 |
*/ |
|
|
805 |
public static void OnCircleEvent(CircleEventArgs e) |
|
|
806 |
{ |
|
|
807 |
if (CircleEvent != null) |
|
|
808 |
CircleEvent(new object(), e); |
|
|
809 |
} |
|
|
810 |
|
|
|
811 |
/* |
|
|
812 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur effectue un wave. |
|
|
813 |
*/ |
|
|
814 |
public static void OnWaveEvent(WaveEventArgs e) |
|
|
815 |
{ |
|
|
816 |
if (WaveEvent != null) |
|
|
817 |
WaveEvent(new object(), e); |
|
|
818 |
} |
|
|
819 |
|
|
|
820 |
/* |
|
15
|
821 |
* Initialise l'événement et fait appel aux fonctions du listener quand l'utilisateur se déplace |
|
|
822 |
* dans la zone de détection. |
|
|
823 |
*/ |
|
|
824 |
public static void OnUserPositionEvent(UserPositionEventArgs e) |
|
|
825 |
{ |
|
|
826 |
if (UserPositionEvent != null) |
|
|
827 |
UserPositionEvent(new object(), e); |
|
|
828 |
} |
|
|
829 |
} |
|
|
830 |
} |