|
4
|
1 |
/* |
|
8
|
2 |
* This file is part of the TraKERS\Middleware package. |
|
|
3 |
* |
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
|
5 |
* |
|
|
6 |
* For the full copyright and license information, please view the LICENSE_MIDDLEWARE |
|
|
7 |
* file that was distributed with this source code. |
|
|
8 |
*/ |
|
|
9 |
|
|
|
10 |
/* |
|
4
|
11 |
* Projet : TraKERS |
|
|
12 |
* Module : MIDDLEWARE |
|
|
13 |
* Sous-Module : Tracking/Events |
|
|
14 |
* Classe : PushListener |
|
|
15 |
* |
|
|
16 |
* Auteur : alexandre.bastien@iri.centrepompidou.fr |
|
|
17 |
* |
|
|
18 |
* Fonctionnalités : Ce listener écoute l'événement du type : L'utilisateur a effectué un push. |
|
|
19 |
* Il contient le code a être éxecuté au cas où cet événement survient, à savoir : |
|
|
20 |
* - On affiche un visuel dans le debug. |
|
|
21 |
* - On notifie le serveur TUIO. |
|
|
22 |
*/ |
|
|
23 |
|
|
|
24 |
using System; |
|
|
25 |
using System.Collections.Generic; |
|
|
26 |
using System.Linq; |
|
|
27 |
using System.Text; |
|
|
28 |
|
|
|
29 |
namespace Trakers.Tracking.Events |
|
|
30 |
{ |
|
|
31 |
public class PushListener |
|
|
32 |
{ |
|
|
33 |
/* |
|
|
34 |
* Méthode appelée lorsque on a l'événement : L'utilisateur a effectué un push. |
|
|
35 |
*/ |
|
|
36 |
public void ShowOnScreen(object o, PushEventArgs e) |
|
|
37 |
{ |
|
|
38 |
//On l'indique dans le debug. |
|
11
|
39 |
//Lorsqu'il s'agit d'un push/pull de la main gauche/droite/deux deux on envoie le message |
|
|
40 |
//correspondant. |
|
|
41 |
if (e.direction == Gestures.PushDetector.Direction.PUSH) |
|
|
42 |
{ |
|
|
43 |
if (e.hand == Gestures.PushDetector.Hand.RIGHT) |
|
|
44 |
e.debug.showGesture("PUSH-RIGHT"); |
|
|
45 |
else if (e.hand == Gestures.PushDetector.Hand.LEFT) |
|
|
46 |
e.debug.showGesture("PUSH-LEFT"); |
|
|
47 |
else |
|
|
48 |
e.debug.showGesture("PUSH-BOTH"); |
|
|
49 |
} |
|
|
50 |
else |
|
|
51 |
{ |
|
|
52 |
if (e.hand == Gestures.PushDetector.Hand.RIGHT) |
|
|
53 |
e.debug.showGesture("PULL-RIGHT"); |
|
|
54 |
else if (e.hand == Gestures.PushDetector.Hand.LEFT) |
|
|
55 |
e.debug.showGesture("PULL-LEFT"); |
|
|
56 |
else |
|
|
57 |
e.debug.showGesture("PULL-BOTH"); |
|
|
58 |
} |
|
4
|
59 |
//On notifie le serveur TUIO. |
|
11
|
60 |
e.server.Push(o, e); |
|
4
|
61 |
} |
|
|
62 |
} |
|
|
63 |
} |