54 private int imagesToShow; |
54 private int imagesToShow; |
55 //Paramètres de la recherche par courbes. |
55 //Paramètres de la recherche par courbes. |
56 private int takenPoints; |
56 private int takenPoints; |
57 private int directionChangeTresholdXY; |
57 private int directionChangeTresholdXY; |
58 private float directionChangeTresholdZ; |
58 private float directionChangeTresholdZ; |
|
59 //Images |
|
60 private String imgLocation; |
59 |
61 |
60 //Timer. |
62 //Timer. |
61 private System.Timers.Timer _timer; |
63 private System.Timers.Timer _timer; |
62 //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking. |
64 //Membre permettant d'atteindre la classe KinectMain du sous-module Tracking. |
63 //private KinectMain kinectMain; |
65 //private KinectMain kinectMain; |
78 * Au départ, la kinect est éteinte. |
80 * Au départ, la kinect est éteinte. |
79 */ |
81 */ |
80 public DebugWindow()//KinectMain main) |
82 public DebugWindow()//KinectMain main) |
81 { |
83 { |
82 InitializeComponent(); |
84 InitializeComponent(); |
|
85 |
|
86 imgLocation = "Imgs"; |
|
87 |
83 //On fait appel au gestionnaire de ressources. |
88 //On fait appel au gestionnaire de ressources. |
84 rm = new ResourceManager("Trakers.Debug.Properties.Resources", Assembly.GetExecutingAssembly()); |
89 rm = new ResourceManager("Trakers.Debug.Properties.Resources", Assembly.GetExecutingAssembly()); |
85 //On tente de charger les paramètres du fichier params.ini. |
90 //On tente de charger les paramètres du fichier params.ini. |
86 //Si on n'y arrive pas, on affiche une erreur et on charge les paramètres par défaut. |
91 //Si on n'y arrive pas, on affiche une erreur et on charge les paramètres par défaut. |
87 if (!loadParameters()) |
92 if (!loadParameters()) |
608 { |
613 { |
609 //kinectMain.KinectInitialization(); |
614 //kinectMain.KinectInitialization(); |
610 } |
615 } |
611 |
616 |
612 /* |
617 /* |
|
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 /* |
613 * Méthode d'affichage des gestures. |
633 * Méthode d'affichage des gestures. |
614 */ |
634 */ |
615 public void showGesture(String gesture) |
635 public void showGesture(String gesture) |
616 { |
636 { |
617 if (refreshImage) |
637 if (refreshImage) |
621 Bitmap bitmap = null; |
641 Bitmap bitmap = null; |
622 //S'il s'agit de telle ou telle gesture, on prend l'image correspondante dans les ressources, |
642 //S'il s'agit de telle ou telle gesture, on prend l'image correspondante dans les ressources, |
623 //on la convertit et on l'affiche. |
643 //on la convertit et on l'affiche. |
624 switch (gesture) |
644 switch (gesture) |
625 { |
645 { |
626 case "SWIPE-LEFT": bitmap = (Bitmap)rm.GetObject("swipe_left"); |
646 case "SWIPE-LEFT": bitmap = getImage(imgLocation + "\\swipe_left.png"); |
627 break; |
647 break; |
628 case "SWIPE-RIGHT": bitmap = (Bitmap)rm.GetObject("swipe_right"); |
648 case "SWIPE-RIGHT": bitmap = getImage(imgLocation + "\\swipe_right.png"); |
629 break; |
649 break; |
630 case "PUSH-RIGHT": bitmap = (Bitmap)rm.GetObject("push_right"); |
650 case "PUSH-RIGHT": bitmap = getImage(imgLocation + "\\push_right.png"); |
631 break; |
651 break; |
632 case "PUSH-LEFT": bitmap = (Bitmap)rm.GetObject("push_left"); |
652 case "PUSH-LEFT": bitmap = getImage(imgLocation + "\\push_left.png"); |
633 break; |
653 break; |
634 case "PUSH-BOTH": bitmap = (Bitmap)rm.GetObject("push_both"); |
654 case "PUSH-BOTH": bitmap = getImage(imgLocation + "\\push_both.png"); |
635 break; |
655 break; |
636 case "PULL-RIGHT": bitmap = (Bitmap)rm.GetObject("pull_right"); |
656 case "PULL-RIGHT": bitmap = getImage(imgLocation + "\\pull_right.png"); |
637 break; |
657 break; |
638 case "PULL-LEFT": bitmap = (Bitmap)rm.GetObject("pull_left"); |
658 case "PULL-LEFT": bitmap = getImage(imgLocation + "\\pull_left.png"); |
639 break; |
659 break; |
640 case "PULL-BOTH": bitmap = (Bitmap)rm.GetObject("pull_both"); |
660 case "PULL-BOTH": bitmap = getImage(imgLocation + "\\pull_both.png"); |
641 break; |
661 break; |
642 case "WAVE": bitmap = (Bitmap)rm.GetObject("wave"); |
662 case "WAVE": bitmap = getImage(imgLocation + "\\wave.png"); |
643 break; |
663 break; |
644 case "BEND": bitmap = (Bitmap)rm.GetObject("bend"); |
664 case "BEND": bitmap = getImage(imgLocation + "\\bend.png"); |
645 break; |
665 break; |
646 case "CROSS": bitmap = (Bitmap)rm.GetObject("cross"); |
666 case "CROSS": bitmap = getImage(imgLocation + "\\cross.png"); |
647 break; |
667 break; |
648 case "KNEE-UP": bitmap = (Bitmap)rm.GetObject("knee_up"); |
668 case "KNEE-UP": bitmap = getImage(imgLocation + "\\knee_up.png"); |
649 break; |
669 break; |
650 } |
670 } |
651 Gestures.Source = CreateBitmapSourceFromBitmap(bitmap); |
671 Gestures.Source = CreateBitmapSourceFromBitmap(bitmap); |
652 } |
672 } |
653 |
673 |