equal
deleted
inserted
replaced
37 namespace Trakers.Debug |
37 namespace Trakers.Debug |
38 { |
38 { |
39 public partial class DebugWindow : Window |
39 public partial class DebugWindow : Window |
40 { |
40 { |
41 //Nom du projet, afin de savoir quel menu charger et quel fichier de configuration utiliser (TraKERS ou BBM). |
41 //Nom du projet, afin de savoir quel menu charger et quel fichier de configuration utiliser (TraKERS ou BBM). |
42 private String projectName = "BBM"; |
42 private String projectName = "TraKERS"; |
43 //Chemins du fichier de config. |
43 //Chemins du fichier de config. |
44 private String configPath; |
44 private String configPath; |
45 //private String projectName = "BBM"; |
45 //private String projectName = "BBM"; |
46 |
46 |
47 //Gestionnaire de ressources. |
47 //Gestionnaire de ressources. |
64 //Indique si la fenêtre de debug est actuellement en cours de fermeture. |
64 //Indique si la fenêtre de debug est actuellement en cours de fermeture. |
65 private bool closing; |
65 private bool closing; |
66 //Indique si l'image doit être raffraichie. |
66 //Indique si l'image doit être raffraichie. |
67 private Boolean refreshImage; |
67 private Boolean refreshImage; |
68 |
68 |
|
69 //Images des mains. |
|
70 BitmapSource right_hand_onBitmap, right_hand_offBitmap, left_hand_onBitmap, left_hand_offBitmap; |
|
71 |
69 /* |
72 /* |
70 * Constructeur : Affiche la fenêtre de debug en lui passant en paramètre une instanciation de la |
73 * Constructeur : Affiche la fenêtre de debug en lui passant en paramètre une instanciation de la |
71 * classe KinectMain. |
74 * classe KinectMain. |
72 * Au départ, la kinect est éteinte. |
75 * Au départ, la kinect est éteinte. |
73 */ |
76 */ |
95 configPath = ".\\BBM - config.txt"; |
98 configPath = ".\\BBM - config.txt"; |
96 loadBBMMenu(); |
99 loadBBMMenu(); |
97 } |
100 } |
98 |
101 |
99 //On initialise les images des mains. |
102 //On initialise les images des mains. |
100 Bitmap rightHandBitmap = getImage(imgLocation + "\\right_hand_off.png"), leftHandBitmap = getImage(imgLocation + "\\left_hand_off.png"); |
103 right_hand_onBitmap = CreateBitmapSourceFromBitmap(getImage(imgLocation + "\\right_hand_on.png")); |
101 LeftHand.Source = CreateBitmapSourceFromBitmap(leftHandBitmap); |
104 right_hand_offBitmap = CreateBitmapSourceFromBitmap(getImage(imgLocation + "\\right_hand_off.png")); |
102 RightHand.Source = CreateBitmapSourceFromBitmap(rightHandBitmap); |
105 left_hand_onBitmap = CreateBitmapSourceFromBitmap(getImage(imgLocation + "\\left_hand_on.png")); |
|
106 left_hand_offBitmap = CreateBitmapSourceFromBitmap(getImage(imgLocation + "\\left_hand_off.png")); |
|
107 |
|
108 LeftHand.Source = left_hand_offBitmap; |
|
109 RightHand.Source = right_hand_offBitmap; |
103 //On initialise les images de proximité. |
110 //On initialise les images de proximité. |
104 Bitmap userBitmap = getImage(imgLocation + "\\user.png"), kinectBitmap = getImage(imgLocation + "\\kinect.png"); |
111 Bitmap userBitmap = getImage(imgLocation + "\\user.png"), kinectBitmap = getImage(imgLocation + "\\kinect.png"); |
105 UserImage.Source = CreateBitmapSourceFromBitmap(userBitmap); |
112 UserImage.Source = CreateBitmapSourceFromBitmap(userBitmap); |
106 KinectImage.Source = CreateBitmapSourceFromBitmap(kinectBitmap); |
113 KinectImage.Source = CreateBitmapSourceFromBitmap(kinectBitmap); |
107 |
114 |
425 /* |
432 /* |
426 * Affiche la détection de la main droite via un label. |
433 * Affiche la détection de la main droite via un label. |
427 */ |
434 */ |
428 public void showRightHandRect(bool show) |
435 public void showRightHandRect(bool show) |
429 { |
436 { |
430 Bitmap bitmap = null; |
437 BitmapSource source = null; |
431 |
438 |
432 if (show) |
439 if (show) |
433 bitmap = getImage(imgLocation + "\\right_hand_on.png"); |
440 source = right_hand_onBitmap; |
434 else |
441 else |
435 bitmap = getImage(imgLocation + "\\right_hand_off.png"); |
442 source = right_hand_offBitmap; |
436 |
443 |
437 RightHand.Source = CreateBitmapSourceFromBitmap(bitmap); |
444 RightHand.Source = source; |
438 } |
445 } |
439 |
446 |
440 /* |
447 /* |
441 * Affiche la détection de la main gauche via un label. |
448 * Affiche la détection de la main gauche via un label. |
442 */ |
449 */ |
443 public void showLeftHandRect(bool show) |
450 public void showLeftHandRect(bool show) |
444 { |
451 { |
445 Bitmap bitmap = null; |
452 BitmapSource source = null; |
446 |
453 |
447 if (show) |
454 if (show) |
448 bitmap = getImage(imgLocation + "\\left_hand_on.png"); |
455 source = left_hand_onBitmap; |
449 else |
456 else |
450 bitmap = getImage(imgLocation + "\\left_hand_off.png"); |
457 source = left_hand_offBitmap; |
451 |
458 |
452 LeftHand.Source = CreateBitmapSourceFromBitmap(bitmap); |
459 LeftHand.Source = source; |
453 } |
460 } |
454 |
461 |
455 /* |
462 /* |
456 * Dessine les noeuds du squelette dans le rendu visuel. |
463 * Dessine les noeuds du squelette dans le rendu visuel. |
457 */ |
464 */ |
662 public static BitmapSource CreateBitmapSourceFromBitmap(Bitmap bitmap) |
669 public static BitmapSource CreateBitmapSourceFromBitmap(Bitmap bitmap) |
663 { |
670 { |
664 if (bitmap == null) |
671 if (bitmap == null) |
665 return null; |
672 return null; |
666 |
673 |
667 return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( |
674 try |
|
675 { |
|
676 return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( |
668 bitmap.GetHbitmap(), |
677 bitmap.GetHbitmap(), |
669 IntPtr.Zero, |
678 IntPtr.Zero, |
670 Int32Rect.Empty, |
679 Int32Rect.Empty, |
671 BitmapSizeOptions.FromEmptyOptions()); |
680 BitmapSizeOptions.FromEmptyOptions()); |
|
681 } |
|
682 catch (Exception) |
|
683 { |
|
684 return null; |
|
685 } |
672 } |
686 } |
673 |
687 |
674 /* |
688 /* |
675 * Méthode de chargement des paramètres via le fichier de configuration. |
689 * Méthode de chargement des paramètres via le fichier de configuration. |
676 */ |
690 */ |