|
15
|
1 |
/* |
|
|
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 |
/* |
|
|
11 |
* Projet : TraKERS |
|
|
12 |
* Module : MIDDLEWARE |
|
|
13 |
* Sous-Module : Debug |
|
|
14 |
* Classe : DebugWindow |
|
|
15 |
* |
|
|
16 |
* Auteur : alexandre.bastien@iri.centrepompidou.fr |
|
|
17 |
* |
|
|
18 |
* Fonctionnalités : Reçoit des notifications des sous-modules Tracking, Communication et Exception. |
|
|
19 |
* Intéragit avec la fenêtre XAML de debug de façon à afficher un rendu visuel. |
|
|
20 |
*/ |
|
|
21 |
|
|
|
22 |
using System; |
|
|
23 |
using System.Windows; |
|
|
24 |
using System.Windows.Controls; |
|
|
25 |
using System.Windows.Media; |
|
|
26 |
using System.Windows.Media.Imaging; |
|
|
27 |
using System.Windows.Shapes; |
|
|
28 |
using System.Drawing; |
|
|
29 |
using Microsoft.Kinect; |
|
|
30 |
using System.Resources; |
|
|
31 |
using System.Reflection; |
|
|
32 |
using System.Timers; |
|
|
33 |
using System.Configuration; |
|
|
34 |
|
|
|
35 |
namespace Trakers.Debug |
|
|
36 |
{ |
|
|
37 |
public partial class DebugWindow : Window |
|
|
38 |
{ |
|
|
39 |
//Gestionnaire de ressources. |
|
|
40 |
private ResourceManager rm; |
|
|
41 |
|
|
|
42 |
//Paramètres du serveur TUIO. |
|
|
43 |
private string connexionHost; |
|
|
44 |
private int connexionPort; |
|
|
45 |
//Temps de rafraichissement pour le timer (Détection de gesture dans le serveur TUIO). |
|
|
46 |
private int timerElapsing; |
|
|
47 |
//Distances min/max délimitant le champ de recherche. |
|
|
48 |
private float minDistHands; |
|
|
49 |
private float maxDistHands; |
|
|
50 |
private float minDist; |
|
|
51 |
private float maxDist; |
|
|
52 |
private float zeroPoint; |
|
|
53 |
//Paramètres de la mosaïque. |
|
|
54 |
private int imagesToShow; |
|
|
55 |
//Paramètres de la recherche par courbes. |
|
|
56 |
private int takenPoints; |
|
|
57 |
private int directionChangeTresholdXY; |
|
|
58 |
private float directionChangeTresholdZ; |
|
18
|
59 |
//Images |
|
|
60 |
private String imgLocation; |
|
15
|
61 |
|
|
|
62 |
//Timer. |
|
|
63 |
private System.Timers.Timer _timer; |
|
|
64 |
//Membre permettant d'atteindre la classe KinectMain du sous-module Tracking. |
|
|
65 |
//private KinectMain kinectMain; |
|
|
66 |
//Tableau contenant une image en couleurs. |
|
|
67 |
private byte[] colorPixelData; |
|
|
68 |
//Indique si la kinect est allumée/éteinte. |
|
|
69 |
private bool on; |
|
|
70 |
//Indique si la fenêtre de debug est actuellement en cours de fermeture. |
|
|
71 |
private bool closing; |
|
|
72 |
//Indique si l'image doit être raffraichie. |
|
|
73 |
private Boolean refreshImage; |
|
16
|
74 |
//Fenêtre de paramètres |
|
|
75 |
private DebugParameters param; |
|
15
|
76 |
|
|
|
77 |
/* |
|
|
78 |
* Constructeur : Affiche la fenêtre de debug en lui passant en paramètre une instanciation de la |
|
|
79 |
* classe KinectMain. |
|
|
80 |
* Au départ, la kinect est éteinte. |
|
|
81 |
*/ |
|
|
82 |
public DebugWindow()//KinectMain main) |
|
|
83 |
{ |
|
|
84 |
InitializeComponent(); |
|
18
|
85 |
|
|
|
86 |
imgLocation = "Imgs"; |
|
|
87 |
|
|
15
|
88 |
//On fait appel au gestionnaire de ressources. |
|
|
89 |
rm = new ResourceManager("Trakers.Debug.Properties.Resources", Assembly.GetExecutingAssembly()); |
|
|
90 |
//On tente de charger les paramètres du fichier params.ini. |
|
|
91 |
//Si on n'y arrive pas, on affiche une erreur et on charge les paramètres par défaut. |
|
|
92 |
if (!loadParameters()) |
|
|
93 |
{ |
|
|
94 |
ExceptionLbl.Content = rm.GetString("loadParametersFail"); |
|
|
95 |
//Distances de détection des mains par défaut pour la recherche (ici de 1m à 2m de la Kinect). |
|
|
96 |
minDistHands = 1.0f; |
|
|
97 |
maxDistHands = 1.5f; |
|
|
98 |
minDist = 1.0f; |
|
|
99 |
maxDist = 4.0f; |
|
|
100 |
zeroPoint = 1.7f; |
|
|
101 |
connexionHost = "127.0.0.1"; |
|
|
102 |
connexionPort = 80; |
|
|
103 |
timerElapsing = 1000; |
|
|
104 |
imagesToShow = 25; |
|
|
105 |
takenPoints = 10; |
|
|
106 |
directionChangeTresholdXY = 10; |
|
|
107 |
directionChangeTresholdZ = 0.01f; |
|
|
108 |
} |
|
|
109 |
|
|
16
|
110 |
//On charge la fenêtre de paramètres. |
|
|
111 |
param = new DebugParameters(this); |
|
|
112 |
|
|
15
|
113 |
//kinectMain = main; |
|
|
114 |
on = true; |
|
|
115 |
closing = false; |
|
|
116 |
refreshImage = true; |
|
|
117 |
try |
|
|
118 |
{ |
|
|
119 |
//On instancie le timer à N ms. |
|
|
120 |
_timer = new System.Timers.Timer(timerElapsing); |
|
|
121 |
//Dès que le timer est expiré, on appelle _timer_Elapsed. |
|
|
122 |
_timer.Elapsed += new ElapsedEventHandler(_timer_Elapsed); |
|
|
123 |
} |
|
|
124 |
catch (Exception){} |
|
|
125 |
} |
|
|
126 |
|
|
|
127 |
/* |
|
|
128 |
* Méthode d'effacement du label d'exceptions. |
|
|
129 |
*/ |
|
|
130 |
public void NoException() |
|
|
131 |
{ |
|
|
132 |
ExceptionLbl.Content = ""; |
|
|
133 |
} |
|
|
134 |
|
|
|
135 |
/* |
|
|
136 |
* Méthode d'affichage des exceptions dans le label d'exceptions. |
|
|
137 |
*/ |
|
|
138 |
public void ShowException(String reference) |
|
|
139 |
{ |
|
|
140 |
ExceptionLbl.Content = rm.GetString(reference); |
|
|
141 |
} |
|
|
142 |
|
|
|
143 |
/* |
|
|
144 |
* Méthode de fermeture de l'interface. |
|
|
145 |
*/ |
|
|
146 |
public void ShutDownInterface() |
|
|
147 |
{ |
|
|
148 |
DebugImage.Source = null; |
|
|
149 |
ExceptionLbl.Content = ""; |
|
|
150 |
} |
|
|
151 |
|
|
|
152 |
/* |
|
|
153 |
* Méthode appelée à l'expiration du timer pour les gestures et modes. |
|
|
154 |
*/ |
|
|
155 |
public void _timer_Elapsed(object sender, ElapsedEventArgs e) |
|
|
156 |
{ |
|
|
157 |
//On débloque le raffraichissement de l'image. |
|
|
158 |
refreshImage = true; |
|
|
159 |
//On arrête le timer. |
|
|
160 |
_timer.Stop(); |
|
|
161 |
} |
|
|
162 |
|
|
|
163 |
/* |
|
|
164 |
* Getter pour le membre indiquant la fermeture de la fenêtre de debug. |
|
|
165 |
*/ |
|
|
166 |
public bool isClosing() |
|
|
167 |
{ |
|
|
168 |
return closing; |
|
|
169 |
} |
|
|
170 |
|
|
|
171 |
/* |
|
|
172 |
* Est appelée à la fermeture de la fenêtre. |
|
|
173 |
*/ |
|
|
174 |
public void Window_Closed(object sender, EventArgs e) |
|
|
175 |
{ |
|
|
176 |
closing = true; |
|
|
177 |
} |
|
|
178 |
|
|
|
179 |
/* |
|
|
180 |
* Bouton ON/OFF. |
|
|
181 |
*/ |
|
|
182 |
private void Switch_Click(object sender, RoutedEventArgs e) |
|
|
183 |
{ |
|
|
184 |
//S'il valait faux, il vaut vrai maintenant et inversement. |
|
|
185 |
on = !on; |
|
|
186 |
//Si la kinect est allumée. |
|
|
187 |
if (on) |
|
|
188 |
{ |
|
|
189 |
//Il affiche OFF (pour éteindre la kinect). |
|
|
190 |
Switch.Content = "OFF"; |
|
|
191 |
//On vide le label des exceptions. |
|
|
192 |
ExceptionLbl.Content = ""; |
|
|
193 |
} |
|
|
194 |
else |
|
|
195 |
{ |
|
|
196 |
//Il affiche ON (pour allumer la kinect). |
|
|
197 |
Switch.Content = "ON"; |
|
|
198 |
//On remet à zéro tous les éléments du retour visuel. |
|
|
199 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
200 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
201 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
202 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
203 |
DistanceLbl.Content = "Distance :"; |
|
|
204 |
LeftHand.Background = System.Windows.Media.Brushes.DarkGray; |
|
|
205 |
LeftHand.Content = ""; |
|
|
206 |
RightHand.Background = System.Windows.Media.Brushes.DarkGray; |
|
|
207 |
RightHand.Content = ""; |
|
|
208 |
DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
|
|
209 |
} |
|
|
210 |
} |
|
|
211 |
|
|
|
212 |
/* |
|
|
213 |
* Récupère le flux video et met à jour le rendu visuel de debug. |
|
|
214 |
*/ |
|
|
215 |
public void RefreshVideo(AllFramesReadyEventArgs e) |
|
|
216 |
{ |
|
|
217 |
if (refreshImage) |
|
|
218 |
{ |
|
|
219 |
bool receivedData = false; |
|
|
220 |
ColorImageFrame colorImageFrameData; |
|
|
221 |
using (colorImageFrameData = e.OpenColorImageFrame()) |
|
|
222 |
{ |
|
|
223 |
//Si on ne reçoit pas de trames de la kinect. |
|
|
224 |
if (colorImageFrameData == null) |
|
|
225 |
{ |
|
|
226 |
//L'image est supprimée. |
|
|
227 |
DebugImage.Source = null; |
|
|
228 |
} |
|
|
229 |
//Si le tableau stockant l'image en cours est nul. |
|
|
230 |
if (colorPixelData == null) |
|
|
231 |
//On alloue un nouveau tableau. |
|
|
232 |
colorPixelData = new byte[colorImageFrameData.PixelDataLength]; |
|
|
233 |
else |
|
|
234 |
{ |
|
|
235 |
try |
|
|
236 |
{ |
|
|
237 |
//Sinon on met à jour le tableau en copiant le contenu de la trame dans le tableau. |
|
|
238 |
colorImageFrameData.CopyPixelDataTo(colorPixelData); |
|
|
239 |
receivedData = true; |
|
|
240 |
} |
|
|
241 |
catch (Exception) { } |
|
|
242 |
} |
|
|
243 |
} |
|
|
244 |
//Si on a des données dans le tableau et que la kinect est allumée. |
|
|
245 |
if (receivedData && on) |
|
|
246 |
{ |
|
|
247 |
//On met à jour l'image de la caméra. |
|
|
248 |
DebugImage.Source = BitmapSource.Create(colorImageFrameData.Width, colorImageFrameData.Height, 96, 96, PixelFormats.Bgr32, null, colorPixelData, colorImageFrameData.Width * colorImageFrameData.BytesPerPixel); |
|
|
249 |
DebugImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; |
|
|
250 |
DebugImage.VerticalAlignment = System.Windows.VerticalAlignment.Center; |
|
|
251 |
DebugImage.Stretch = Stretch.Fill; |
|
|
252 |
//On annule l'image associée aux gestures. |
|
|
253 |
Gestures.Source = null; |
|
|
254 |
} |
|
|
255 |
} |
|
|
256 |
} |
|
|
257 |
|
|
|
258 |
/* |
|
|
259 |
* Affiche la distance de l'utilisateur dans le rendu visuel. |
|
|
260 |
* Sous forme de nombre en m et de rectangles changeant de couleur en fonction de la distance. |
|
|
261 |
*/ |
|
|
262 |
public void showDistance(float proximity) |
|
|
263 |
{ |
|
|
264 |
DistanceLbl.Content = "Proximity : " + proximity + "%"; |
|
|
265 |
|
|
|
266 |
if (proximity == 0) |
|
|
267 |
{ |
|
|
268 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
269 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
270 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
271 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
272 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
273 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
274 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
275 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
276 |
R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
277 |
R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
278 |
R10.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
279 |
} |
|
|
280 |
else if (proximity > 0 && proximity < 10) |
|
|
281 |
{ |
|
|
282 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
283 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
284 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
285 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
286 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
287 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
288 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
289 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
290 |
R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
291 |
R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
292 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
293 |
} |
|
|
294 |
else if (proximity > 10 && proximity < 20) |
|
|
295 |
{ |
|
|
296 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
297 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
298 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
299 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
300 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
301 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
302 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
303 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
304 |
R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
305 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
306 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
307 |
} |
|
|
308 |
else if (proximity > 20 && proximity < 30) |
|
|
309 |
{ |
|
|
310 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
311 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
312 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
313 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
314 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
315 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
316 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
317 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
318 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
319 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
320 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
321 |
} |
|
|
322 |
else if (proximity > 30 && proximity < 40) |
|
|
323 |
{ |
|
|
324 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
325 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
326 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
327 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
328 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
329 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
330 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
331 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
332 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
333 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
334 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
335 |
} |
|
|
336 |
else if (proximity > 40 && proximity < 50) |
|
|
337 |
{ |
|
|
338 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
339 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
340 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
341 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
342 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
343 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
344 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
345 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
346 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
347 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
348 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
349 |
} |
|
|
350 |
else if (proximity > 50 && proximity < 60) |
|
|
351 |
{ |
|
|
352 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
353 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
354 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
355 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
356 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
357 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
358 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
359 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
360 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
361 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
362 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
363 |
} |
|
|
364 |
else if (proximity > 60 && proximity < 70) |
|
|
365 |
{ |
|
|
366 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
367 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
368 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
369 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
370 |
R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
371 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
372 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
373 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
374 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
375 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
376 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
377 |
} |
|
|
378 |
else if (proximity > 70 && proximity < 80) |
|
|
379 |
{ |
|
|
380 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
381 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
382 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
383 |
R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
384 |
R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
385 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
386 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
387 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
388 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
389 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
390 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
391 |
} |
|
|
392 |
else if (proximity > 80 && proximity < 90) |
|
|
393 |
{ |
|
|
394 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
395 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
396 |
R2.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
397 |
R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
398 |
R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
399 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
400 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
401 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
402 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
403 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
404 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
405 |
} |
|
|
406 |
else if (proximity > 90 && proximity < 100) |
|
|
407 |
{ |
|
|
408 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
409 |
R1.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
410 |
R2.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
411 |
R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
412 |
R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
413 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
414 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
415 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
416 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
417 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
418 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
419 |
} |
|
|
420 |
else if (proximity == 100) |
|
|
421 |
{ |
|
|
422 |
R0.Fill = System.Windows.Media.Brushes.Green; |
|
|
423 |
R1.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
424 |
R2.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
425 |
R3.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
426 |
R4.Fill = System.Windows.Media.Brushes.Yellow; |
|
|
427 |
R5.Fill = System.Windows.Media.Brushes.Orange; |
|
|
428 |
R6.Fill = System.Windows.Media.Brushes.Orange; |
|
|
429 |
R7.Fill = System.Windows.Media.Brushes.Orange; |
|
|
430 |
R8.Fill = System.Windows.Media.Brushes.Red; |
|
|
431 |
R9.Fill = System.Windows.Media.Brushes.Red; |
|
|
432 |
R10.Fill = System.Windows.Media.Brushes.Red; |
|
|
433 |
} |
|
|
434 |
} |
|
|
435 |
|
|
|
436 |
/* |
|
|
437 |
* Affiche la détection de la main droite via un label. |
|
|
438 |
*/ |
|
|
439 |
public void showRightHandRect(bool show) |
|
|
440 |
{ |
|
|
441 |
if (show) |
|
|
442 |
RightHand.Background = System.Windows.Media.Brushes.Blue; |
|
|
443 |
else |
|
|
444 |
RightHand.Background = System.Windows.Media.Brushes.DarkGray; |
|
|
445 |
} |
|
|
446 |
|
|
|
447 |
/* |
|
|
448 |
* Affiche la détection de la main gauche via un label. |
|
|
449 |
*/ |
|
|
450 |
public void showLeftHandRect(bool show) |
|
|
451 |
{ |
|
|
452 |
if (show) |
|
|
453 |
LeftHand.Background = System.Windows.Media.Brushes.Blue; |
|
|
454 |
else |
|
|
455 |
LeftHand.Background = System.Windows.Media.Brushes.DarkGray; |
|
|
456 |
} |
|
|
457 |
|
|
|
458 |
/* |
|
|
459 |
* Dessine les noeuds du squelette dans le rendu visuel. |
|
|
460 |
*/ |
|
|
461 |
public void drawJoints(JointCollection joints, Skeleton first) |
|
|
462 |
{ |
|
|
463 |
if (refreshImage) |
|
|
464 |
{ |
|
|
465 |
//On enlève tout élément du Canvas à part l'image, de manière à mettre à jour la position du squelette. |
|
|
466 |
DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
|
|
467 |
|
|
|
468 |
//Pour chaque noeud. |
|
|
469 |
foreach (Joint joint in first.Joints) |
|
|
470 |
{ |
|
|
471 |
//On crée une ellipse de taille 20 et de largeur 20. |
|
|
472 |
Ellipse node = new Ellipse(); |
|
|
473 |
node.Height = 20; |
|
|
474 |
node.Width = 20; |
|
|
475 |
|
|
|
476 |
//S'il s'agit d'un noeud de tête, on le colorie en rouge, sinon en bleu. |
|
|
477 |
if (joint.JointType == JointType.Head) |
|
|
478 |
node.Fill = System.Windows.Media.Brushes.Red; |
|
|
479 |
else if (joint.JointType == JointType.ShoulderCenter) |
|
|
480 |
node.Fill = System.Windows.Media.Brushes.Green; |
|
|
481 |
else if (joint.JointType == JointType.HipCenter) |
|
|
482 |
node.Fill = System.Windows.Media.Brushes.Green; |
|
|
483 |
else if (joint.JointType == JointType.HandRight) |
|
|
484 |
node.Fill = System.Windows.Media.Brushes.Red; |
|
|
485 |
else |
|
|
486 |
node.Fill = System.Windows.Media.Brushes.Blue; |
|
|
487 |
|
|
|
488 |
//On met à la bonne échelle les coordonnées des positions des noeuds. |
|
|
489 |
Joint scaledJoint = Coding4Fun.Kinect.Wpf.SkeletalExtensions.ScaleTo(joint, 600, 400, 0.75f, 0.75f); |
|
|
490 |
|
|
|
491 |
//On positionne le noeud dans le Canvas, et on l'ajoute. |
|
|
492 |
Canvas.SetLeft(node, scaledJoint.Position.X); |
|
|
493 |
Canvas.SetTop(node, scaledJoint.Position.Y); |
|
|
494 |
DebugCanvas.Children.Add(node); |
|
|
495 |
} |
|
|
496 |
} |
|
|
497 |
} |
|
|
498 |
|
|
|
499 |
/* |
|
|
500 |
* Dessine un os, en ayant en paramètres deux noeuds. |
|
|
501 |
*/ |
|
|
502 |
public void drawBone(Joint j1, Joint j2) |
|
|
503 |
{ |
|
|
504 |
//On crée une nouvelle ligne verte d'épaisseur 8 entre les deux noeuds et on l'ajoute au Canvas. |
|
|
505 |
Line line = new Line(); |
|
|
506 |
line.Stroke = System.Windows.Media.Brushes.Green; |
|
|
507 |
line.X1 = j1.Position.X; |
|
|
508 |
line.X2 = j2.Position.X; |
|
|
509 |
line.Y1 = j1.Position.Y; |
|
|
510 |
line.Y2 = j2.Position.Y; |
|
|
511 |
line.StrokeThickness = 8; |
|
|
512 |
DebugCanvas.Children.Add(line); |
|
|
513 |
} |
|
|
514 |
|
|
|
515 |
/* |
|
|
516 |
* Dessine le squelette (ensemble des os), en ayant en paramètres tous les noeuds. |
|
|
517 |
*/ |
|
|
518 |
public void showSkeleton(Joint hipCenter, Joint spine, Joint shoulderCenter, Joint head, Joint shoulderLeft, Joint elbowLeft, Joint wristLeft, Joint handLeft, Joint shoulderRight, Joint elbowRight, Joint wristRight, Joint handRight, Joint hipLeft, Joint kneeLeft, Joint ankleLeft, Joint footLeft, Joint hipRight, Joint kneeRight, Joint ankleRight, Joint footRight) |
|
|
519 |
{ |
|
|
520 |
if (refreshImage) |
|
|
521 |
{ |
|
|
522 |
//On met les noeuds deux par deux en fonction de leur position dans le squelette. |
|
|
523 |
drawBone(head, shoulderCenter); |
|
|
524 |
drawBone(shoulderCenter, shoulderLeft); |
|
|
525 |
drawBone(shoulderLeft, elbowLeft); |
|
|
526 |
drawBone(elbowLeft, wristLeft); |
|
|
527 |
drawBone(wristLeft, handLeft); |
|
|
528 |
drawBone(shoulderCenter, shoulderRight); |
|
|
529 |
drawBone(shoulderRight, elbowRight); |
|
|
530 |
drawBone(elbowRight, wristRight); |
|
|
531 |
drawBone(wristRight, handRight); |
|
|
532 |
drawBone(shoulderCenter, spine); |
|
|
533 |
drawBone(spine, hipCenter); |
|
|
534 |
drawBone(hipCenter, hipLeft); |
|
|
535 |
drawBone(hipLeft, kneeLeft); |
|
|
536 |
drawBone(kneeLeft, ankleLeft); |
|
|
537 |
drawBone(ankleLeft, footLeft); |
|
|
538 |
drawBone(hipCenter, hipRight); |
|
|
539 |
drawBone(hipRight, kneeRight); |
|
|
540 |
drawBone(kneeRight, ankleRight); |
|
|
541 |
drawBone(ankleRight, footRight); |
|
|
542 |
} |
|
|
543 |
} |
|
|
544 |
|
|
|
545 |
/* |
|
|
546 |
* Cache le squelette et le reste de l'interface à part l'image. |
|
|
547 |
*/ |
|
|
548 |
public void hideSkeleton() |
|
|
549 |
{ |
|
|
550 |
//On vide le canvas mais en gardant l'image. |
|
|
551 |
if(DebugCanvas.Children.Count > 1) |
|
|
552 |
DebugCanvas.Children.RemoveRange(1, DebugCanvas.Children.Count - 1); |
|
|
553 |
//On colore en gris tous les indicateurs. |
|
|
554 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
555 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
556 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
557 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
558 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
559 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
560 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
561 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
562 |
R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
563 |
R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
564 |
R10.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
565 |
} |
|
|
566 |
|
|
|
567 |
/* |
|
|
568 |
* Affiche la position de la main gauche dans le rendu visuel. |
|
|
569 |
*/ |
|
|
570 |
public void showLeftHandCoord(String coord) |
|
|
571 |
{ |
|
|
572 |
LeftHand.Content = coord; |
|
|
573 |
} |
|
|
574 |
|
|
|
575 |
/* |
|
|
576 |
* Affiche la position de la main gauche dans le rendu visuel. |
|
|
577 |
*/ |
|
|
578 |
public void showRightHandCoord(String coord) |
|
|
579 |
{ |
|
|
580 |
RightHand.Content = coord; |
|
|
581 |
} |
|
|
582 |
|
|
|
583 |
/* |
|
|
584 |
* Méthode associée à l'événement : Ouvrir la fenêtre de paramétrage via le menu. |
|
|
585 |
*/ |
|
|
586 |
private void Parameters_Click(object sender, RoutedEventArgs e) |
|
|
587 |
{ |
|
|
588 |
try |
|
|
589 |
{ |
|
|
590 |
param.ShowDialog(); |
|
|
591 |
} |
|
|
592 |
catch (Exception) |
|
|
593 |
{ |
|
|
594 |
ExceptionLbl.Content = rm.GetString("loadParamFail"); |
|
|
595 |
} |
|
|
596 |
} |
|
|
597 |
|
|
|
598 |
/* |
|
|
599 |
* Méthode associée à l'événement : Quitter via le menu. |
|
|
600 |
*/ |
|
|
601 |
public void Quit_Click(object sender, RoutedEventArgs e) |
|
|
602 |
{ |
|
|
603 |
closing = true; |
|
|
604 |
//On éteint la Kinect (pour éviter qu'elle reste allumée même lorsque le programme est éteint). |
|
|
605 |
|
|
|
606 |
Application.Current.Shutdown(); |
|
|
607 |
} |
|
|
608 |
|
|
|
609 |
/* |
|
|
610 |
* Permet d'initialiser la Kinect dès que la fenêtre est lancée. |
|
|
611 |
*/ |
|
|
612 |
private void Window_Loaded(object sender, RoutedEventArgs e) |
|
|
613 |
{ |
|
|
614 |
//kinectMain.KinectInitialization(); |
|
|
615 |
} |
|
|
616 |
|
|
|
617 |
/* |
|
18
|
618 |
* Permet d'obtenir l'image associée à l'emplacement des images si celle-ci existe. |
|
|
619 |
*/ |
|
|
620 |
public Bitmap getImage(String location) |
|
|
621 |
{ |
|
|
622 |
try |
|
|
623 |
{ |
|
|
624 |
return new Bitmap(location); |
|
|
625 |
} |
|
|
626 |
catch (Exception) |
|
|
627 |
{ |
|
|
628 |
return (Bitmap)rm.GetObject("_404"); |
|
|
629 |
} |
|
|
630 |
} |
|
|
631 |
|
|
|
632 |
/* |
|
15
|
633 |
* Méthode d'affichage des gestures. |
|
|
634 |
*/ |
|
|
635 |
public void showGesture(String gesture) |
|
|
636 |
{ |
|
|
637 |
if (refreshImage) |
|
|
638 |
{ |
|
|
639 |
refreshImage = false; |
|
|
640 |
_timer.Start(); |
|
|
641 |
Bitmap bitmap = null; |
|
|
642 |
//S'il s'agit de telle ou telle gesture, on prend l'image correspondante dans les ressources, |
|
|
643 |
//on la convertit et on l'affiche. |
|
|
644 |
switch (gesture) |
|
|
645 |
{ |
|
18
|
646 |
case "SWIPE-LEFT": bitmap = getImage(imgLocation + "\\swipe_left.png"); |
|
15
|
647 |
break; |
|
18
|
648 |
case "SWIPE-RIGHT": bitmap = getImage(imgLocation + "\\swipe_right.png"); |
|
15
|
649 |
break; |
|
18
|
650 |
case "PUSH-RIGHT": bitmap = getImage(imgLocation + "\\push_right.png"); |
|
15
|
651 |
break; |
|
18
|
652 |
case "PUSH-LEFT": bitmap = getImage(imgLocation + "\\push_left.png"); |
|
15
|
653 |
break; |
|
18
|
654 |
case "PUSH-BOTH": bitmap = getImage(imgLocation + "\\push_both.png"); |
|
15
|
655 |
break; |
|
18
|
656 |
case "PULL-RIGHT": bitmap = getImage(imgLocation + "\\pull_right.png"); |
|
15
|
657 |
break; |
|
18
|
658 |
case "PULL-LEFT": bitmap = getImage(imgLocation + "\\pull_left.png"); |
|
15
|
659 |
break; |
|
18
|
660 |
case "PULL-BOTH": bitmap = getImage(imgLocation + "\\pull_both.png"); |
|
15
|
661 |
break; |
|
18
|
662 |
case "WAVE": bitmap = getImage(imgLocation + "\\wave.png"); |
|
17
|
663 |
break; |
|
18
|
664 |
case "BEND": bitmap = getImage(imgLocation + "\\bend.png"); |
|
17
|
665 |
break; |
|
18
|
666 |
case "CROSS": bitmap = getImage(imgLocation + "\\cross.png"); |
|
17
|
667 |
break; |
|
18
|
668 |
case "KNEE-UP": bitmap = getImage(imgLocation + "\\knee_up.png"); |
|
17
|
669 |
break; |
|
15
|
670 |
} |
|
|
671 |
Gestures.Source = CreateBitmapSourceFromBitmap(bitmap); |
|
|
672 |
} |
|
|
673 |
|
|
|
674 |
DebugImage.Source = null; |
|
|
675 |
hideSkeleton(); |
|
|
676 |
} |
|
|
677 |
|
|
|
678 |
/* |
|
|
679 |
* Méthode d'indication de raffraichissement de l'image ("on la raffraichit ou pas ?"). |
|
|
680 |
*/ |
|
|
681 |
public void setRefreshImage(bool refresh) |
|
|
682 |
{ |
|
|
683 |
refreshImage = refresh; |
|
|
684 |
} |
|
|
685 |
|
|
|
686 |
/* |
|
|
687 |
* Méthode de conversion de Bitmap (des ressources) en BitmapSource (du debug). |
|
|
688 |
*/ |
|
|
689 |
public static BitmapSource CreateBitmapSourceFromBitmap(Bitmap bitmap) |
|
|
690 |
{ |
|
|
691 |
if (bitmap == null) |
|
|
692 |
return null; |
|
|
693 |
|
|
|
694 |
return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( |
|
|
695 |
bitmap.GetHbitmap(), |
|
|
696 |
IntPtr.Zero, |
|
|
697 |
Int32Rect.Empty, |
|
|
698 |
BitmapSizeOptions.FromEmptyOptions()); |
|
|
699 |
} |
|
|
700 |
|
|
|
701 |
/* |
|
|
702 |
* Méthode de chargement des paramètres (position du champ de recherche...). |
|
|
703 |
*/ |
|
|
704 |
public bool loadParameters() |
|
|
705 |
{ |
|
|
706 |
try |
|
|
707 |
{ |
|
|
708 |
minDistHands = Properties.Settings.Default.searchMinDistance; |
|
|
709 |
maxDistHands = Properties.Settings.Default.searchMaxDistance; |
|
|
710 |
minDist = Properties.Settings.Default.minDistance; |
|
|
711 |
maxDist = Properties.Settings.Default.maxDistance; |
|
|
712 |
zeroPoint = Properties.Settings.Default.zeroPoint; |
|
|
713 |
connexionHost = Properties.Settings.Default.connexionHost; |
|
|
714 |
connexionPort = Properties.Settings.Default.connexionPort; |
|
|
715 |
timerElapsing = Properties.Settings.Default.timerElapsing; |
|
|
716 |
imagesToShow = Properties.Settings.Default.imagesToShow; |
|
|
717 |
takenPoints = Properties.Settings.Default.takenPoints; |
|
|
718 |
directionChangeTresholdXY = Properties.Settings.Default.directionChangeTresholdXY; |
|
|
719 |
directionChangeTresholdZ = Properties.Settings.Default.directionChangeTresholdZ; |
|
|
720 |
} |
|
|
721 |
catch (Exception) |
|
|
722 |
{ |
|
|
723 |
return false; |
|
|
724 |
} |
|
|
725 |
|
|
|
726 |
if (maxDistHands <= 0f || minDistHands <= 0f || maxDistHands > maxDist || minDistHands > maxDist || |
|
|
727 |
minDistHands >= maxDistHands || zeroPoint < maxDistHands || minDistHands > minDist || |
|
|
728 |
zeroPoint >= maxDist || connexionPort < 0 || timerElapsing < 0 || imagesToShow < 1 || |
|
|
729 |
takenPoints <= 0 || directionChangeTresholdXY < 0 || directionChangeTresholdZ < 0) |
|
|
730 |
{ |
|
|
731 |
ExceptionLbl.Content = rm.GetString("loadParametersIncorrect"); |
|
|
732 |
return false; |
|
|
733 |
} |
|
|
734 |
return true; |
|
|
735 |
} |
|
|
736 |
|
|
|
737 |
/* |
|
|
738 |
* Met à jour les nouveaux paramètres dans la configuration. |
|
|
739 |
*/ |
|
|
740 |
public void updateParameters() |
|
|
741 |
{ |
|
|
742 |
//userPositionDetector.setParams(minDist, maxDist, minDistHands, maxDistHands, zeroPoint); |
|
|
743 |
//segmenter.setParams(takenPoints, directionChangeTresholdXY, directionChangeTresholdZ); |
|
|
744 |
|
|
|
745 |
//On récupère la config. |
|
|
746 |
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); |
|
|
747 |
//On met à jour. |
|
|
748 |
Properties.Settings.Default.Context.Remove("searchMinDistance"); |
|
|
749 |
Properties.Settings.Default.Context.Add("searchMinDistance", minDistHands.ToString()); |
|
|
750 |
Properties.Settings.Default.Context.Remove("searchMaxDistance"); |
|
|
751 |
Properties.Settings.Default.Context.Add("searchMaxDistance", maxDistHands.ToString()); |
|
|
752 |
Properties.Settings.Default.Context.Remove("minDistance"); |
|
|
753 |
Properties.Settings.Default.Context.Add("minDistance", minDist.ToString()); |
|
|
754 |
Properties.Settings.Default.Context.Remove("maxDistance"); |
|
|
755 |
Properties.Settings.Default.Context.Add("maxDistance", maxDist.ToString()); |
|
|
756 |
Properties.Settings.Default.Context.Remove("zeroPoint"); |
|
|
757 |
Properties.Settings.Default.Context.Add("zeroPoint", zeroPoint.ToString()); |
|
|
758 |
Properties.Settings.Default.Context.Remove("connexionHost"); |
|
|
759 |
Properties.Settings.Default.Context.Add("connexionHost", connexionHost); |
|
|
760 |
Properties.Settings.Default.Context.Remove("connexionPort"); |
|
|
761 |
Properties.Settings.Default.Context.Add("connexionPort", connexionPort.ToString()); |
|
|
762 |
Properties.Settings.Default.Context.Remove("timerElapsing"); |
|
|
763 |
Properties.Settings.Default.Context.Add("timerElapsing", timerElapsing.ToString()); |
|
|
764 |
Properties.Settings.Default.Context.Remove("imagesToShow"); |
|
|
765 |
Properties.Settings.Default.Context.Add("imagesToShow", imagesToShow.ToString()); |
|
|
766 |
Properties.Settings.Default.Context.Remove("takenPoints"); |
|
|
767 |
Properties.Settings.Default.Context.Add("takenPoints", takenPoints.ToString()); |
|
|
768 |
Properties.Settings.Default.Context.Remove("directionChangeTresholdXY"); |
|
|
769 |
Properties.Settings.Default.Context.Add("directionChangeTresholdXY", directionChangeTresholdXY.ToString()); |
|
|
770 |
Properties.Settings.Default.Context.Remove("directionChangeTresholdZ"); |
|
|
771 |
Properties.Settings.Default.Context.Add("directionChangeTresholdZ", directionChangeTresholdZ.ToString()); |
|
|
772 |
|
|
|
773 |
//Sauvegarde la configuration. |
|
|
774 |
Properties.Settings.Default.Save(); |
|
|
775 |
Properties.Settings.Default.Reload(); |
|
|
776 |
} |
|
|
777 |
|
|
|
778 |
/* |
|
|
779 |
* Getters et setters des paramètres du Middleware. |
|
|
780 |
*/ |
|
|
781 |
public void setMinDistHands(float min) |
|
|
782 |
{ |
|
|
783 |
minDistHands = min; |
|
|
784 |
} |
|
|
785 |
public void setMaxDistHands(float max) |
|
|
786 |
{ |
|
|
787 |
maxDistHands = max; |
|
|
788 |
} |
|
|
789 |
public void setMinDist(float min) |
|
|
790 |
{ |
|
|
791 |
minDist = min; |
|
|
792 |
} |
|
|
793 |
public void setMaxDist(float max) |
|
|
794 |
{ |
|
|
795 |
maxDist = max; |
|
|
796 |
} |
|
|
797 |
public void setZeroPoint(float zero) |
|
|
798 |
{ |
|
|
799 |
zeroPoint = zero; |
|
|
800 |
} |
|
|
801 |
public void setConnexionHost(String host) |
|
|
802 |
{ |
|
|
803 |
connexionHost = host; |
|
|
804 |
} |
|
|
805 |
public void setConnexionPort(int port) |
|
|
806 |
{ |
|
|
807 |
connexionPort = port; |
|
|
808 |
} |
|
|
809 |
public void setTimerElapsing(int time) |
|
|
810 |
{ |
|
|
811 |
timerElapsing = time; |
|
|
812 |
} |
|
|
813 |
public void setImagesToShow(int _imagesToShow) |
|
|
814 |
{ |
|
|
815 |
imagesToShow = _imagesToShow; |
|
|
816 |
} |
|
|
817 |
public void setTakenPoints(int _takenPoints) |
|
|
818 |
{ |
|
|
819 |
takenPoints = _takenPoints; |
|
|
820 |
} |
|
|
821 |
public void setDirectionChangeTresholdXY(int _directionChangeTresholdXY) |
|
|
822 |
{ |
|
|
823 |
directionChangeTresholdXY = _directionChangeTresholdXY; |
|
|
824 |
} |
|
|
825 |
public void setDirectionChangeTresholdZ(float _directionChangeTresholdZ) |
|
|
826 |
{ |
|
|
827 |
directionChangeTresholdZ = _directionChangeTresholdZ; |
|
|
828 |
} |
|
|
829 |
public void setSwitch(Button _switch) |
|
|
830 |
{ |
|
|
831 |
Switch = _switch; |
|
|
832 |
} |
|
|
833 |
public void setOn(bool _on) |
|
|
834 |
{ |
|
|
835 |
on = _on; |
|
|
836 |
} |
|
|
837 |
public void setQuitMenu(MenuItem quitMenu) |
|
|
838 |
{ |
|
|
839 |
QuitMenu = quitMenu; |
|
|
840 |
} |
|
16
|
841 |
public void setParametersWindow(DebugParameters parameters) |
|
|
842 |
{ |
|
|
843 |
param = parameters; |
|
|
844 |
} |
|
|
845 |
public void setParamMenu(MenuItem parameters) |
|
|
846 |
{ |
|
|
847 |
ParamMenu = parameters; |
|
|
848 |
} |
|
15
|
849 |
|
|
|
850 |
public float getMinDistHands() |
|
|
851 |
{ |
|
|
852 |
return minDistHands; |
|
|
853 |
} |
|
|
854 |
public float getMaxDistHands() |
|
|
855 |
{ |
|
|
856 |
return maxDistHands; |
|
|
857 |
} |
|
|
858 |
public float getMinDist() |
|
|
859 |
{ |
|
|
860 |
return minDist; |
|
|
861 |
} |
|
|
862 |
public float getMaxDist() |
|
|
863 |
{ |
|
|
864 |
return maxDist; |
|
|
865 |
} |
|
|
866 |
public float getZeroPoint() |
|
|
867 |
{ |
|
|
868 |
return zeroPoint; |
|
|
869 |
} |
|
|
870 |
public String getConnexionHost() |
|
|
871 |
{ |
|
|
872 |
return connexionHost; |
|
|
873 |
} |
|
|
874 |
public int getConnexionPort() |
|
|
875 |
{ |
|
|
876 |
return connexionPort; |
|
|
877 |
} |
|
|
878 |
public int getTimerElapsing() |
|
|
879 |
{ |
|
|
880 |
return timerElapsing; |
|
|
881 |
} |
|
|
882 |
public int getImagesToShow() |
|
|
883 |
{ |
|
|
884 |
return imagesToShow; |
|
|
885 |
} |
|
|
886 |
public int getTakenPoints() |
|
|
887 |
{ |
|
|
888 |
return takenPoints; |
|
|
889 |
} |
|
|
890 |
public int getDirectionChangeTresholdXY() |
|
|
891 |
{ |
|
|
892 |
return directionChangeTresholdXY; |
|
|
893 |
} |
|
|
894 |
public float getDirectionChangeTresholdZ() |
|
|
895 |
{ |
|
|
896 |
return directionChangeTresholdZ; |
|
|
897 |
} |
|
|
898 |
public Button getSwitch() |
|
|
899 |
{ |
|
|
900 |
return Switch; |
|
|
901 |
} |
|
|
902 |
public bool getOn() |
|
|
903 |
{ |
|
|
904 |
return on; |
|
|
905 |
} |
|
|
906 |
public MenuItem getQuitMenu() |
|
|
907 |
{ |
|
|
908 |
return QuitMenu; |
|
|
909 |
} |
|
16
|
910 |
public DebugParameters getParametersWindow() |
|
|
911 |
{ |
|
|
912 |
return param; |
|
|
913 |
} |
|
|
914 |
public MenuItem getParamMenu() |
|
|
915 |
{ |
|
|
916 |
return ParamMenu; |
|
|
917 |
} |
|
17
|
918 |
|
|
|
919 |
public void onR0(bool b) |
|
|
920 |
{ |
|
|
921 |
if(b) |
|
|
922 |
R0.Fill = System.Windows.Media.Brushes.Blue; |
|
|
923 |
else |
|
|
924 |
R0.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
925 |
} |
|
|
926 |
public void onR1(bool b) |
|
|
927 |
{ |
|
|
928 |
if (b) |
|
|
929 |
R1.Fill = System.Windows.Media.Brushes.Blue; |
|
|
930 |
else |
|
|
931 |
R1.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
932 |
} |
|
|
933 |
public void onR2(bool b) |
|
|
934 |
{ |
|
|
935 |
if (b) |
|
|
936 |
R2.Fill = System.Windows.Media.Brushes.Blue; |
|
|
937 |
else |
|
|
938 |
R2.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
939 |
} |
|
|
940 |
public void onR3(bool b) |
|
|
941 |
{ |
|
|
942 |
if (b) |
|
|
943 |
R3.Fill = System.Windows.Media.Brushes.Blue; |
|
|
944 |
else |
|
|
945 |
R3.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
946 |
} |
|
|
947 |
public void onR4(bool b) |
|
|
948 |
{ |
|
|
949 |
if (b) |
|
|
950 |
R4.Fill = System.Windows.Media.Brushes.Blue; |
|
|
951 |
else |
|
|
952 |
R4.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
953 |
} |
|
|
954 |
public void onR5(bool b) |
|
|
955 |
{ |
|
|
956 |
if (b) |
|
|
957 |
R5.Fill = System.Windows.Media.Brushes.Blue; |
|
|
958 |
else |
|
|
959 |
R5.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
960 |
} |
|
|
961 |
public void onR6(bool b) |
|
|
962 |
{ |
|
|
963 |
if (b) |
|
|
964 |
R6.Fill = System.Windows.Media.Brushes.Blue; |
|
|
965 |
else |
|
|
966 |
R6.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
967 |
} |
|
|
968 |
public void onR7(bool b) |
|
|
969 |
{ |
|
|
970 |
if (b) |
|
|
971 |
R7.Fill = System.Windows.Media.Brushes.Blue; |
|
|
972 |
else |
|
|
973 |
R7.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
974 |
} |
|
|
975 |
public void onR8(bool b) |
|
|
976 |
{ |
|
|
977 |
if (b) |
|
|
978 |
R8.Fill = System.Windows.Media.Brushes.Blue; |
|
|
979 |
else |
|
|
980 |
R8.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
981 |
} |
|
|
982 |
public void onR9(bool b) |
|
|
983 |
{ |
|
|
984 |
if (b) |
|
|
985 |
R9.Fill = System.Windows.Media.Brushes.Blue; |
|
|
986 |
else |
|
|
987 |
R9.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
988 |
} |
|
|
989 |
public void onR10(bool b) |
|
|
990 |
{ |
|
|
991 |
if (b) |
|
|
992 |
R10.Fill = System.Windows.Media.Brushes.Blue; |
|
|
993 |
else |
|
|
994 |
R10.Fill = System.Windows.Media.Brushes.DarkGray; |
|
|
995 |
} |
|
15
|
996 |
} |
|
|
997 |
} |