|
1 TUIO JAVA LIBRARY AND EXAMPLES |
|
2 ------------------------------ |
|
3 Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu> |
|
4 This software is part of reacTIVision, an open source fiducial |
|
5 tracking and multi-touch framework based on computer vision. |
|
6 |
|
7 http://reactivision.sourceforge.net/ |
|
8 |
|
9 Demo Applications: |
|
10 ------------------ |
|
11 This package contains three demo applications which receive |
|
12 TUIO messages from any TUIO enabled tracker or the Simulator. |
|
13 All these applications show how to use the TUIO Java Library |
|
14 in a simple way. |
|
15 |
|
16 TuioDemo graphically displays the object and cursor state, |
|
17 TuioApplet is a version of TuioDemo for the web browser, |
|
18 TuioDump prints the object and cursor state to the console. |
|
19 |
|
20 You can use these demo applications for debugging purposes, |
|
21 or as a starting point for the development of your own Java |
|
22 applications implementing the TUIO protocol. Please refer to |
|
23 the source code of the example and the following section. |
|
24 |
|
25 Pressing F1 will toggle FullScreen mode with the TuioDemo, |
|
26 pressing ESC or closing the Window will end the application. |
|
27 Hitting the V key will print the TUIO events to the console. |
|
28 |
|
29 Keep in mind to make your graphics scalable for the varying |
|
30 screen and window resolutions. A reasonable TUIO application |
|
31 will run in fullscreen mode, although the windowed mode might |
|
32 be useful for debugging purposes or working with the Simulator. |
|
33 |
|
34 Application Programming Interface: |
|
35 ---------------------------------- |
|
36 First you need to create an instance of TuioClient. This class |
|
37 is listening to TUIO messages on the specified port and generates |
|
38 higher level messages based on the object events. |
|
39 |
|
40 Your application needs to implement the TuioListener interface, |
|
41 and has to be added to the TuioClient in order to receive messages. |
|
42 |
|
43 "class MyApplication implements TuioListener" |
|
44 |
|
45 A simple code snippet for setting up a TUIO session: |
|
46 |
|
47 MyApplication app = new MyApplication(); |
|
48 TuioClient client = new TuioClient(); |
|
49 client.addTuioListener(app); |
|
50 client.connect(); |
|
51 |
|
52 A TuioListener needs to implement the following methods: |
|
53 |
|
54 * addTuioObject(TuioObject tobj): |
|
55 this is called when an object becomes visible |
|
56 * removeTuioObject(TuioObject tobj): |
|
57 an object was removed from the table |
|
58 * updateTuioObject(TuioObject tobj): |
|
59 an object was moved on the table surface |
|
60 * addTuioCursor(TuioCursor tcur): |
|
61 this is called when a new cursor is detected |
|
62 * removeTuioCursor(TuioCursor tcur): |
|
63 a cursor was removed from the table |
|
64 * updateTuioCursor(TuioCursor tcur): |
|
65 a cursor was moving on the table surface |
|
66 * refresh(TuioTime bundleTime): |
|
67 this method is called after each bundle, |
|
68 use it to repaint your screen for example |
|
69 |
|
70 Each object or cursor is identified with a unique session ID, that is maintained |
|
71 over its lifetime. Additionally each object carries symbol ID that corresponds |
|
72 to its attached fiducial marker number. The cursor ID of the cursor object is always |
|
73 a number in the range of all currently detected cursor blobs. |
|
74 |
|
75 The TuioObject and TuioCursor references are updated automatically by the TuioClient |
|
76 and are always referencing the same instance over the object lifetime. |
|
77 All the TuioObject and TuioCursor attributes are encapsulated and can be |
|
78 accessed with methods such as getX(), getY() and getAngle() and so on. |
|
79 TuioObject and TuioCursor also have some additional convenience methods |
|
80 for the calculation of distances and angles between objects. The getPath() |
|
81 method returns a Vector of TuioPoint representing the movement path of the object. |
|
82 |
|
83 Alternatively the TuioClient class contains some methods for the polling |
|
84 of the current object and cursor state. There are methods which return |
|
85 either a list or individual object and cursor objects. The TuioObject and |
|
86 TuioCursor classes have been added as a container which also can be used |
|
87 by external classes. |
|
88 |
|
89 * getTuioObjects() returns a Vector of all currently present TuioObjects |
|
90 * getTuioCursors() returns a Vector of all currently present TuioCursors |
|
91 * getTuioObject(long s_id) returns a TuioObject or NULL depending on its presence |
|
92 * getTuioCursor(long s_id) returns a TuioCursor or NULL depending on its presence |
|
93 |
|
94 License: |
|
95 -------- |
|
96 This program is free software; you can redistribute it and/or modify |
|
97 it under the terms of the GNU General Public License as published by |
|
98 the Free Software Foundation; either version 2 of the License, or |
|
99 (at your option) any later version. |
|
100 |
|
101 This program is distributed in the hope that it will be useful, |
|
102 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
103 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
104 GNU General Public License for more details. |
|
105 |
|
106 You should have received a copy of the GNU General Public License |
|
107 along with this program; if not, write to the Free Software |
|
108 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
109 |
|
110 References: |
|
111 ----------- |
|
112 This application uses the JavaOSC OpenSound Control library. |
|
113 See http://www.mat.ucsb.edu/~c.ramakr/illposed/javaosc.html |
|
114 for more information and the source code. |