Interaction examples (code importé de processing.org) : Quelques petits exemples utilisant des formes basiques et réagissant à la position de la main la plus proche de Kinect.
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioClient.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioClient.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioClient.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,643 +1,643 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-package TUIO;
-
-import com.illposed.osc.*;
-import java.util.*;
-
-/**
- * The TuioClient class is the central TUIO protocol decoder component. It provides a simple callback infrastructure using the {@link TuioListener} interface.
- * In order to receive and decode TUIO messages an instance of TuioClient needs to be created. The TuioClient instance then generates TUIO events
- * which are broadcasted to all registered classes that implement the {@link TuioListener} interface.
- *
- * TuioClient client = new TuioClient();
- * client.addTuioListener(myTuioListener);
- * client.connect();
- *
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public class TuioClient implements OSCListener {
-
- public String comm;
-
- private int port = 3333;
- private OSCPortIn oscPort;
- private boolean connected = false;
- private Hashtable objectList = new Hashtable();
- private Vector aliveObjectList = new Vector();
- private Vector newObjectList = new Vector();
- private Hashtable cursorList = new Hashtable();
- private Vector aliveCursorList = new Vector();
- private Vector newCursorList = new Vector();
- private Hashtable stringList = new Hashtable();
- private Vector aliveStringList = new Vector();
- private Vector newStringList = new Vector();
-
- private Vector frameObjects = new Vector();
- private Vector frameCursors = new Vector();
- private Vector frameStrings = new Vector();
-
- private Vector freeCursorList = new Vector();
- private int maxCursorID = -1;
-
- private Vector freeStringList = new Vector();
- private int maxStringID = -1;
-
- private long currentFrame = 0;
- private TuioTime currentTime;
-
- private Vector listenerList = new Vector();
-
- /**
- * The default constructor creates a client that listens to the default TUIO port 3333
- */
- public TuioClient() {}
-
- /**
- * This constructor creates a client that listens to the provided port
- *
- * @param port the listening port number
- */
- public TuioClient(int port) {
- this.port = port;
- }
-
- /**
- * The TuioClient starts listening to TUIO messages on the configured UDP port
- * All reveived TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners
- */
- public void connect() {
-
- TuioTime.initSession();
- currentTime = new TuioTime();
- currentTime.reset();
-
- try {
- oscPort = new OSCPortIn(port);
- oscPort.addListener("/tuio/2Dobj",this);
- oscPort.addListener("/tuio/3Dcur",this);
- oscPort.addListener("/tuio/_siP",this);
- oscPort.startListening();
- connected = true;
- } catch (Exception e) {
- System.out.println("TuioClient: failed to connect to port "+port);
- connected = false;
- }
- }
-
- /**
- * The TuioClient stops listening to TUIO messages on the configured UDP port
- */
- public void disconnect() {
- oscPort.stopListening();
- try { Thread.sleep(100); }
- catch (Exception e) {};
- oscPort.close();
- connected = false;
- }
-
- /**
- * Returns true if this TuioClient is currently connected.
- * @return true if this TuioClient is currently connected
- */
- public boolean isConnected() { return connected; }
-
- /**
- * Adds the provided TuioListener to the list of registered TUIO event listeners
- *
- * @param listener the TuioListener to add
- */
- public void addTuioListener(TuioListener listener) {
- listenerList.addElement(listener);
- }
-
- /**
- * Removes the provided TuioListener from the list of registered TUIO event listeners
- *
- * @param listener the TuioListener to remove
- */
- public void removeTuioListener(TuioListener listener) {
- listenerList.removeElement(listener);
- }
-
- /**
- * Removes all TuioListener from the list of registered TUIO event listeners
- */
- public void removeAllTuioListeners() {
- listenerList.clear();
- }
-
- /**
- * Returns a Vector of all currently active TuioObjects
- *
- * @return a Vector of all currently active TuioObjects
- */
- public Vector getTuioObjects() {
- return new Vector(objectList.values());
- }
-
- /**
- * Returns a Vector of all currently active TuioCursors
- *
- * @return a Vector of all currently active TuioCursors
- */
- public Vector getTuioCursors() {
- return new Vector(cursorList.values());
- }
-
- /**
- * Returns a Vector of all currently active TuioStrings
- *
- * @return a Vector of all currently active TuioStrings
- */
- public Vector getTuioStrings() {
- return new Vector(stringList.values());
- }
-
- /**
- * Returns the TuioObject corresponding to the provided Session ID
- * or NULL if the Session ID does not refer to an active TuioObject
- *
- * @return an active TuioObject corresponding to the provided Session ID or NULL
- */
- public TuioObject getTuioObject(long s_id) {
- return objectList.get(s_id);
- }
-
- /**
- * Returns the TuioCursor corresponding to the provided Session ID
- * or NULL if the Session ID does not refer to an active TuioCursor
- *
- * @return an active TuioCursor corresponding to the provided Session ID or NULL
- */
- public TuioCursor getTuioCursor(long s_id) {
- return cursorList.get(s_id);
- }
-
- /**
- * Returns the TuioString corresponding to the provided Session ID
- * or NULL if the Session ID does not refer to an active TuioString
- *
- * @return an active TuioString corresponding to the provided Session ID or NULL
- */
- public TuioString getTuioString(long s_id) {
- return stringList.get(s_id);
- }
-
- /**
- * The OSC callback method where all TUIO messages are received and decoded
- * and where the TUIO event callbacks are dispatched
- *
- * @param date the time stamp of the OSC bundle
- * @param message the received OSC message
- */
- public void acceptMessage(Date date, OSCMessage message) {
-
- Object[] args = message.getArguments();
- String command = (String)args[0];
- String address = message.getAddress();
-
- if (address.equals("/tuio/2Dobj")) {
-
- if (command.equals("set")) {
-
- long s_id = ((Integer)args[1]).longValue();
- int c_id = ((Integer)args[2]).intValue();
- float xpos = ((Float)args[3]).floatValue();
- float ypos = ((Float)args[4]).floatValue();
- float angle = ((Float)args[5]).floatValue();
- float xspeed = ((Float)args[6]).floatValue();
- float yspeed = ((Float)args[7]).floatValue();
- float rspeed = ((Float)args[8]).floatValue();
- float maccel = ((Float)args[9]).floatValue();
- float raccel = ((Float)args[10]).floatValue();
-
- if (objectList.get(s_id) == null) {
-
- TuioObject addObject = new TuioObject(s_id,c_id,xpos,ypos,angle);
- frameObjects.addElement(addObject);
-
- } else {
-
- TuioObject tobj = objectList.get(s_id);
- if (tobj==null) return;
- if ((tobj.xpos!=xpos) || (tobj.ypos!=ypos) || (tobj.angle!=angle) || (tobj.x_speed!=xspeed) || (tobj.y_speed!=yspeed) || (tobj.rotation_speed!=rspeed) || (tobj.motion_accel!=maccel) || (tobj.rotation_accel!=raccel)) {
-
- TuioObject updateObject = new TuioObject(s_id,c_id,xpos,ypos,angle);
- updateObject.update(xpos,ypos,angle,xspeed,yspeed,rspeed,maccel,raccel);
- frameObjects.addElement(updateObject);
- }
-
- }
-
- } else if (command.equals("alive")) {
-
- newObjectList.clear();
- for (int i=1;i0) {
- if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
- if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame=fseq;
- else lateFrame = true;
- } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
- currentTime = TuioTime.getSessionTime();
- }
-
- if (!lateFrame) {
- Enumeration frameEnum = frameObjects.elements();
- while(frameEnum.hasMoreElements()) {
- TuioObject tobj = frameEnum.nextElement();
-
- switch (tobj.getTuioState()) {
- case TuioObject.TUIO_REMOVED:
- TuioObject removeObject = tobj;
- removeObject.remove(currentTime);
- for (int i=0;i buffer = aliveObjectList;
- aliveObjectList = newObjectList;
- // recycling the vector
- newObjectList = buffer;
- }
- frameObjects.clear();
- }
- } else if (address.equals("/tuio/3Dcur")) {
-
- if (command.equals("set")) {
-
- long s_id = ((Integer)args[1]).longValue();
- float xpos = ((Float)args[2]).floatValue();
- float ypos = ((Float)args[3]).floatValue();
- float zpos = ((Float)args[4]).floatValue();
- float xspeed = ((Float)args[5]).floatValue();
- float yspeed = ((Float)args[6]).floatValue();
- float maccel = ((Float)args[7]).floatValue();
-
- if (cursorList.get(s_id) == null) {
-
- TuioCursor addCursor = new TuioCursor(s_id, -1 ,xpos,ypos,zpos);
- frameCursors.addElement(addCursor);
-
- } else {
-
- TuioCursor tcur = cursorList.get(s_id);
- if (tcur==null) return;
- if ((tcur.xpos!=xpos) || (tcur.ypos!=ypos) || (tcur.zpos!=zpos) || (tcur.x_speed!=xspeed) || (tcur.y_speed!=yspeed) || (tcur.motion_accel!=maccel)) {
-
- TuioCursor updateCursor = new TuioCursor(s_id,tcur.getCursorID(),xpos,ypos,zpos);
- updateCursor.update(xpos,ypos,zpos,xspeed,yspeed,maccel);
- frameCursors.addElement(updateCursor);
- }
- }
-
- //System.out.println("set cur " + s_id+" "+xpos+" "+ypos+" "+xspeed+" "+yspeed+" "+maccel);
-
- } else if (command.equals("alive")) {
-
- newCursorList.clear();
- for (int i=1;i0) {
- if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
- if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame = fseq;
- else lateFrame = true;
- } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
- currentTime = TuioTime.getSessionTime();
- }
- if (!lateFrame) {
-
- Enumeration frameEnum = frameCursors.elements();
- while(frameEnum.hasMoreElements()) {
- TuioCursor tcur = frameEnum.nextElement();
-
- switch (tcur.getTuioState()) {
- case TuioCursor.TUIO_REMOVED:
-
- TuioCursor removeCursor = tcur;
- removeCursor.remove(currentTime);
-
- for (int i=0;i0) {
- Enumeration clist = cursorList.elements();
- while (clist.hasMoreElements()) {
- int c_id = clist.nextElement().getCursorID();
- if (c_id>maxCursorID) maxCursorID=c_id;
- }
-
- Enumeration flist = freeCursorList.elements();
- while (flist.hasMoreElements()) {
- int c_id = flist.nextElement().getCursorID();
- if (c_id>=maxCursorID) freeCursorList.removeElement(c_id);
- }
- } else freeCursorList.clear();
- } else if (removeCursor.getCursorID()0)) {
- TuioCursor closestCursor = freeCursorList.firstElement();
- Enumeration testList = freeCursorList.elements();
- while (testList.hasMoreElements()) {
- TuioCursor testCursor = testList.nextElement();
- if (testCursor.getDistance(tcur) buffer = aliveCursorList;
- aliveCursorList = newCursorList;
- // recycling the vector
- newCursorList = buffer;
- }
-
- frameCursors.clear();
- }
- } else if (address.equals("/tuio/_siP")) {
-
- if (command.equals("set")) {
-
- long s_id = ((Integer)args[1]).longValue();
- String msg = args[2].toString();
-
- if (stringList.get(s_id) == null) {
-
- TuioString addString = new TuioString(s_id, -1, msg);
- frameStrings.addElement(addString);
-
- } else {
-
- TuioString tstr = stringList.get(s_id);
- if (tstr==null) return;
- if (!tstr.getMessage().equals(msg)) {
-
- TuioString updateString = new TuioString(s_id,tstr.getStringID(),msg);
- updateString.update(msg);
- frameStrings.addElement(updateString);
- }
- }
-
- //System.out.println("set cur " + s_id+" "+xpos+" "+ypos+" "+xspeed+" "+yspeed+" "+maccel);
-
- } else if (command.equals("alive")) {
-
- newStringList.clear();
- for (int i=1;i0) {
- if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
- if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame = fseq;
- else lateFrame = true;
- } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
- currentTime = TuioTime.getSessionTime();
- }
- if (!lateFrame) {
-
- Enumeration frameEnum = frameStrings.elements();
- while(frameEnum.hasMoreElements()) {
- TuioString tstr = frameEnum.nextElement();
-
- switch (tstr.getTuioState()) {
- case TuioString.TUIO_REMOVED:
-
- TuioString removeString = tstr;
- removeString.remove(currentTime);
-
- for (int i=0;i0) {
- Enumeration slist = stringList.elements();
- while (slist.hasMoreElements()) {
- int sl_id = slist.nextElement().getStringID();
- if (sl_id>maxStringID) maxStringID=sl_id;
- }
-
- Enumeration flist = freeStringList.elements();
- while (flist.hasMoreElements()) {
- int sl_id = flist.nextElement().getStringID();
- if (sl_id>=maxStringID) freeStringList.removeElement(sl_id);
- }
- } else freeStringList.clear();
- } else if (removeString.getStringID()0)) {
- TuioString closestString = freeStringList.firstElement();
- Enumeration testList = freeStringList.elements();
- while (testList.hasMoreElements()) {
- TuioString testString = testList.nextElement();
- //if (testString.getDistance(tstr) buffer = aliveStringList;
- aliveStringList = newStringList;
- // recycling the vector
- newStringList = buffer;
- }
-
- frameStrings.clear();
- }
- }
-
-
- }
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+package TUIO;
+
+import com.illposed.osc.*;
+import java.util.*;
+
+/**
+ * The TuioClient class is the central TUIO protocol decoder component. It provides a simple callback infrastructure using the {@link TuioListener} interface.
+ * In order to receive and decode TUIO messages an instance of TuioClient needs to be created. The TuioClient instance then generates TUIO events
+ * which are broadcasted to all registered classes that implement the {@link TuioListener} interface.
+ *
+ * TuioClient client = new TuioClient();
+ * client.addTuioListener(myTuioListener);
+ * client.connect();
+ *
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public class TuioClient implements OSCListener {
+
+ public String comm;
+
+ private int port = 3333;
+ private OSCPortIn oscPort;
+ private boolean connected = false;
+ private Hashtable objectList = new Hashtable();
+ private Vector aliveObjectList = new Vector();
+ private Vector newObjectList = new Vector();
+ private Hashtable cursorList = new Hashtable();
+ private Vector aliveCursorList = new Vector();
+ private Vector newCursorList = new Vector();
+ private Hashtable stringList = new Hashtable();
+ private Vector aliveStringList = new Vector();
+ private Vector newStringList = new Vector();
+
+ private Vector frameObjects = new Vector();
+ private Vector frameCursors = new Vector();
+ private Vector frameStrings = new Vector();
+
+ private Vector freeCursorList = new Vector();
+ private int maxCursorID = -1;
+
+ private Vector freeStringList = new Vector();
+ private int maxStringID = -1;
+
+ private long currentFrame = 0;
+ private TuioTime currentTime;
+
+ private Vector listenerList = new Vector();
+
+ /**
+ * The default constructor creates a client that listens to the default TUIO port 3333
+ */
+ public TuioClient() {}
+
+ /**
+ * This constructor creates a client that listens to the provided port
+ *
+ * @param port the listening port number
+ */
+ public TuioClient(int port) {
+ this.port = port;
+ }
+
+ /**
+ * The TuioClient starts listening to TUIO messages on the configured UDP port
+ * All reveived TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners
+ */
+ public void connect() {
+
+ TuioTime.initSession();
+ currentTime = new TuioTime();
+ currentTime.reset();
+
+ try {
+ oscPort = new OSCPortIn(port);
+ oscPort.addListener("/tuio/2Dobj",this);
+ oscPort.addListener("/tuio/3Dcur",this);
+ oscPort.addListener("/tuio/_siP",this);
+ oscPort.startListening();
+ connected = true;
+ } catch (Exception e) {
+ System.out.println("TuioClient: failed to connect to port "+port);
+ connected = false;
+ }
+ }
+
+ /**
+ * The TuioClient stops listening to TUIO messages on the configured UDP port
+ */
+ public void disconnect() {
+ oscPort.stopListening();
+ try { Thread.sleep(100); }
+ catch (Exception e) {};
+ oscPort.close();
+ connected = false;
+ }
+
+ /**
+ * Returns true if this TuioClient is currently connected.
+ * @return true if this TuioClient is currently connected
+ */
+ public boolean isConnected() { return connected; }
+
+ /**
+ * Adds the provided TuioListener to the list of registered TUIO event listeners
+ *
+ * @param listener the TuioListener to add
+ */
+ public void addTuioListener(TuioListener listener) {
+ listenerList.addElement(listener);
+ }
+
+ /**
+ * Removes the provided TuioListener from the list of registered TUIO event listeners
+ *
+ * @param listener the TuioListener to remove
+ */
+ public void removeTuioListener(TuioListener listener) {
+ listenerList.removeElement(listener);
+ }
+
+ /**
+ * Removes all TuioListener from the list of registered TUIO event listeners
+ */
+ public void removeAllTuioListeners() {
+ listenerList.clear();
+ }
+
+ /**
+ * Returns a Vector of all currently active TuioObjects
+ *
+ * @return a Vector of all currently active TuioObjects
+ */
+ public Vector getTuioObjects() {
+ return new Vector(objectList.values());
+ }
+
+ /**
+ * Returns a Vector of all currently active TuioCursors
+ *
+ * @return a Vector of all currently active TuioCursors
+ */
+ public Vector getTuioCursors() {
+ return new Vector(cursorList.values());
+ }
+
+ /**
+ * Returns a Vector of all currently active TuioStrings
+ *
+ * @return a Vector of all currently active TuioStrings
+ */
+ public Vector getTuioStrings() {
+ return new Vector(stringList.values());
+ }
+
+ /**
+ * Returns the TuioObject corresponding to the provided Session ID
+ * or NULL if the Session ID does not refer to an active TuioObject
+ *
+ * @return an active TuioObject corresponding to the provided Session ID or NULL
+ */
+ public TuioObject getTuioObject(long s_id) {
+ return objectList.get(s_id);
+ }
+
+ /**
+ * Returns the TuioCursor corresponding to the provided Session ID
+ * or NULL if the Session ID does not refer to an active TuioCursor
+ *
+ * @return an active TuioCursor corresponding to the provided Session ID or NULL
+ */
+ public TuioCursor getTuioCursor(long s_id) {
+ return cursorList.get(s_id);
+ }
+
+ /**
+ * Returns the TuioString corresponding to the provided Session ID
+ * or NULL if the Session ID does not refer to an active TuioString
+ *
+ * @return an active TuioString corresponding to the provided Session ID or NULL
+ */
+ public TuioString getTuioString(long s_id) {
+ return stringList.get(s_id);
+ }
+
+ /**
+ * The OSC callback method where all TUIO messages are received and decoded
+ * and where the TUIO event callbacks are dispatched
+ *
+ * @param date the time stamp of the OSC bundle
+ * @param message the received OSC message
+ */
+ public void acceptMessage(Date date, OSCMessage message) {
+
+ Object[] args = message.getArguments();
+ String command = (String)args[0];
+ String address = message.getAddress();
+
+ if (address.equals("/tuio/2Dobj")) {
+
+ if (command.equals("set")) {
+
+ long s_id = ((Integer)args[1]).longValue();
+ int c_id = ((Integer)args[2]).intValue();
+ float xpos = ((Float)args[3]).floatValue();
+ float ypos = ((Float)args[4]).floatValue();
+ float angle = ((Float)args[5]).floatValue();
+ float xspeed = ((Float)args[6]).floatValue();
+ float yspeed = ((Float)args[7]).floatValue();
+ float rspeed = ((Float)args[8]).floatValue();
+ float maccel = ((Float)args[9]).floatValue();
+ float raccel = ((Float)args[10]).floatValue();
+
+ if (objectList.get(s_id) == null) {
+
+ TuioObject addObject = new TuioObject(s_id,c_id,xpos,ypos,angle);
+ frameObjects.addElement(addObject);
+
+ } else {
+
+ TuioObject tobj = objectList.get(s_id);
+ if (tobj==null) return;
+ if ((tobj.xpos!=xpos) || (tobj.ypos!=ypos) || (tobj.angle!=angle) || (tobj.x_speed!=xspeed) || (tobj.y_speed!=yspeed) || (tobj.rotation_speed!=rspeed) || (tobj.motion_accel!=maccel) || (tobj.rotation_accel!=raccel)) {
+
+ TuioObject updateObject = new TuioObject(s_id,c_id,xpos,ypos,angle);
+ updateObject.update(xpos,ypos,angle,xspeed,yspeed,rspeed,maccel,raccel);
+ frameObjects.addElement(updateObject);
+ }
+
+ }
+
+ } else if (command.equals("alive")) {
+
+ newObjectList.clear();
+ for (int i=1;i0) {
+ if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
+ if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame=fseq;
+ else lateFrame = true;
+ } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
+ currentTime = TuioTime.getSessionTime();
+ }
+
+ if (!lateFrame) {
+ Enumeration frameEnum = frameObjects.elements();
+ while(frameEnum.hasMoreElements()) {
+ TuioObject tobj = frameEnum.nextElement();
+
+ switch (tobj.getTuioState()) {
+ case TuioObject.TUIO_REMOVED:
+ TuioObject removeObject = tobj;
+ removeObject.remove(currentTime);
+ for (int i=0;i buffer = aliveObjectList;
+ aliveObjectList = newObjectList;
+ // recycling the vector
+ newObjectList = buffer;
+ }
+ frameObjects.clear();
+ }
+ } else if (address.equals("/tuio/3Dcur")) {
+
+ if (command.equals("set")) {
+
+ long s_id = ((Integer)args[1]).longValue();
+ float xpos = ((Float)args[2]).floatValue();
+ float ypos = ((Float)args[3]).floatValue();
+ float zpos = ((Float)args[4]).floatValue();
+ float xspeed = ((Float)args[5]).floatValue();
+ float yspeed = ((Float)args[6]).floatValue();
+ float maccel = ((Float)args[7]).floatValue();
+
+ if (cursorList.get(s_id) == null) {
+
+ TuioCursor addCursor = new TuioCursor(s_id, -1 ,xpos,ypos,zpos);
+ frameCursors.addElement(addCursor);
+
+ } else {
+
+ TuioCursor tcur = cursorList.get(s_id);
+ if (tcur==null) return;
+ if ((tcur.xpos!=xpos) || (tcur.ypos!=ypos) || (tcur.zpos!=zpos) || (tcur.x_speed!=xspeed) || (tcur.y_speed!=yspeed) || (tcur.motion_accel!=maccel)) {
+
+ TuioCursor updateCursor = new TuioCursor(s_id,tcur.getCursorID(),xpos,ypos,zpos);
+ updateCursor.update(xpos,ypos,zpos,xspeed,yspeed,maccel);
+ frameCursors.addElement(updateCursor);
+ }
+ }
+
+ //System.out.println("set cur " + s_id+" "+xpos+" "+ypos+" "+xspeed+" "+yspeed+" "+maccel);
+
+ } else if (command.equals("alive")) {
+
+ newCursorList.clear();
+ for (int i=1;i0) {
+ if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
+ if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame = fseq;
+ else lateFrame = true;
+ } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
+ currentTime = TuioTime.getSessionTime();
+ }
+ if (!lateFrame) {
+
+ Enumeration frameEnum = frameCursors.elements();
+ while(frameEnum.hasMoreElements()) {
+ TuioCursor tcur = frameEnum.nextElement();
+
+ switch (tcur.getTuioState()) {
+ case TuioCursor.TUIO_REMOVED:
+
+ TuioCursor removeCursor = tcur;
+ removeCursor.remove(currentTime);
+
+ for (int i=0;i0) {
+ Enumeration clist = cursorList.elements();
+ while (clist.hasMoreElements()) {
+ int c_id = clist.nextElement().getCursorID();
+ if (c_id>maxCursorID) maxCursorID=c_id;
+ }
+
+ Enumeration flist = freeCursorList.elements();
+ while (flist.hasMoreElements()) {
+ int c_id = flist.nextElement().getCursorID();
+ if (c_id>=maxCursorID) freeCursorList.removeElement(c_id);
+ }
+ } else freeCursorList.clear();
+ } else if (removeCursor.getCursorID()0)) {
+ TuioCursor closestCursor = freeCursorList.firstElement();
+ Enumeration testList = freeCursorList.elements();
+ while (testList.hasMoreElements()) {
+ TuioCursor testCursor = testList.nextElement();
+ if (testCursor.getDistance(tcur) buffer = aliveCursorList;
+ aliveCursorList = newCursorList;
+ // recycling the vector
+ newCursorList = buffer;
+ }
+
+ frameCursors.clear();
+ }
+ } else if (address.equals("/tuio/_siP")) {
+
+ if (command.equals("set")) {
+
+ long s_id = ((Integer)args[1]).longValue();
+ String msg = args[2].toString();
+
+ if (stringList.get(s_id) == null) {
+
+ TuioString addString = new TuioString(s_id, -1, msg);
+ frameStrings.addElement(addString);
+
+ } else {
+
+ TuioString tstr = stringList.get(s_id);
+ if (tstr==null) return;
+ if (!tstr.getMessage().equals(msg)) {
+
+ TuioString updateString = new TuioString(s_id,tstr.getStringID(),msg);
+ updateString.update(msg);
+ frameStrings.addElement(updateString);
+ }
+ }
+
+ //System.out.println("set cur " + s_id+" "+xpos+" "+ypos+" "+xspeed+" "+yspeed+" "+maccel);
+
+ } else if (command.equals("alive")) {
+
+ newStringList.clear();
+ for (int i=1;i0) {
+ if (fseq>currentFrame) currentTime = TuioTime.getSessionTime();
+ if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame = fseq;
+ else lateFrame = true;
+ } else if (TuioTime.getSessionTime().subtract(currentTime).getTotalMilliseconds()>100) {
+ currentTime = TuioTime.getSessionTime();
+ }
+ if (!lateFrame) {
+
+ Enumeration frameEnum = frameStrings.elements();
+ while(frameEnum.hasMoreElements()) {
+ TuioString tstr = frameEnum.nextElement();
+
+ switch (tstr.getTuioState()) {
+ case TuioString.TUIO_REMOVED:
+
+ TuioString removeString = tstr;
+ removeString.remove(currentTime);
+
+ for (int i=0;i0) {
+ Enumeration slist = stringList.elements();
+ while (slist.hasMoreElements()) {
+ int sl_id = slist.nextElement().getStringID();
+ if (sl_id>maxStringID) maxStringID=sl_id;
+ }
+
+ Enumeration flist = freeStringList.elements();
+ while (flist.hasMoreElements()) {
+ int sl_id = flist.nextElement().getStringID();
+ if (sl_id>=maxStringID) freeStringList.removeElement(sl_id);
+ }
+ } else freeStringList.clear();
+ } else if (removeString.getStringID()0)) {
+ TuioString closestString = freeStringList.firstElement();
+ Enumeration testList = freeStringList.elements();
+ while (testList.hasMoreElements()) {
+ TuioString testString = testList.nextElement();
+ //if (testString.getDistance(tstr) buffer = aliveStringList;
+ aliveStringList = newStringList;
+ // recycling the vector
+ newStringList = buffer;
+ }
+
+ frameStrings.clear();
+ }
+ }
+
+
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioContainer.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioContainer.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioContainer.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,463 +1,463 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package TUIO;
-
-import java.util.*;
-
-/**
- * The abstract TuioContainer class defines common attributes that apply to both subclasses {@link TuioObject} and {@link TuioCursor}.
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-abstract class TuioContainer extends TuioPoint {
-
- /**
- * The unique session ID number that is assigned to each TUIO object or cursor.
- */
- protected long session_id;
- /**
- * The X-axis velocity value.
- */
- protected float x_speed;
- /**
- * The Y-axis velocity value.
- */
- protected float y_speed;
- /**
- * The motion speed value.
- */
- protected float motion_speed;
- /**
- * The motion acceleration value.
- */
- protected float motion_accel;
- /**
- * A Vector of TuioPoints containing all the previous positions of the TUIO component.
- */
- protected Vector path;
- /**
- * Defines the ADDED state.
- */
- public static final int TUIO_ADDED = 0;
- /**
- * Defines the ACCELERATING state.
- */
- public static final int TUIO_ACCELERATING = 1;
- /**
- * Defines the DECELERATING state.
- */
- public static final int TUIO_DECELERATING = 2;
- /**
- * Defines the STOPPED state.
- */
- public static final int TUIO_STOPPED = 3;
- /**
- * Defines the REMOVED state.
- */
- public static final int TUIO_REMOVED = 4;
- /**
- * Reflects the current state of the TuioComponent
- */
- protected int state;
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, X and Y coordinate to the newly created TuioContainer.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- TuioContainer(TuioTime ttime, long si, float xp, float yp) {
- super(ttime,xp,yp);
-
- session_id = si;
- x_speed = 0.0f;
- y_speed = 0.0f;
- motion_speed = 0.0f;
- motion_accel = 0.0f;
-
- path = new Vector();
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
- state = TUIO_ADDED;
- }
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, X, Y and Z coordinate to the newly created TuioContainer.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- TuioContainer(TuioTime ttime, long si, float xp, float yp, float zp) {
- super(ttime,xp,yp, zp);
-
- session_id = si;
- x_speed = 0.0f;
- y_speed = 0.0f;
- motion_speed = 0.0f;
- motion_accel = 0.0f;
-
- path = new Vector();
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- state = TUIO_ADDED;
- }
-
- /**
- * This constructor takes the provided Session ID, X and Y coordinate
- * and assigs these values to the newly created TuioContainer.
- *
- * @param si the Session ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- TuioContainer(long si, float xp, float yp) {
- super(xp,yp);
-
- session_id = si;
- x_speed = 0.0f;
- y_speed = 0.0f;
- motion_speed = 0.0f;
- motion_accel = 0.0f;
-
- path = new Vector();
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
- state = TUIO_ADDED;
- }
-
- /**
- * This constructor takes the provided Session ID, X, Y and Z coordinate
- * and assigs these values to the newly created TuioContainer.
- *
- * @param si the Session ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- TuioContainer(long si, float xp, float yp, float zp) {
- super(xp,yp,zp);
-
- session_id = si;
- x_speed = 0.0f;
- y_speed = 0.0f;
- motion_speed = 0.0f;
- motion_accel = 0.0f;
-
- path = new Vector();
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- state = TUIO_ADDED;
- }
-
- /**
- * This constructor takes the atttibutes of the provided TuioContainer
- * and assigs these values to the newly created TuioContainer.
- *
- * @param tcon the TuioContainer to assign
- */
- TuioContainer(TuioContainer tcon) {
- super(tcon);
-
- session_id = tcon.getSessionID();
- x_speed = 0.0f;
- y_speed = 0.0f;
- motion_speed = 0.0f;
- motion_accel = 0.0f;
-
- path = new Vector();
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- state = TUIO_ADDED;
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X and Y coordinate to the private TuioContainer attributes.
- * The speed and accleration values are calculated accordingly.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public void update(TuioTime ttime, float xp, float yp) {
- TuioPoint lastPoint = path.lastElement();
- super.update(ttime,xp,yp);
-
- TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
- float dt = diffTime.getTotalMilliseconds()/1000.0f;
- float dx = this.xpos - lastPoint.getX();
- float dy = this.ypos - lastPoint.getY();
- float dist = (float)Math.sqrt(dx*dx+dy*dy);
- float last_motion_speed = this.motion_speed;
-
- this.x_speed = dx/dt;
- this.y_speed = dy/dt;
- this.motion_speed = dist/dt;
- this.motion_accel = (motion_speed - last_motion_speed)/dt;
-
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X, Y and Z coordinate to the private TuioContainer attributes.
- * The speed and accleration values are calculated accordingly.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public void update(TuioTime ttime, float xp, float yp, float zp) {
- TuioPoint lastPoint = path.lastElement();
- super.update(ttime,xp,yp,zp);
-
- TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
- float dt = diffTime.getTotalMilliseconds()/1000.0f;
- float dx = this.xpos - lastPoint.getX();
- float dy = this.ypos - lastPoint.getY();
- float dz = this.zpos - lastPoint.getZ();
- float dist = (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
- float last_motion_speed = this.motion_speed;
-
- this.x_speed = dx/dt;
- this.y_speed = dy/dt;
- this.motion_speed = dist/dt;
- this.motion_accel = (motion_speed - last_motion_speed)/dt;
-
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * This method is used to calculate the speed and acceleration values of
- * TuioContainers with unchanged positions.
- */
- public void stop(TuioTime ttime) {
- update(ttime,xpos,ypos,zpos);
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X and Y coordinate, X and Y velocity and acceleration
- * to the private TuioContainer attributes.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param ma the acceleration to assign
- */
- public void update(TuioTime ttime, float xp, float yp , float xs, float ys, float ma) {
- super.update(ttime,xp,yp);
- x_speed = xs;
- y_speed = ys;
- motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
- motion_accel = ma;
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X, Y and Z coordinate, X and Y velocity and acceleration
- * to the private TuioContainer attributes.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param ma the acceleration to assign
- */
- public void update(TuioTime ttime, float xp, float yp, float zp , float xs, float ys, float ma) {
- super.update(ttime,xp,yp,zp);
- x_speed = xs;
- y_speed = ys;
- motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
- motion_accel = ma;
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Assigns the provided X and Y coordinate, X and Y velocity and acceleration
- * to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param ma the acceleration to assign
- */
- public void update(float xp, float yp,float xs,float ys,float ma) {
- super.update(xp,yp);
- x_speed = xs;
- y_speed = ys;
- motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
- motion_accel = ma;
- path.addElement(new TuioPoint(currentTime,xpos,ypos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Assigns the provided X, Y and Z coordinate, X and Y velocity and acceleration
- * to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param ma the acceleration to assign
- */
- public void update(float xp, float yp, float zp,float xs,float ys,float ma) {
- super.update(xp,yp,zp);
- x_speed = xs;
- y_speed = ys;
- motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
- motion_accel = ma;
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Takes the atttibutes of the provided TuioContainer
- * and assigs these values to this TuioContainer.
- * The TuioTime time stamp of this TuioContainer remains unchanged.
- *
- * @param tcon the TuioContainer to assign
- */
- public void update (TuioContainer tcon) {
- super.update(tcon);
- x_speed = tcon.getXSpeed();
- y_speed = tcon.getYSpeed();
- motion_speed = tcon.getMotionSpeed();
- motion_accel = tcon.getMotionAccel();
- path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
- if (motion_accel>0) state = TUIO_ACCELERATING;
- else if (motion_accel<0) state = TUIO_DECELERATING;
- else state = TUIO_STOPPED;
- }
-
- /**
- * Assigns the REMOVE state to this TuioContainer and sets
- * its TuioTime time stamp to the provided TuioTime argument.
- *
- * @param ttime the TuioTime to assign
- */
- public void remove(TuioTime ttime) {
- currentTime = new TuioTime(ttime);
- state = TUIO_REMOVED;
- }
-
- /**
- * Returns the Session ID of this TuioContainer.
- * @return the Session ID of this TuioContainer
- */
- public long getSessionID() {
- return session_id;
- }
-
- /**
- * Returns the X velocity of this TuioContainer.
- * @return the X velocity of this TuioContainer
- */
- public float getXSpeed() {
- return x_speed;
- }
-
- /**
- * Returns the Y velocity of this TuioContainer.
- * @return the Y velocity of this TuioContainer
- */
- public float getYSpeed() {
- return y_speed;
- }
-
- /**
- * Returns the position of this TuioContainer.
- * @return the position of this TuioContainer
- */
- public TuioPoint getPosition() {
- return new TuioPoint(xpos,ypos,zpos);
- }
-
- /**
- * Returns the path of this TuioContainer.
- * @return the path of this TuioContainer
- */
- public Vector getPath() {
- return path;
- }
-
- /**
- * Returns the motion speed of this TuioContainer.
- * @return the motion speed of this TuioContainer
- */
- public float getMotionSpeed() {
- return motion_speed;
- }
-
- /**
- * Returns the motion acceleration of this TuioContainer.
- * @return the motion acceleration of this TuioContainer
- */
- public float getMotionAccel() {
- return motion_accel;
- }
-
- /**
- * Returns the TUIO state of this TuioContainer.
- * @return the TUIO state of this TuioContainer
- */
- public int getTuioState() {
- return state;
- }
-
- /**
- * Returns true of this TuioContainer is moving.
- * @return true of this TuioContainer is moving
- */
- public boolean isMoving() {
- if ((state==TUIO_ACCELERATING) || (state==TUIO_DECELERATING)) return true;
- else return false;
- }
-
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package TUIO;
+
+import java.util.*;
+
+/**
+ * The abstract TuioContainer class defines common attributes that apply to both subclasses {@link TuioObject} and {@link TuioCursor}.
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+abstract class TuioContainer extends TuioPoint {
+
+ /**
+ * The unique session ID number that is assigned to each TUIO object or cursor.
+ */
+ protected long session_id;
+ /**
+ * The X-axis velocity value.
+ */
+ protected float x_speed;
+ /**
+ * The Y-axis velocity value.
+ */
+ protected float y_speed;
+ /**
+ * The motion speed value.
+ */
+ protected float motion_speed;
+ /**
+ * The motion acceleration value.
+ */
+ protected float motion_accel;
+ /**
+ * A Vector of TuioPoints containing all the previous positions of the TUIO component.
+ */
+ protected Vector path;
+ /**
+ * Defines the ADDED state.
+ */
+ public static final int TUIO_ADDED = 0;
+ /**
+ * Defines the ACCELERATING state.
+ */
+ public static final int TUIO_ACCELERATING = 1;
+ /**
+ * Defines the DECELERATING state.
+ */
+ public static final int TUIO_DECELERATING = 2;
+ /**
+ * Defines the STOPPED state.
+ */
+ public static final int TUIO_STOPPED = 3;
+ /**
+ * Defines the REMOVED state.
+ */
+ public static final int TUIO_REMOVED = 4;
+ /**
+ * Reflects the current state of the TuioComponent
+ */
+ protected int state;
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, X and Y coordinate to the newly created TuioContainer.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ TuioContainer(TuioTime ttime, long si, float xp, float yp) {
+ super(ttime,xp,yp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ state = TUIO_ADDED;
+ }
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, X, Y and Z coordinate to the newly created TuioContainer.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ TuioContainer(TuioTime ttime, long si, float xp, float yp, float zp) {
+ super(ttime,xp,yp, zp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ state = TUIO_ADDED;
+ }
+
+ /**
+ * This constructor takes the provided Session ID, X and Y coordinate
+ * and assigs these values to the newly created TuioContainer.
+ *
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ TuioContainer(long si, float xp, float yp) {
+ super(xp,yp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ state = TUIO_ADDED;
+ }
+
+ /**
+ * This constructor takes the provided Session ID, X, Y and Z coordinate
+ * and assigs these values to the newly created TuioContainer.
+ *
+ * @param si the Session ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ TuioContainer(long si, float xp, float yp, float zp) {
+ super(xp,yp,zp);
+
+ session_id = si;
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ state = TUIO_ADDED;
+ }
+
+ /**
+ * This constructor takes the atttibutes of the provided TuioContainer
+ * and assigs these values to the newly created TuioContainer.
+ *
+ * @param tcon the TuioContainer to assign
+ */
+ TuioContainer(TuioContainer tcon) {
+ super(tcon);
+
+ session_id = tcon.getSessionID();
+ x_speed = 0.0f;
+ y_speed = 0.0f;
+ motion_speed = 0.0f;
+ motion_accel = 0.0f;
+
+ path = new Vector();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ state = TUIO_ADDED;
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X and Y coordinate to the private TuioContainer attributes.
+ * The speed and accleration values are calculated accordingly.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp) {
+ TuioPoint lastPoint = path.lastElement();
+ super.update(ttime,xp,yp);
+
+ TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
+ float dt = diffTime.getTotalMilliseconds()/1000.0f;
+ float dx = this.xpos - lastPoint.getX();
+ float dy = this.ypos - lastPoint.getY();
+ float dist = (float)Math.sqrt(dx*dx+dy*dy);
+ float last_motion_speed = this.motion_speed;
+
+ this.x_speed = dx/dt;
+ this.y_speed = dy/dt;
+ this.motion_speed = dist/dt;
+ this.motion_accel = (motion_speed - last_motion_speed)/dt;
+
+ path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X, Y and Z coordinate to the private TuioContainer attributes.
+ * The speed and accleration values are calculated accordingly.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp, float zp) {
+ TuioPoint lastPoint = path.lastElement();
+ super.update(ttime,xp,yp,zp);
+
+ TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
+ float dt = diffTime.getTotalMilliseconds()/1000.0f;
+ float dx = this.xpos - lastPoint.getX();
+ float dy = this.ypos - lastPoint.getY();
+ float dz = this.zpos - lastPoint.getZ();
+ float dist = (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
+ float last_motion_speed = this.motion_speed;
+
+ this.x_speed = dx/dt;
+ this.y_speed = dy/dt;
+ this.motion_speed = dist/dt;
+ this.motion_accel = (motion_speed - last_motion_speed)/dt;
+
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * This method is used to calculate the speed and acceleration values of
+ * TuioContainers with unchanged positions.
+ */
+ public void stop(TuioTime ttime) {
+ update(ttime,xpos,ypos,zpos);
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X and Y coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp , float xs, float ys, float ma) {
+ super.update(ttime,xp,yp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X, Y and Z coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp, float zp , float xs, float ys, float ma) {
+ super.update(ttime,xp,yp,zp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Assigns the provided X and Y coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(float xp, float yp,float xs,float ys,float ma) {
+ super.update(xp,yp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Assigns the provided X, Y and Z coordinate, X and Y velocity and acceleration
+ * to the private TuioContainer attributes. The TuioTime time stamp remains unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param ma the acceleration to assign
+ */
+ public void update(float xp, float yp, float zp,float xs,float ys,float ma) {
+ super.update(xp,yp,zp);
+ x_speed = xs;
+ y_speed = ys;
+ motion_speed = (float)Math.sqrt(x_speed*x_speed+y_speed*y_speed);
+ motion_accel = ma;
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Takes the atttibutes of the provided TuioContainer
+ * and assigs these values to this TuioContainer.
+ * The TuioTime time stamp of this TuioContainer remains unchanged.
+ *
+ * @param tcon the TuioContainer to assign
+ */
+ public void update (TuioContainer tcon) {
+ super.update(tcon);
+ x_speed = tcon.getXSpeed();
+ y_speed = tcon.getYSpeed();
+ motion_speed = tcon.getMotionSpeed();
+ motion_accel = tcon.getMotionAccel();
+ path.addElement(new TuioPoint(currentTime,xpos,ypos,zpos));
+ if (motion_accel>0) state = TUIO_ACCELERATING;
+ else if (motion_accel<0) state = TUIO_DECELERATING;
+ else state = TUIO_STOPPED;
+ }
+
+ /**
+ * Assigns the REMOVE state to this TuioContainer and sets
+ * its TuioTime time stamp to the provided TuioTime argument.
+ *
+ * @param ttime the TuioTime to assign
+ */
+ public void remove(TuioTime ttime) {
+ currentTime = new TuioTime(ttime);
+ state = TUIO_REMOVED;
+ }
+
+ /**
+ * Returns the Session ID of this TuioContainer.
+ * @return the Session ID of this TuioContainer
+ */
+ public long getSessionID() {
+ return session_id;
+ }
+
+ /**
+ * Returns the X velocity of this TuioContainer.
+ * @return the X velocity of this TuioContainer
+ */
+ public float getXSpeed() {
+ return x_speed;
+ }
+
+ /**
+ * Returns the Y velocity of this TuioContainer.
+ * @return the Y velocity of this TuioContainer
+ */
+ public float getYSpeed() {
+ return y_speed;
+ }
+
+ /**
+ * Returns the position of this TuioContainer.
+ * @return the position of this TuioContainer
+ */
+ public TuioPoint getPosition() {
+ return new TuioPoint(xpos,ypos,zpos);
+ }
+
+ /**
+ * Returns the path of this TuioContainer.
+ * @return the path of this TuioContainer
+ */
+ public Vector getPath() {
+ return path;
+ }
+
+ /**
+ * Returns the motion speed of this TuioContainer.
+ * @return the motion speed of this TuioContainer
+ */
+ public float getMotionSpeed() {
+ return motion_speed;
+ }
+
+ /**
+ * Returns the motion acceleration of this TuioContainer.
+ * @return the motion acceleration of this TuioContainer
+ */
+ public float getMotionAccel() {
+ return motion_accel;
+ }
+
+ /**
+ * Returns the TUIO state of this TuioContainer.
+ * @return the TUIO state of this TuioContainer
+ */
+ public int getTuioState() {
+ return state;
+ }
+
+ /**
+ * Returns true of this TuioContainer is moving.
+ * @return true of this TuioContainer is moving
+ */
+ public boolean isMoving() {
+ if ((state==TUIO_ACCELERATING) || (state==TUIO_DECELERATING)) return true;
+ else return false;
+ }
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioCursor.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioCursor.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioCursor.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,115 +1,115 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-package TUIO;
-
-/**
- * The TuioCursor class encapsulates /tuio/2Dcur TUIO cursors.
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public class TuioCursor extends TuioContainer {
-
- /**
- * The individual cursor ID number that is assigned to each TuioCursor.
- */
- protected int cursor_id;
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, Cursor ID, X and Y coordinate to the newly created TuioCursor.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param ci the Cursor ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp) {
- super(ttime, si,xp,yp);
- this.cursor_id = ci;
- }
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, Cursor ID, X, Y and Z coordinate to the newly created TuioCursor.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param ci the Cursor ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp, float zp) {
- super(ttime, si,xp,yp,zp);
- this.cursor_id = ci;
- }
-
- /**
- * This constructor takes the provided Session ID, Cursor ID, X and Y coordinate
- * and assigs these values to the newly created TuioCursor.
- *
- * @param si the Session ID to assign
- * @param ci the Cursor ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public TuioCursor (long si, int ci, float xp, float yp) {
- super(si,xp,yp);
- this.cursor_id = ci;
- }
-
- /**
- * This constructor takes the provided Session ID, Cursor ID, X, Y and Z coordinate
- * and assigs these values to the newly created TuioCursor.
- *
- * @param si the Session ID to assign
- * @param ci the Cursor ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public TuioCursor (long si, int ci, float xp, float yp, float zp) {
- super(si,xp,yp,zp);
- this.cursor_id = ci;
- }
-
- /**
- * This constructor takes the atttibutes of the provided TuioCursor
- * and assigs these values to the newly created TuioCursor.
- *
- * @param tcur the TuioCursor to assign
- */
- public TuioCursor (TuioCursor tcur) {
- super(tcur);
- this.cursor_id = tcur.getCursorID();
- }
-
- /**
- * Returns the Cursor ID of this TuioCursor.
- * @return the Cursor ID of this TuioCursor
- */
- public int getCursorID() {
- return cursor_id;
- }
-
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+package TUIO;
+
+/**
+ * The TuioCursor class encapsulates /tuio/2Dcur TUIO cursors.
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public class TuioCursor extends TuioContainer {
+
+ /**
+ * The individual cursor ID number that is assigned to each TuioCursor.
+ */
+ protected int cursor_id;
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, Cursor ID, X and Y coordinate to the newly created TuioCursor.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param ci the Cursor ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp) {
+ super(ttime, si,xp,yp);
+ this.cursor_id = ci;
+ }
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, Cursor ID, X, Y and Z coordinate to the newly created TuioCursor.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param ci the Cursor ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public TuioCursor (TuioTime ttime, long si, int ci, float xp, float yp, float zp) {
+ super(ttime, si,xp,yp,zp);
+ this.cursor_id = ci;
+ }
+
+ /**
+ * This constructor takes the provided Session ID, Cursor ID, X and Y coordinate
+ * and assigs these values to the newly created TuioCursor.
+ *
+ * @param si the Session ID to assign
+ * @param ci the Cursor ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public TuioCursor (long si, int ci, float xp, float yp) {
+ super(si,xp,yp);
+ this.cursor_id = ci;
+ }
+
+ /**
+ * This constructor takes the provided Session ID, Cursor ID, X, Y and Z coordinate
+ * and assigs these values to the newly created TuioCursor.
+ *
+ * @param si the Session ID to assign
+ * @param ci the Cursor ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public TuioCursor (long si, int ci, float xp, float yp, float zp) {
+ super(si,xp,yp,zp);
+ this.cursor_id = ci;
+ }
+
+ /**
+ * This constructor takes the atttibutes of the provided TuioCursor
+ * and assigs these values to the newly created TuioCursor.
+ *
+ * @param tcur the TuioCursor to assign
+ */
+ public TuioCursor (TuioCursor tcur) {
+ super(tcur);
+ this.cursor_id = tcur.getCursorID();
+ }
+
+ /**
+ * Returns the Cursor ID of this TuioCursor.
+ * @return the Cursor ID of this TuioCursor
+ */
+ public int getCursorID() {
+ return cursor_id;
+ }
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioListener.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioListener.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioListener.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,111 +1,111 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package TUIO;
-
-/**
- * The TuioListener interface provides a simple callback infrastructure which is used by the {@link TuioClient} class
- * to dispatch TUIO events to all registered instances of classes that implement the TuioListener interface defined here.
- * Any class that implements the TuioListener interface is required to implement all of the callback methods defined here.
- * The {@link TuioClient} makes use of these interface methods in order to dispatch TUIO events to all registered TuioListener implementations.
- *
- * public class MyTuioListener implements TuioListener
- * ...
- * MyTuioListener listener = new MyTuioListener();
- * TuioClient client = new TuioClient();
- * client.addTuioListener(listener);
- * client.start();
- *
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public interface TuioListener {
-
- /**
- * This callback method is invoked by the TuioClient when a new TuioObject is added to the session.
- *
- * @param tobj the TuioObject reference associated to the addTuioObject event
- */
- public void addTuioObject(TuioObject tobj);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioObject is updated during the session.
- *
- * @param tobj the TuioObject reference associated to the updateTuioObject event
- */
- public void updateTuioObject(TuioObject tobj);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioObject is removed from the session.
- *
- * @param tobj the TuioObject reference associated to the removeTuioObject event
- */
- public void removeTuioObject(TuioObject tobj);
-
- /**
- * This callback method is invoked by the TuioClient when a new TuioCursor is added to the session.
- *
- * @param tcur the TuioCursor reference associated to the addTuioCursor event
- */
- public void addTuioCursor(TuioCursor tcur);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioCursor is updated during the session.
- *
- * @param tcur the TuioCursor reference associated to the updateTuioCursor event
- */
- public void updateTuioCursor(TuioCursor tcur);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioCursor is removed from the session.
- *
- * @param tcur the TuioCursor reference associated to the removeTuioCursor event
- */
- public void removeTuioCursor(TuioCursor tcur);
-
- /**
- * This callback method is invoked by the TuioClient when a new TuioString is added to the session.
- *
- * @param tstr the TuioString reference associated to the addTuioString event
- */
- public void addTuioString(TuioString tstr);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioString is updated during the session.
- *
- * @param tstr the TuioString reference associated to the updateTuioString event
- */
- public void updateTuioString(TuioString tstr);
-
- /**
- * This callback method is invoked by the TuioClient when an existing TuioString is removed from the session.
- *
- * @param tstr the TuioString reference associated to the removeTuioString event
- */
- public void removeTuioString(TuioString tstr);
-
- /**
- * This callback method is invoked by the TuioClient to mark the end of a received TUIO message bundle.
- *
- * @param ftime the TuioTime associated to the current TUIO message bundle
- */
- public void refresh(TuioTime ftime);
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package TUIO;
+
+/**
+ * The TuioListener interface provides a simple callback infrastructure which is used by the {@link TuioClient} class
+ * to dispatch TUIO events to all registered instances of classes that implement the TuioListener interface defined here.
+ * Any class that implements the TuioListener interface is required to implement all of the callback methods defined here.
+ * The {@link TuioClient} makes use of these interface methods in order to dispatch TUIO events to all registered TuioListener implementations.
+ *
+ * public class MyTuioListener implements TuioListener
+ * ...
+ * MyTuioListener listener = new MyTuioListener();
+ * TuioClient client = new TuioClient();
+ * client.addTuioListener(listener);
+ * client.start();
+ *
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public interface TuioListener {
+
+ /**
+ * This callback method is invoked by the TuioClient when a new TuioObject is added to the session.
+ *
+ * @param tobj the TuioObject reference associated to the addTuioObject event
+ */
+ public void addTuioObject(TuioObject tobj);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioObject is updated during the session.
+ *
+ * @param tobj the TuioObject reference associated to the updateTuioObject event
+ */
+ public void updateTuioObject(TuioObject tobj);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioObject is removed from the session.
+ *
+ * @param tobj the TuioObject reference associated to the removeTuioObject event
+ */
+ public void removeTuioObject(TuioObject tobj);
+
+ /**
+ * This callback method is invoked by the TuioClient when a new TuioCursor is added to the session.
+ *
+ * @param tcur the TuioCursor reference associated to the addTuioCursor event
+ */
+ public void addTuioCursor(TuioCursor tcur);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioCursor is updated during the session.
+ *
+ * @param tcur the TuioCursor reference associated to the updateTuioCursor event
+ */
+ public void updateTuioCursor(TuioCursor tcur);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioCursor is removed from the session.
+ *
+ * @param tcur the TuioCursor reference associated to the removeTuioCursor event
+ */
+ public void removeTuioCursor(TuioCursor tcur);
+
+ /**
+ * This callback method is invoked by the TuioClient when a new TuioString is added to the session.
+ *
+ * @param tstr the TuioString reference associated to the addTuioString event
+ */
+ public void addTuioString(TuioString tstr);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioString is updated during the session.
+ *
+ * @param tstr the TuioString reference associated to the updateTuioString event
+ */
+ public void updateTuioString(TuioString tstr);
+
+ /**
+ * This callback method is invoked by the TuioClient when an existing TuioString is removed from the session.
+ *
+ * @param tstr the TuioString reference associated to the removeTuioString event
+ */
+ public void removeTuioString(TuioString tstr);
+
+ /**
+ * This callback method is invoked by the TuioClient to mark the end of a received TUIO message bundle.
+ *
+ * @param ftime the TuioTime associated to the current TUIO message bundle
+ */
+ public void refresh(TuioTime ftime);
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioObject.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioObject.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioObject.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,251 +1,251 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-package TUIO;
-
-/**
- * The TuioObject class encapsulates /tuio/2Dobj TUIO objects.
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public class TuioObject extends TuioContainer {
-
- /**
- * The individual symbol ID number that is assigned to each TuioObject.
- */
- protected int symbol_id;
- /**
- * The rotation angle value.
- */
- protected float angle;
- /**
- * The rotation speed value.
- */
- protected float rotation_speed;
- /**
- * The rotation acceleration value.
- */
- protected float rotation_accel;
- /**
- * Defines the ROTATING state.
- */
- public static final int TUIO_ROTATING = 5;
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, Symbol ID, X and Y coordinate and angle to the newly created TuioObject.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param sym the Symbol ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param a the angle to assign
- */
- public TuioObject (TuioTime ttime, long si, int sym, float xp, float yp, float a) {
- super(ttime, si,xp,yp);
- symbol_id = sym;
- angle = a;
- rotation_speed = 0.0f;
- rotation_accel = 0.0f;
- }
-
- /**
- * This constructor takes the provided Session ID, Symbol ID, X and Y coordinate
- * and angle, and assigs these values to the newly created TuioObject.
- *
- * @param si the Session ID to assign
- * @param sym the Symbol ID to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param a the angle to assign
- */
- public TuioObject (long si, int sym, float xp, float yp, float a) {
- super(si,xp,yp);
- symbol_id = sym;
- angle = angle;
- rotation_speed = 0.0f;
- rotation_accel = 0.0f;
- }
-
- /**
- * This constructor takes the atttibutes of the provided TuioObject
- * and assigs these values to the newly created TuioObject.
- *
- * @param tobj the TuioObject to assign
- */
- public TuioObject (TuioObject tobj) {
- super(tobj);
- symbol_id = tobj.getSymbolID();
- angle = tobj.getAngle();
- rotation_speed = 0.0f;
- rotation_accel = 0.0f;
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X and Y coordinate, angle, X and Y velocity, motion acceleration,
- * rotation speed and rotation acceleration to the private TuioObject attributes.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param a the angle coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param rs the rotation velocity to assign
- * @param ma the motion acceleration to assign
- * @param ra the rotation acceleration to assign
- */
- public void update (TuioTime ttime, float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) {
- super.update(ttime,xp,yp,xs,ys,ma);
- angle = a;
- rotation_speed = rs;
- rotation_accel = ra;
- if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
- }
-
- /**
- * Assigns the provided X and Y coordinate, angle, X and Y velocity, motion acceleration
- * rotation velocity and rotation acceleration to the private TuioContainer attributes.
- * The TuioTime time stamp remains unchanged.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param a the angle coordinate to assign
- * @param xs the X velocity to assign
- * @param ys the Y velocity to assign
- * @param rs the rotation velocity to assign
- * @param ma the motion acceleration to assign
- * @param ra the rotation acceleration to assign
- */
- public void update (float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) {
- super.update(xp,yp,xs,ys,ma);
- angle = a;
- rotation_speed = rs;
- rotation_accel = ra;
- if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * X and Y coordinate and angle to the private TuioObject attributes.
- * The speed and accleration values are calculated accordingly.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param a the angle coordinate to assign
- */
- public void update (TuioTime ttime, float xp, float yp, float a) {
- TuioPoint lastPoint = path.lastElement();
- super.update(ttime,xp,yp);
-
- TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
- float dt = diffTime.getTotalMilliseconds()/1000.0f;
- float last_angle = angle;
- float last_rotation_speed = rotation_speed;
- angle = a;
-
- float da = (this.angle-last_angle)/(2.0f*(float)Math.PI);
- if (da>0.75f) da-=1.0f;
- else if (da<-0.75f) da+=1.0f;
-
- rotation_speed = da/dt;
- rotation_accel = (rotation_speed - last_rotation_speed)/dt;
- if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
- }
-
- /**
- * Takes the atttibutes of the provided TuioObject
- * and assigs these values to this TuioObject.
- * The TuioTime time stamp of this TuioContainer remains unchanged.
- *
- * @param tobj the TuioContainer to assign
- */
- public void update (TuioObject tobj) {
- super.update(tobj);
- angle = tobj.getAngle();
- rotation_speed = tobj.getRotationSpeed();
- rotation_accel = tobj.getRotationAccel();
- if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
- }
-
- /**
- * This method is used to calculate the speed and acceleration values of a
- * TuioObject with unchanged position and angle.
- *
- * @param ttime the TuioTime to assign
- */
- public void stop (TuioTime ttime) {
- update(ttime,xpos,ypos, angle);
- }
-
- /**
- * Returns the symbol ID of this TuioObject.
- * @return the symbol ID of this TuioObject
- */
- public int getSymbolID() {
- return symbol_id;
- }
-
- /**
- * Returns the rotation angle of this TuioObject.
- * @return the rotation angle of this TuioObject
- */
- public float getAngle() {
- return angle;
- }
-
- /**
- * Returns the rotation angle in degrees of this TuioObject.
- * @return the rotation angle in degrees of this TuioObject
- */
- public float getAngleDegrees() {
- return angle/(float)Math.PI*180.0f;
- }
-
- /**
- * Returns the rotation speed of this TuioObject.
- * @return the rotation speed of this TuioObject
- */
- public float getRotationSpeed() {
- return rotation_speed;
- }
-
- /**
- * Returns the rotation acceleration of this TuioObject.
- * @return the rotation acceleration of this TuioObject
- */
- public float getRotationAccel() {
- return rotation_accel;
- }
-
- /**
- * Returns true of this TuioObject is moving.
- * @return true of this TuioObject is moving
- */
- public boolean isMoving() {
- if ((state==TUIO_ACCELERATING) || (state==TUIO_DECELERATING) || (state==TUIO_ROTATING)) return true;
- else return false;
- }
-
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+package TUIO;
+
+/**
+ * The TuioObject class encapsulates /tuio/2Dobj TUIO objects.
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public class TuioObject extends TuioContainer {
+
+ /**
+ * The individual symbol ID number that is assigned to each TuioObject.
+ */
+ protected int symbol_id;
+ /**
+ * The rotation angle value.
+ */
+ protected float angle;
+ /**
+ * The rotation speed value.
+ */
+ protected float rotation_speed;
+ /**
+ * The rotation acceleration value.
+ */
+ protected float rotation_accel;
+ /**
+ * Defines the ROTATING state.
+ */
+ public static final int TUIO_ROTATING = 5;
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, Symbol ID, X and Y coordinate and angle to the newly created TuioObject.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param sym the Symbol ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param a the angle to assign
+ */
+ public TuioObject (TuioTime ttime, long si, int sym, float xp, float yp, float a) {
+ super(ttime, si,xp,yp);
+ symbol_id = sym;
+ angle = a;
+ rotation_speed = 0.0f;
+ rotation_accel = 0.0f;
+ }
+
+ /**
+ * This constructor takes the provided Session ID, Symbol ID, X and Y coordinate
+ * and angle, and assigs these values to the newly created TuioObject.
+ *
+ * @param si the Session ID to assign
+ * @param sym the Symbol ID to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param a the angle to assign
+ */
+ public TuioObject (long si, int sym, float xp, float yp, float a) {
+ super(si,xp,yp);
+ symbol_id = sym;
+ angle = angle;
+ rotation_speed = 0.0f;
+ rotation_accel = 0.0f;
+ }
+
+ /**
+ * This constructor takes the atttibutes of the provided TuioObject
+ * and assigs these values to the newly created TuioObject.
+ *
+ * @param tobj the TuioObject to assign
+ */
+ public TuioObject (TuioObject tobj) {
+ super(tobj);
+ symbol_id = tobj.getSymbolID();
+ angle = tobj.getAngle();
+ rotation_speed = 0.0f;
+ rotation_accel = 0.0f;
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X and Y coordinate, angle, X and Y velocity, motion acceleration,
+ * rotation speed and rotation acceleration to the private TuioObject attributes.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param a the angle coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param rs the rotation velocity to assign
+ * @param ma the motion acceleration to assign
+ * @param ra the rotation acceleration to assign
+ */
+ public void update (TuioTime ttime, float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) {
+ super.update(ttime,xp,yp,xs,ys,ma);
+ angle = a;
+ rotation_speed = rs;
+ rotation_accel = ra;
+ if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
+ }
+
+ /**
+ * Assigns the provided X and Y coordinate, angle, X and Y velocity, motion acceleration
+ * rotation velocity and rotation acceleration to the private TuioContainer attributes.
+ * The TuioTime time stamp remains unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param a the angle coordinate to assign
+ * @param xs the X velocity to assign
+ * @param ys the Y velocity to assign
+ * @param rs the rotation velocity to assign
+ * @param ma the motion acceleration to assign
+ * @param ra the rotation acceleration to assign
+ */
+ public void update (float xp, float yp, float a, float xs, float ys, float rs, float ma, float ra) {
+ super.update(xp,yp,xs,ys,ma);
+ angle = a;
+ rotation_speed = rs;
+ rotation_accel = ra;
+ if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * X and Y coordinate and angle to the private TuioObject attributes.
+ * The speed and accleration values are calculated accordingly.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param a the angle coordinate to assign
+ */
+ public void update (TuioTime ttime, float xp, float yp, float a) {
+ TuioPoint lastPoint = path.lastElement();
+ super.update(ttime,xp,yp);
+
+ TuioTime diffTime = currentTime.subtract(lastPoint.getTuioTime());
+ float dt = diffTime.getTotalMilliseconds()/1000.0f;
+ float last_angle = angle;
+ float last_rotation_speed = rotation_speed;
+ angle = a;
+
+ float da = (this.angle-last_angle)/(2.0f*(float)Math.PI);
+ if (da>0.75f) da-=1.0f;
+ else if (da<-0.75f) da+=1.0f;
+
+ rotation_speed = da/dt;
+ rotation_accel = (rotation_speed - last_rotation_speed)/dt;
+ if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
+ }
+
+ /**
+ * Takes the atttibutes of the provided TuioObject
+ * and assigs these values to this TuioObject.
+ * The TuioTime time stamp of this TuioContainer remains unchanged.
+ *
+ * @param tobj the TuioContainer to assign
+ */
+ public void update (TuioObject tobj) {
+ super.update(tobj);
+ angle = tobj.getAngle();
+ rotation_speed = tobj.getRotationSpeed();
+ rotation_accel = tobj.getRotationAccel();
+ if ((rotation_accel!=0) && (state!=TUIO_STOPPED)) state = TUIO_ROTATING;
+ }
+
+ /**
+ * This method is used to calculate the speed and acceleration values of a
+ * TuioObject with unchanged position and angle.
+ *
+ * @param ttime the TuioTime to assign
+ */
+ public void stop (TuioTime ttime) {
+ update(ttime,xpos,ypos, angle);
+ }
+
+ /**
+ * Returns the symbol ID of this TuioObject.
+ * @return the symbol ID of this TuioObject
+ */
+ public int getSymbolID() {
+ return symbol_id;
+ }
+
+ /**
+ * Returns the rotation angle of this TuioObject.
+ * @return the rotation angle of this TuioObject
+ */
+ public float getAngle() {
+ return angle;
+ }
+
+ /**
+ * Returns the rotation angle in degrees of this TuioObject.
+ * @return the rotation angle in degrees of this TuioObject
+ */
+ public float getAngleDegrees() {
+ return angle/(float)Math.PI*180.0f;
+ }
+
+ /**
+ * Returns the rotation speed of this TuioObject.
+ * @return the rotation speed of this TuioObject
+ */
+ public float getRotationSpeed() {
+ return rotation_speed;
+ }
+
+ /**
+ * Returns the rotation acceleration of this TuioObject.
+ * @return the rotation acceleration of this TuioObject
+ */
+ public float getRotationAccel() {
+ return rotation_accel;
+ }
+
+ /**
+ * Returns true of this TuioObject is moving.
+ * @return true of this TuioObject is moving
+ */
+ public boolean isMoving() {
+ if ((state==TUIO_ACCELERATING) || (state==TUIO_DECELERATING) || (state==TUIO_ROTATING)) return true;
+ else return false;
+ }
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioPoint.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioPoint.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioPoint.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,363 +1,363 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-package TUIO;
-
-/**
- * The TuioPoint class on the one hand is a simple container and utility class to handle TUIO positions in general,
- * on the other hand the TuioPoint is the base class for the TuioCursor and TuioObject classes.
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public class TuioPoint {
-
- public String comm;
-
- /**
- * X coordinate, representated as a floating point value in a range of 0..1
- */
- protected float xpos;
- /**
- * Y coordinate, representated as a floating point value in a range of 0..1
- */
- protected float ypos;
- /**
- * Z coordinate, representated as a floating point value in a range of 0..1
- */
- protected float zpos;
- /**
- * The time stamp of the last update represented as TuioTime (time since session start)
- */
- protected TuioTime currentTime;
- /**
- * The creation time of this TuioPoint represented as TuioTime (time since session start)
- */
- protected TuioTime startTime;
-
- /**
- * The default constructor takes no arguments and sets
- * its coordinate attributes to zero and its time stamp to the current session time.
- */
- public TuioPoint() {
- xpos = 0.0f;
- ypos = 0.0f;
- zpos = 0.0f;
- currentTime = TuioTime.getSessionTime();
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes two floating point coordinate arguments and sets
- * its coordinate attributes to these values and its time stamp to the current session time.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public TuioPoint(float xp, float yp) {
- xpos = xp;
- ypos = yp;
- zpos = 0.0f;
- currentTime = TuioTime.getSessionTime();
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes three floating point coordinate arguments and sets
- * its coordinate attributes to these values and its time stamp to the current session time.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public TuioPoint(float xp, float yp, float zp) {
- xpos = xp;
- ypos = yp;
- zpos = zp;
- currentTime = TuioTime.getSessionTime();
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes a TuioPoint argument and sets its coordinate attributes
- * to the coordinates of the provided TuioPoint and its time stamp to the current session time.
- *
- * @param tpoint the TuioPoint to assign
- */
- public TuioPoint(TuioPoint tpoint) {
- xpos = tpoint.getX();
- ypos = tpoint.getY();
- zpos = tpoint.getZ();
- currentTime = TuioTime.getSessionTime();
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes a TuioTime object and two floating point coordinate arguments and sets
- * its coordinate attributes to these values and its time stamp to the provided TUIO time object.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public TuioPoint(TuioTime ttime, float xp, float yp) {
- xpos = xp;
- ypos = yp;
- zpos = 0.0f;
- currentTime = new TuioTime(ttime);
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes a TuioTime object and three floating point coordinate arguments and sets
- * its coordinate attributes to these values and its time stamp to the provided TUIO time object.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public TuioPoint(TuioTime ttime, float xp, float yp, float zp) {
- xpos = xp;
- ypos = yp;
- zpos = zp;
- currentTime = new TuioTime(ttime);
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * Takes a TuioPoint argument and updates its coordinate attributes
- * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
- *
- * @param tpoint the TuioPoint to assign
- */
- public void update(TuioPoint tpoint) {
- xpos = tpoint.getX();
- ypos = tpoint.getY();
- zpos = tpoint.getZ();
- }
-
- /**
- * Takes two floating point coordinate arguments and updates its coordinate attributes
- * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public void update(float xp, float yp) {
- xpos = xp;
- ypos = yp;
- }
-
- /**
- * Takes three floating point coordinate arguments and updates its coordinate attributes
- * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
- *
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public void update(float xp, float yp, float zp) {
- xpos = xp;
- ypos = yp;
- zpos = zp;
- }
-
- /**
- * Takes a TuioTime object and two floating point coordinate arguments and updates its coordinate attributes
- * to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- */
- public void update(TuioTime ttime, float xp, float yp) {
- xpos = xp;
- ypos = yp;
- currentTime = new TuioTime(ttime);
- }
-
- /**
- * Takes a TuioTime object and three floating point coordinate arguments and updates its coordinate attributes
- * to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
- *
- * @param ttime the TuioTime to assign
- * @param xp the X coordinate to assign
- * @param yp the Y coordinate to assign
- * @param zp the Z coordinate to assign
- */
- public void update(TuioTime ttime, float xp, float yp, float zp) {
- xpos = xp;
- ypos = yp;
- zpos = zp;
- currentTime = new TuioTime(ttime);
- }
-
- /**
- * Returns the X coordinate of this TuioPoint.
- * @return the X coordinate of this TuioPoint
- */
- public float getX() {
- return xpos;
- }
-
- /**
- * Returns the Y coordinate of this TuioPoint.
- * @return the Y coordinate of this TuioPoint
- */
- public float getY() {
- return ypos;
- }
-
- /**
- * Returns the Z coordinate of this TuioPoint.
- * @return the Z coordinate of this TuioPoint
- */
- public float getZ() {
- return zpos;
- }
-
- /**
- * Returns the distance to the provided coordinates
- *
- * @param xp the X coordinate of the distant point
- * @param yp the Y coordinate of the distant point
- * @return the distance to the provided coordinates
- */
- public float getDistance(float xp, float yp) {
- float dx = xpos-xp;
- float dy = ypos-yp;
- return (float)Math.sqrt(dx*dx+dy*dy);
- }
-
- /**
- * Returns the distance to the provided coordinates
- *
- * @param xp the X coordinate of the distant point
- * @param yp the Y coordinate of the distant point
- * @param zp the Y coordinate of the distant point
- * @return the distance to the provided coordinates
- */
- public float getDistance(float xp, float yp, float zp) {
- float dx = xpos-xp;
- float dy = ypos-yp;
- float dz = zpos-zp;
- return (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
- }
-
- /**
- * Returns the distance to the provided TuioPoint
- *
- * @param tpoint the distant TuioPoint
- * @return the distance to the provided TuioPoint
- */
- public float getDistance(TuioPoint tpoint) {
- return getDistance(tpoint.getX(),tpoint.getY(), tpoint.getZ());
- }
-
- /**
- * Returns the angle to the provided coordinates
- *
- * @param xp the X coordinate of the distant point
- * @param yp the Y coordinate of the distant point
- * @return the angle to the provided coordinates
- */
- public float getAngle(float xp, float yp) {
-
- float side = xpos-xp;
- float height = ypos-yp;
- float distance = getDistance(xp,yp);
-
- float angle = (float)(Math.asin(side/distance)+Math.PI/2);
- if (height<0) angle = 2.0f*(float)Math.PI-angle;
-
- return angle;
- }
-
- /**
- * Returns the angle to the provided TuioPoint
- *
- * @param tpoint the distant TuioPoint
- * @return the angle to the provided TuioPoint
- */
- public float getAngle(TuioPoint tpoint) {
- return getAngle(tpoint.getX(),tpoint.getY());
- }
-
- /**
- * Returns the angle in degrees to the provided coordinates
- *
- * @param xp the X coordinate of the distant point
- * @param yp the Y coordinate of the distant point
- * @return the angle in degrees to the provided TuioPoint
- */
- public float getAngleDegrees(float xp, float yp) {
- return (getAngle(xp,yp)/(float)Math.PI)*180.0f;
- }
-
- /**
- * Returns the angle in degrees to the provided TuioPoint
- *
- * @param tpoint the distant TuioPoint
- * @return the angle in degrees to the provided TuioPoint
- */
- public float getAngleDegrees(TuioPoint tpoint) {
- return (getAngle(tpoint)/(float)Math.PI)*180.0f;
- }
-
- /**
- * Returns the X coordinate in pixels relative to the provided screen width.
- *
- * @param width the screen width
- * @return the X coordinate of this TuioPoint in pixels relative to the provided screen width
- */
- public int getScreenX(int width) {
- return (int)Math.round(xpos*width);
- }
-
- /**
- * Returns the Y coordinate in pixels relative to the provided screen height.
- *
- * @param height the screen height
- * @return the Y coordinate of this TuioPoint in pixels relative to the provided screen height
- */
- public int getScreenY(int height) {
- return (int)Math.round(ypos*height);
- }
-
- /**
- * Returns the time stamp of this TuioPoint as TuioTime.
- *
- * @return the time stamp of this TuioPoint as TuioTime
- */
- public TuioTime getTuioTime() {
- return new TuioTime(currentTime);
- }
-
- /**
- * Returns the start time of this TuioPoint as TuioTime.
- *
- * @return the start time of this TuioPoint as TuioTime
- */
- public TuioTime getStartTime() {
- return new TuioTime(startTime);
- }
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+package TUIO;
+
+/**
+ * The TuioPoint class on the one hand is a simple container and utility class to handle TUIO positions in general,
+ * on the other hand the TuioPoint is the base class for the TuioCursor and TuioObject classes.
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public class TuioPoint {
+
+ public String comm;
+
+ /**
+ * X coordinate, representated as a floating point value in a range of 0..1
+ */
+ protected float xpos;
+ /**
+ * Y coordinate, representated as a floating point value in a range of 0..1
+ */
+ protected float ypos;
+ /**
+ * Z coordinate, representated as a floating point value in a range of 0..1
+ */
+ protected float zpos;
+ /**
+ * The time stamp of the last update represented as TuioTime (time since session start)
+ */
+ protected TuioTime currentTime;
+ /**
+ * The creation time of this TuioPoint represented as TuioTime (time since session start)
+ */
+ protected TuioTime startTime;
+
+ /**
+ * The default constructor takes no arguments and sets
+ * its coordinate attributes to zero and its time stamp to the current session time.
+ */
+ public TuioPoint() {
+ xpos = 0.0f;
+ ypos = 0.0f;
+ zpos = 0.0f;
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes two floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the current session time.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public TuioPoint(float xp, float yp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = 0.0f;
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes three floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the current session time.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public TuioPoint(float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes a TuioPoint argument and sets its coordinate attributes
+ * to the coordinates of the provided TuioPoint and its time stamp to the current session time.
+ *
+ * @param tpoint the TuioPoint to assign
+ */
+ public TuioPoint(TuioPoint tpoint) {
+ xpos = tpoint.getX();
+ ypos = tpoint.getY();
+ zpos = tpoint.getZ();
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes a TuioTime object and two floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the provided TUIO time object.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public TuioPoint(TuioTime ttime, float xp, float yp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = 0.0f;
+ currentTime = new TuioTime(ttime);
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes a TuioTime object and three floating point coordinate arguments and sets
+ * its coordinate attributes to these values and its time stamp to the provided TUIO time object.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public TuioPoint(TuioTime ttime, float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ currentTime = new TuioTime(ttime);
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * Takes a TuioPoint argument and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
+ *
+ * @param tpoint the TuioPoint to assign
+ */
+ public void update(TuioPoint tpoint) {
+ xpos = tpoint.getX();
+ ypos = tpoint.getY();
+ zpos = tpoint.getZ();
+ }
+
+ /**
+ * Takes two floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public void update(float xp, float yp) {
+ xpos = xp;
+ ypos = yp;
+ }
+
+ /**
+ * Takes three floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and leaves its time stamp unchanged.
+ *
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public void update(float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ }
+
+ /**
+ * Takes a TuioTime object and two floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp) {
+ xpos = xp;
+ ypos = yp;
+ currentTime = new TuioTime(ttime);
+ }
+
+ /**
+ * Takes a TuioTime object and three floating point coordinate arguments and updates its coordinate attributes
+ * to the coordinates of the provided TuioPoint and its time stamp to the provided TUIO time object.
+ *
+ * @param ttime the TuioTime to assign
+ * @param xp the X coordinate to assign
+ * @param yp the Y coordinate to assign
+ * @param zp the Z coordinate to assign
+ */
+ public void update(TuioTime ttime, float xp, float yp, float zp) {
+ xpos = xp;
+ ypos = yp;
+ zpos = zp;
+ currentTime = new TuioTime(ttime);
+ }
+
+ /**
+ * Returns the X coordinate of this TuioPoint.
+ * @return the X coordinate of this TuioPoint
+ */
+ public float getX() {
+ return xpos;
+ }
+
+ /**
+ * Returns the Y coordinate of this TuioPoint.
+ * @return the Y coordinate of this TuioPoint
+ */
+ public float getY() {
+ return ypos;
+ }
+
+ /**
+ * Returns the Z coordinate of this TuioPoint.
+ * @return the Z coordinate of this TuioPoint
+ */
+ public float getZ() {
+ return zpos;
+ }
+
+ /**
+ * Returns the distance to the provided coordinates
+ *
+ * @param xp the X coordinate of the distant point
+ * @param yp the Y coordinate of the distant point
+ * @return the distance to the provided coordinates
+ */
+ public float getDistance(float xp, float yp) {
+ float dx = xpos-xp;
+ float dy = ypos-yp;
+ return (float)Math.sqrt(dx*dx+dy*dy);
+ }
+
+ /**
+ * Returns the distance to the provided coordinates
+ *
+ * @param xp the X coordinate of the distant point
+ * @param yp the Y coordinate of the distant point
+ * @param zp the Y coordinate of the distant point
+ * @return the distance to the provided coordinates
+ */
+ public float getDistance(float xp, float yp, float zp) {
+ float dx = xpos-xp;
+ float dy = ypos-yp;
+ float dz = zpos-zp;
+ return (float)Math.sqrt(dx*dx+dy*dy+dz*dz);
+ }
+
+ /**
+ * Returns the distance to the provided TuioPoint
+ *
+ * @param tpoint the distant TuioPoint
+ * @return the distance to the provided TuioPoint
+ */
+ public float getDistance(TuioPoint tpoint) {
+ return getDistance(tpoint.getX(),tpoint.getY(), tpoint.getZ());
+ }
+
+ /**
+ * Returns the angle to the provided coordinates
+ *
+ * @param xp the X coordinate of the distant point
+ * @param yp the Y coordinate of the distant point
+ * @return the angle to the provided coordinates
+ */
+ public float getAngle(float xp, float yp) {
+
+ float side = xpos-xp;
+ float height = ypos-yp;
+ float distance = getDistance(xp,yp);
+
+ float angle = (float)(Math.asin(side/distance)+Math.PI/2);
+ if (height<0) angle = 2.0f*(float)Math.PI-angle;
+
+ return angle;
+ }
+
+ /**
+ * Returns the angle to the provided TuioPoint
+ *
+ * @param tpoint the distant TuioPoint
+ * @return the angle to the provided TuioPoint
+ */
+ public float getAngle(TuioPoint tpoint) {
+ return getAngle(tpoint.getX(),tpoint.getY());
+ }
+
+ /**
+ * Returns the angle in degrees to the provided coordinates
+ *
+ * @param xp the X coordinate of the distant point
+ * @param yp the Y coordinate of the distant point
+ * @return the angle in degrees to the provided TuioPoint
+ */
+ public float getAngleDegrees(float xp, float yp) {
+ return (getAngle(xp,yp)/(float)Math.PI)*180.0f;
+ }
+
+ /**
+ * Returns the angle in degrees to the provided TuioPoint
+ *
+ * @param tpoint the distant TuioPoint
+ * @return the angle in degrees to the provided TuioPoint
+ */
+ public float getAngleDegrees(TuioPoint tpoint) {
+ return (getAngle(tpoint)/(float)Math.PI)*180.0f;
+ }
+
+ /**
+ * Returns the X coordinate in pixels relative to the provided screen width.
+ *
+ * @param width the screen width
+ * @return the X coordinate of this TuioPoint in pixels relative to the provided screen width
+ */
+ public int getScreenX(int width) {
+ return (int)Math.round(xpos*width);
+ }
+
+ /**
+ * Returns the Y coordinate in pixels relative to the provided screen height.
+ *
+ * @param height the screen height
+ * @return the Y coordinate of this TuioPoint in pixels relative to the provided screen height
+ */
+ public int getScreenY(int height) {
+ return (int)Math.round(ypos*height);
+ }
+
+ /**
+ * Returns the time stamp of this TuioPoint as TuioTime.
+ *
+ * @return the time stamp of this TuioPoint as TuioTime
+ */
+ public TuioTime getTuioTime() {
+ return new TuioTime(currentTime);
+ }
+
+ /**
+ * Returns the start time of this TuioPoint as TuioTime.
+ *
+ * @return the start time of this TuioPoint as TuioTime
+ */
+ public TuioTime getStartTime() {
+ return new TuioTime(startTime);
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioString.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioString.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioString.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,189 +1,189 @@
-/*
-Added by alexandre.bastien@iri.centrepompidou.fr
-*/
-
-package TUIO;
-
-/**
- * The TuioCursor class encapsulates /tuio/_siP TUIO strings.
- *
- */
-public class TuioString {
-
- /**
- * The unique session ID number that is assigned to each TUIO string.
- */
- protected long session_id;
-
- /**
- * The individual string ID number that is assigned to each TuioString.
- */
- protected int string_id;
-
- /**
- * The individual string message that is assigned to each TuioString.
- */
- protected String message;
-
- /**
- * The time stamp of the last update represented as TuioTime (time since session start)
- */
- protected TuioTime currentTime;
- /**
- * The creation time of this TuioString represented as TuioTime (time since session start)
- */
- protected TuioTime startTime;
-
- /**
- * Defines the ADDED state.
- */
- public static final int TUIO_ADDED = 0;
- /**
- * Defines the REMOVED state.
- */
- public static final int TUIO_REMOVED = 4;
- /**
- * Reflects the current state of the TuioString
- */
- protected int state;
-
- /**
- * This constructor takes a TuioTime argument and assigns it along with the provided
- * Session ID, String ID and a message to the newly created TuioString.
- *
- * @param ttime the TuioTime to assign
- * @param si the Session ID to assign
- * @param sti the String ID to assign
- * @param msg the message to assign
- */
- public TuioString (TuioTime ttime, long si, int sti, String msg) {
- this.session_id = si;
- this.string_id = sti;
- this.message = msg;
- currentTime = new TuioTime(ttime);
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes the provided Session ID, String ID and message
- * and assigs these values to the newly created TuioString.
- *
- * @param si the Session ID to assign
- * @param sti the String ID to assign
- * @param msg the message to assign
- */
- public TuioString (long si, int sti, String msg) {
- this.session_id = si;
- this.string_id = sti;
- this.message = msg;
- currentTime = TuioTime.getSessionTime();
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * This constructor takes the atttibutes of the provided TuioCursor
- * and assigs these values to the newly created TuioCursor.
- *
- * @param tcur the TuioCursor to assign
- */
- public TuioString (TuioString tstr) {
- this.session_id = tstr.getSessionID();
- this.string_id = tstr.getStringID();
- this.message = tstr.getMessage();
- currentTime = new TuioTime(tstr.getCurrentTime());
- startTime = new TuioTime(currentTime);
- }
-
- /**
- * Takes a TuioTime argument and assigns it along with the provided
- * message to the private TuioString attributes.
- * The speed and accleration values are calculated accordingly.
- *
- * @param ttime the TuioTime to assign
- * @param message2 the message to assign
- */
- public void update(TuioTime ttime, String message2) {
- currentTime = new TuioTime(ttime);
- message = message2;
- }
-
- /**
- * This method is used to update the TuioTime of a TuioString while keeping the same * * * message.
- */
- public void stop(TuioTime ttime) {
- update(ttime,message);
- }
-
- /**
- * Takes the atttibutes of the provided TuioString
- * and assigs these values to this TuioString.
- * The TuioTime time stamp of this TuioString remains unchanged.
- *
- * @param tstr the TuioString to assign
- */
- public void update (TuioString tstr) {
- message = tstr.getMessage();
- }
-
- /**
- * Takes the message provided
- * and assigs its value to this TuioString.
- * The TuioTime time stamp of this TuioString remains unchanged.
- *
- * @param msg the message to assign
- */
- public void update (String msg) {
- message = msg;
- }
-
- /**
- * Assigns the REMOVE state to this TuioString and sets
- * its TuioTime time stamp to the provided TuioTime argument.
- *
- * @param ttime the TuioTime to assign
- */
- public void remove(TuioTime ttime) {
- currentTime = new TuioTime(ttime);
- state = TUIO_REMOVED;
- }
-
- /**
- * Returns the Session ID of this TuioString.
- * @return the Session ID of this TuioString
- */
- public long getSessionID() {
- return session_id;
- }
-
- /**
- * Returns the String ID of this TuioString.
- * @return the String ID of this TuioString
- */
- public int getStringID() {
- return string_id;
- }
-
- /**
- * Returns the Message of this TuioString.
- * @return the Message of this TuioString
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Returns the Current Time of this TuioString.
- * @return the Current Time of this TuioString
- */
- public TuioTime getCurrentTime() {
- return currentTime;
- }
-
- /**
- * Returns the TUIO state of this TuioString.
- * @return the TUIO state of this TuioString
- */
- public int getTuioState() {
- return state;
- }
-}
+/*
+Added by alexandre.bastien@iri.centrepompidou.fr
+*/
+
+package TUIO;
+
+/**
+ * The TuioCursor class encapsulates /tuio/_siP TUIO strings.
+ *
+ */
+public class TuioString {
+
+ /**
+ * The unique session ID number that is assigned to each TUIO string.
+ */
+ protected long session_id;
+
+ /**
+ * The individual string ID number that is assigned to each TuioString.
+ */
+ protected int string_id;
+
+ /**
+ * The individual string message that is assigned to each TuioString.
+ */
+ protected String message;
+
+ /**
+ * The time stamp of the last update represented as TuioTime (time since session start)
+ */
+ protected TuioTime currentTime;
+ /**
+ * The creation time of this TuioString represented as TuioTime (time since session start)
+ */
+ protected TuioTime startTime;
+
+ /**
+ * Defines the ADDED state.
+ */
+ public static final int TUIO_ADDED = 0;
+ /**
+ * Defines the REMOVED state.
+ */
+ public static final int TUIO_REMOVED = 4;
+ /**
+ * Reflects the current state of the TuioString
+ */
+ protected int state;
+
+ /**
+ * This constructor takes a TuioTime argument and assigns it along with the provided
+ * Session ID, String ID and a message to the newly created TuioString.
+ *
+ * @param ttime the TuioTime to assign
+ * @param si the Session ID to assign
+ * @param sti the String ID to assign
+ * @param msg the message to assign
+ */
+ public TuioString (TuioTime ttime, long si, int sti, String msg) {
+ this.session_id = si;
+ this.string_id = sti;
+ this.message = msg;
+ currentTime = new TuioTime(ttime);
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes the provided Session ID, String ID and message
+ * and assigs these values to the newly created TuioString.
+ *
+ * @param si the Session ID to assign
+ * @param sti the String ID to assign
+ * @param msg the message to assign
+ */
+ public TuioString (long si, int sti, String msg) {
+ this.session_id = si;
+ this.string_id = sti;
+ this.message = msg;
+ currentTime = TuioTime.getSessionTime();
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * This constructor takes the atttibutes of the provided TuioCursor
+ * and assigs these values to the newly created TuioCursor.
+ *
+ * @param tcur the TuioCursor to assign
+ */
+ public TuioString (TuioString tstr) {
+ this.session_id = tstr.getSessionID();
+ this.string_id = tstr.getStringID();
+ this.message = tstr.getMessage();
+ currentTime = new TuioTime(tstr.getCurrentTime());
+ startTime = new TuioTime(currentTime);
+ }
+
+ /**
+ * Takes a TuioTime argument and assigns it along with the provided
+ * message to the private TuioString attributes.
+ * The speed and accleration values are calculated accordingly.
+ *
+ * @param ttime the TuioTime to assign
+ * @param message2 the message to assign
+ */
+ public void update(TuioTime ttime, String message2) {
+ currentTime = new TuioTime(ttime);
+ message = message2;
+ }
+
+ /**
+ * This method is used to update the TuioTime of a TuioString while keeping the same * * * message.
+ */
+ public void stop(TuioTime ttime) {
+ update(ttime,message);
+ }
+
+ /**
+ * Takes the atttibutes of the provided TuioString
+ * and assigs these values to this TuioString.
+ * The TuioTime time stamp of this TuioString remains unchanged.
+ *
+ * @param tstr the TuioString to assign
+ */
+ public void update (TuioString tstr) {
+ message = tstr.getMessage();
+ }
+
+ /**
+ * Takes the message provided
+ * and assigs its value to this TuioString.
+ * The TuioTime time stamp of this TuioString remains unchanged.
+ *
+ * @param msg the message to assign
+ */
+ public void update (String msg) {
+ message = msg;
+ }
+
+ /**
+ * Assigns the REMOVE state to this TuioString and sets
+ * its TuioTime time stamp to the provided TuioTime argument.
+ *
+ * @param ttime the TuioTime to assign
+ */
+ public void remove(TuioTime ttime) {
+ currentTime = new TuioTime(ttime);
+ state = TUIO_REMOVED;
+ }
+
+ /**
+ * Returns the Session ID of this TuioString.
+ * @return the Session ID of this TuioString
+ */
+ public long getSessionID() {
+ return session_id;
+ }
+
+ /**
+ * Returns the String ID of this TuioString.
+ * @return the String ID of this TuioString
+ */
+ public int getStringID() {
+ return string_id;
+ }
+
+ /**
+ * Returns the Message of this TuioString.
+ * @return the Message of this TuioString
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Returns the Current Time of this TuioString.
+ * @return the Current Time of this TuioString
+ */
+ public TuioTime getCurrentTime() {
+ return currentTime;
+ }
+
+ /**
+ * Returns the TUIO state of this TuioString.
+ * @return the TUIO state of this TuioString
+ */
+ public int getTuioState() {
+ return state;
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TUIO/TuioTime.java
--- a/front_processing/extern/TUIO_JAVA/src/TUIO/TuioTime.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TUIO/TuioTime.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,236 +1,236 @@
-/*
- TUIO Java backend - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-package TUIO;
-
-/**
- * The TuioTime class is a simple structure that is used to reprent the time that has elapsed since the session start.
- * The time is internally represented as seconds and fractions of microseconds which should be more than sufficient for gesture related timing requirements.
- * Therefore at the beginning of a typical TUIO session the static method initSession() will set the reference time for the session.
- * Another important static method getSessionTime will return a TuioTime object representing the time elapsed since the session start.
- * The class also provides various addtional convience method, which allow some simple time arithmetics.
- *
- * @author Martin Kaltenbrunner
- * @version 1.4
- */
-public class TuioTime {
-
- /**
- * the time since session start in seconds
- */
- private long seconds = 0;
- /**
- * time fraction in microseconds
- */
- private long micro_seconds = 0;
- /**
- * the session start time in seconds
- */
- private static long start_seconds = 0;
- /**
- * start time fraction in microseconds
- */
- private static long start_micro_seconds = 0;
-
- /**
- * The default constructor takes no arguments and sets
- * the Seconds and Microseconds attributes of the newly created TuioTime both to zero.
- */
- public TuioTime () {
- this.seconds = 0;
- this.micro_seconds = 0;
- }
-
- /**
- * This constructor takes the provided time represented in total Milliseconds
- * and assigs this value to the newly created TuioTime.
- *
- * @param msec the total time in Millseconds
- */
- public TuioTime (long msec) {
- this.seconds = msec/1000;
- this.micro_seconds = 1000*(msec%1000);
- }
-
- /**
- * This constructor takes the provided time represented in Seconds and Microseconds
- * and assigs these value to the newly created TuioTime.
- *
- * @param sec the total time in seconds
- * @param usec the microseconds time component
- */
- public TuioTime (long sec, long usec) {
- this.seconds = sec;
- this.micro_seconds = usec;
- }
-
- /**
- * This constructor takes the provided TuioTime
- * and assigs its Seconds and Microseconds values to the newly created TuioTime.
- *
- * @param ttime the TuioTime used to copy
- */
- public TuioTime (TuioTime ttime) {
- this.seconds = ttime.getSeconds();
- this.micro_seconds = ttime.getMicroseconds();
- }
-
- /**
- * Sums the provided time value represented in total Microseconds to this TuioTime.
- *
- * @param us the total time to add in Microseconds
- * @return the sum of this TuioTime with the provided argument in microseconds
- */
- public TuioTime add(long us) {
- long sec = seconds + us/1000000;
- long usec = micro_seconds + us%1000000;
- return new TuioTime(sec,usec);
- }
-
- /**
- * Sums the provided TuioTime to the private Seconds and Microseconds attributes.
- *
- * @param ttime the TuioTime to add
- * @return the sum of this TuioTime with the provided TuioTime argument
- */
- public TuioTime add(TuioTime ttime) {
- long sec = seconds + ttime.getSeconds();
- long usec = micro_seconds + ttime.getMicroseconds();
- sec += usec/1000000;
- usec = usec%1000000;
- return new TuioTime(sec,usec);
- }
-
- /**
- * Subtracts the provided time represented in Microseconds from the private Seconds and Microseconds attributes.
- *
- * @param us the total time to subtract in Microseconds
- * @return the subtraction result of this TuioTime minus the provided time in Microseconds
- */
- public TuioTime subtract(long us) {
- long sec = seconds - us/1000000;
- long usec = micro_seconds - us%1000000;
-
- if (usec<0) {
- usec += 1000000;
- sec--;
- }
-
- return new TuioTime(sec,usec);
- }
-
- /**
- * Subtracts the provided TuioTime from the private Seconds and Microseconds attributes.
- *
- * @param ttime the TuioTime to subtract
- * @return the subtraction result of this TuioTime minus the provided TuioTime
- */
- public TuioTime subtract(TuioTime ttime) {
- long sec = seconds - ttime.getSeconds();
- long usec = micro_seconds - ttime.getMicroseconds();
-
- if (usec<0) {
- usec += 1000000;
- sec--;
- }
-
- return new TuioTime(sec,usec);
- }
-
- /**
- * Takes a TuioTime argument and compares the provided TuioTime to the private Seconds and Microseconds attributes.
- *
- * @param ttime the TuioTime to compare
- * @return true if the two TuioTime have equal Seconds and Microseconds attributes
- */
- public boolean equals(TuioTime ttime) {
- if ((seconds==ttime.getSeconds()) && (micro_seconds==ttime.getMicroseconds())) return true;
- else return false;
- }
-
- /**
- * Resets the seconds and micro_seconds attributes to zero.
- */
- public void reset() {
- seconds = 0;
- micro_seconds = 0;
- }
-
- /**
- * Returns the TuioTime Seconds component.
- * @return the TuioTime Seconds component
- */
- public long getSeconds() {
- return seconds;
- }
-
- /**
- * Returns the TuioTime Microseconds component.
- * @return the TuioTime Microseconds component
- */
- public long getMicroseconds() {
- return micro_seconds;
- }
-
- /**
- * Returns the total TuioTime in Milliseconds.
- * @return the total TuioTime in Milliseconds
- */
- public long getTotalMilliseconds() {
- return seconds*1000+micro_seconds/1000;
- }
-
- /**
- * This static method globally resets the TUIO session time.
- */
- public static void initSession() {
- TuioTime startTime = getSystemTime();
- start_seconds = startTime.getSeconds();
- start_micro_seconds = startTime.getMicroseconds();
- }
-
- /**
- * Returns the present TuioTime representing the time since session start.
- * @return the present TuioTime representing the time since session start
- */
- public static TuioTime getSessionTime() {
- TuioTime sessionTime = getSystemTime().subtract(getStartTime());
- return sessionTime;
-
- }
-
- /**
- * Returns the absolut TuioTime representing the session start.
- * @return the absolut TuioTime representing the session start
- */
- public static TuioTime getStartTime() {
- return new TuioTime(start_seconds,start_micro_seconds);
- }
-
- /**
- * Returns the absolut TuioTime representing the current system time.
- * @return the absolut TuioTime representing the current system time
- */
- public static TuioTime getSystemTime() {
- long usec = System.nanoTime()/1000;
- return new TuioTime(usec/1000000,usec%1000000);
- }
-}
+/*
+ TUIO Java backend - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+package TUIO;
+
+/**
+ * The TuioTime class is a simple structure that is used to reprent the time that has elapsed since the session start.
+ * The time is internally represented as seconds and fractions of microseconds which should be more than sufficient for gesture related timing requirements.
+ * Therefore at the beginning of a typical TUIO session the static method initSession() will set the reference time for the session.
+ * Another important static method getSessionTime will return a TuioTime object representing the time elapsed since the session start.
+ * The class also provides various addtional convience method, which allow some simple time arithmetics.
+ *
+ * @author Martin Kaltenbrunner
+ * @version 1.4
+ */
+public class TuioTime {
+
+ /**
+ * the time since session start in seconds
+ */
+ private long seconds = 0;
+ /**
+ * time fraction in microseconds
+ */
+ private long micro_seconds = 0;
+ /**
+ * the session start time in seconds
+ */
+ private static long start_seconds = 0;
+ /**
+ * start time fraction in microseconds
+ */
+ private static long start_micro_seconds = 0;
+
+ /**
+ * The default constructor takes no arguments and sets
+ * the Seconds and Microseconds attributes of the newly created TuioTime both to zero.
+ */
+ public TuioTime () {
+ this.seconds = 0;
+ this.micro_seconds = 0;
+ }
+
+ /**
+ * This constructor takes the provided time represented in total Milliseconds
+ * and assigs this value to the newly created TuioTime.
+ *
+ * @param msec the total time in Millseconds
+ */
+ public TuioTime (long msec) {
+ this.seconds = msec/1000;
+ this.micro_seconds = 1000*(msec%1000);
+ }
+
+ /**
+ * This constructor takes the provided time represented in Seconds and Microseconds
+ * and assigs these value to the newly created TuioTime.
+ *
+ * @param sec the total time in seconds
+ * @param usec the microseconds time component
+ */
+ public TuioTime (long sec, long usec) {
+ this.seconds = sec;
+ this.micro_seconds = usec;
+ }
+
+ /**
+ * This constructor takes the provided TuioTime
+ * and assigs its Seconds and Microseconds values to the newly created TuioTime.
+ *
+ * @param ttime the TuioTime used to copy
+ */
+ public TuioTime (TuioTime ttime) {
+ this.seconds = ttime.getSeconds();
+ this.micro_seconds = ttime.getMicroseconds();
+ }
+
+ /**
+ * Sums the provided time value represented in total Microseconds to this TuioTime.
+ *
+ * @param us the total time to add in Microseconds
+ * @return the sum of this TuioTime with the provided argument in microseconds
+ */
+ public TuioTime add(long us) {
+ long sec = seconds + us/1000000;
+ long usec = micro_seconds + us%1000000;
+ return new TuioTime(sec,usec);
+ }
+
+ /**
+ * Sums the provided TuioTime to the private Seconds and Microseconds attributes.
+ *
+ * @param ttime the TuioTime to add
+ * @return the sum of this TuioTime with the provided TuioTime argument
+ */
+ public TuioTime add(TuioTime ttime) {
+ long sec = seconds + ttime.getSeconds();
+ long usec = micro_seconds + ttime.getMicroseconds();
+ sec += usec/1000000;
+ usec = usec%1000000;
+ return new TuioTime(sec,usec);
+ }
+
+ /**
+ * Subtracts the provided time represented in Microseconds from the private Seconds and Microseconds attributes.
+ *
+ * @param us the total time to subtract in Microseconds
+ * @return the subtraction result of this TuioTime minus the provided time in Microseconds
+ */
+ public TuioTime subtract(long us) {
+ long sec = seconds - us/1000000;
+ long usec = micro_seconds - us%1000000;
+
+ if (usec<0) {
+ usec += 1000000;
+ sec--;
+ }
+
+ return new TuioTime(sec,usec);
+ }
+
+ /**
+ * Subtracts the provided TuioTime from the private Seconds and Microseconds attributes.
+ *
+ * @param ttime the TuioTime to subtract
+ * @return the subtraction result of this TuioTime minus the provided TuioTime
+ */
+ public TuioTime subtract(TuioTime ttime) {
+ long sec = seconds - ttime.getSeconds();
+ long usec = micro_seconds - ttime.getMicroseconds();
+
+ if (usec<0) {
+ usec += 1000000;
+ sec--;
+ }
+
+ return new TuioTime(sec,usec);
+ }
+
+ /**
+ * Takes a TuioTime argument and compares the provided TuioTime to the private Seconds and Microseconds attributes.
+ *
+ * @param ttime the TuioTime to compare
+ * @return true if the two TuioTime have equal Seconds and Microseconds attributes
+ */
+ public boolean equals(TuioTime ttime) {
+ if ((seconds==ttime.getSeconds()) && (micro_seconds==ttime.getMicroseconds())) return true;
+ else return false;
+ }
+
+ /**
+ * Resets the seconds and micro_seconds attributes to zero.
+ */
+ public void reset() {
+ seconds = 0;
+ micro_seconds = 0;
+ }
+
+ /**
+ * Returns the TuioTime Seconds component.
+ * @return the TuioTime Seconds component
+ */
+ public long getSeconds() {
+ return seconds;
+ }
+
+ /**
+ * Returns the TuioTime Microseconds component.
+ * @return the TuioTime Microseconds component
+ */
+ public long getMicroseconds() {
+ return micro_seconds;
+ }
+
+ /**
+ * Returns the total TuioTime in Milliseconds.
+ * @return the total TuioTime in Milliseconds
+ */
+ public long getTotalMilliseconds() {
+ return seconds*1000+micro_seconds/1000;
+ }
+
+ /**
+ * This static method globally resets the TUIO session time.
+ */
+ public static void initSession() {
+ TuioTime startTime = getSystemTime();
+ start_seconds = startTime.getSeconds();
+ start_micro_seconds = startTime.getMicroseconds();
+ }
+
+ /**
+ * Returns the present TuioTime representing the time since session start.
+ * @return the present TuioTime representing the time since session start
+ */
+ public static TuioTime getSessionTime() {
+ TuioTime sessionTime = getSystemTime().subtract(getStartTime());
+ return sessionTime;
+
+ }
+
+ /**
+ * Returns the absolut TuioTime representing the session start.
+ * @return the absolut TuioTime representing the session start
+ */
+ public static TuioTime getStartTime() {
+ return new TuioTime(start_seconds,start_micro_seconds);
+ }
+
+ /**
+ * Returns the absolut TuioTime representing the current system time.
+ * @return the absolut TuioTime representing the current system time
+ */
+ public static TuioTime getSystemTime() {
+ long usec = System.nanoTime()/1000;
+ return new TuioTime(usec/1000000,usec%1000000);
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TuioApplet.java
--- a/front_processing/extern/TUIO_JAVA/src/TuioApplet.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TuioApplet.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,4 +1,4 @@
-/*
+/*
TUIO Java Demo - part of the reacTIVision project
http://reactivision.sourceforge.net/
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TuioDemo.java
--- a/front_processing/extern/TUIO_JAVA/src/TuioDemo.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TuioDemo.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,143 +1,142 @@
-/*
- TUIO Java Demo - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import java.util.*;
-import javax.swing.*;
-import TUIO.*;
-
-public class TuioDemo {
-
- private final int window_width = 640;
- private final int window_height = 480;
-
- private boolean fullscreen = false;
-
- private TuioDemoComponent demo;
- private JFrame frame;
- private GraphicsDevice device;
-
- public TuioDemo() {
- demo = new TuioDemoComponent();
- device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
- setupWindow();
- showWindow();
- }
-
- public TuioListener getTuioListener() {
- return demo;
- }
-
- public void setupWindow() {
-
- frame = new JFrame();
- frame.add(demo);
-
- frame.setTitle("TuioDemo");
- frame.setResizable(false);
-
- frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) {
- System.exit(0);
- } });
-
- frame.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent evt) {
- if (evt.getKeyCode()==KeyEvent.VK_ESCAPE) System.exit(0);
- else if (evt.getKeyCode()==KeyEvent.VK_F1) {
- destroyWindow();
- setupWindow();
- fullscreen = !fullscreen;
- showWindow();
- }
- else if (evt.getKeyCode()==KeyEvent.VK_V) demo.verbose=!demo.verbose;
- } });
- }
-
- public void destroyWindow() {
-
- frame.setVisible(false);
- if (fullscreen) {
- device.setFullScreenWindow(null);
- }
- frame = null;
- }
-
- public void showWindow() {
-
- if (fullscreen) {
- int width = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
- int height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
- demo.setSize(width,height);
-
- frame.setSize(width,height);
- frame.setUndecorated(true);
- device.setFullScreenWindow(frame);
- } else {
- int width = window_width;
- int height = window_height;
- demo.setSize(width,height);
-
- frame.pack();
- Insets insets = frame.getInsets();
- frame.setSize(width,height +insets.top);
-
- }
-
- frame.setVisible(true);
- frame.repaint();
-
- }
-
- public static void main(String argv[]) {
-
- TuioDemo demo = new TuioDemo();
- TuioClient client = null;
-
- switch (argv.length) {
- case 1:
- try {
- client = new TuioClient( Integer.parseInt(argv[0]));
- } catch (Exception e) {
- System.out.println("usage: java TuioDemo [port]");
- System.exit(0);
- }
- break;
- case 0:
- client = new TuioClient(80);
- break;
- default:
- System.out.println("usage: java TuioDemo [port]");
- System.exit(0);
- break;
- }
-
- if (client!=null) {
- client.addTuioListener(demo.getTuioListener());
- client.connect();
- } else {
- System.out.println("usage: java TuioDemo [port]");
- System.exit(0);
- }
- }
-
-}
+/*
+ TUIO Java Demo - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.util.*;
+import javax.swing.*;
+import TUIO.*;
+
+public class TuioDemo {
+ private final int window_width = 640;
+ private final int window_height = 480;
+
+ private boolean fullscreen = false;
+
+ private TuioDemoComponent demo;
+ private JFrame frame;
+ private GraphicsDevice device;
+
+ public TuioDemo() {
+ demo = new TuioDemoComponent();
+ device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ setupWindow();
+ showWindow();
+ }
+
+ public TuioListener getTuioListener() {
+ return demo;
+ }
+
+ public void setupWindow() {
+
+ frame = new JFrame();
+ frame.add(demo);
+
+ frame.setTitle("TuioDemo");
+ frame.setResizable(false);
+
+ frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) {
+ System.exit(0);
+ } });
+
+ frame.addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent evt) {
+ if (evt.getKeyCode()==KeyEvent.VK_ESCAPE) System.exit(0);
+ else if (evt.getKeyCode()==KeyEvent.VK_F1) {
+ destroyWindow();
+ setupWindow();
+ fullscreen = !fullscreen;
+ showWindow();
+ }
+ else if (evt.getKeyCode()==KeyEvent.VK_V) demo.verbose=!demo.verbose;
+ } });
+ }
+
+ public void destroyWindow() {
+
+ frame.setVisible(false);
+ if (fullscreen) {
+ device.setFullScreenWindow(null);
+ }
+ frame = null;
+ }
+
+ public void showWindow() {
+
+ if (fullscreen) {
+ int width = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
+ int height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
+ demo.setSize(width,height);
+
+ frame.setSize(width,height);
+ frame.setUndecorated(true);
+ device.setFullScreenWindow(frame);
+ } else {
+ int width = window_width;
+ int height = window_height;
+ demo.setSize(width,height);
+
+ frame.pack();
+ Insets insets = frame.getInsets();
+ frame.setSize(width,height +insets.top);
+
+ }
+
+ frame.setVisible(true);
+ frame.repaint();
+
+ }
+
+ public static void main(String argv[]) {
+
+ TuioDemo demo = new TuioDemo();
+ TuioClient client = null;
+
+ switch (argv.length) {
+ case 1:
+ try {
+ client = new TuioClient( Integer.parseInt(argv[0]));
+ } catch (Exception e) {
+ System.out.println("usage: java TuioDemo [port]");
+ System.exit(0);
+ }
+ break;
+ case 0:
+ client = new TuioClient(80);
+ break;
+ default:
+ System.out.println("usage: java TuioDemo [port]");
+ System.exit(0);
+ break;
+ }
+
+ if (client!=null) {
+ client.addTuioListener(demo.getTuioListener());
+ client.connect();
+ } else {
+ System.out.println("usage: java TuioDemo [port]");
+ System.exit(0);
+ }
+ }
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TuioDemoComponent.java
--- a/front_processing/extern/TUIO_JAVA/src/TuioDemoComponent.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TuioDemoComponent.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,182 +1,182 @@
-/*
- TUIO Java Demo - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-import java.awt.*;
-import java.awt.geom.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import java.util.*;
-import javax.swing.*;
-import TUIO.*;
-
-public class TuioDemoComponent extends JComponent implements TuioListener {
-
- private Hashtable objectList = new Hashtable();
- private Hashtable cursorList = new Hashtable();
- private Hashtable stringList = new Hashtable();
-
- public static final int finger_size = 15;
- public static final int object_size = 60;
- public static final int table_size = 760;
-
- public static int width, height;
- private float scale = 1.0f;
- public boolean verbose = false;
-
- public void setSize(int w, int h) {
- super.setSize(w,h);
- width = w;
- height = h;
- scale = height/(float)TuioDemoComponent.table_size;
- }
-
- public void addTuioObject(TuioObject tobj) {
- TuioDemoObject demo = new TuioDemoObject(tobj);
- objectList.put(tobj.getSessionID(),demo);
-
- if (verbose)
- System.out.println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
- }
-
- public void updateTuioObject(TuioObject tobj) {
-
- TuioDemoObject demo = (TuioDemoObject)objectList.get(tobj.getSessionID());
- demo.update(tobj);
-
- if (verbose)
- System.out.println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
- }
-
- public void removeTuioObject(TuioObject tobj) {
- objectList.remove(tobj.getSessionID());
-
- if (verbose)
- System.out.println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
- }
-
- public void addTuioCursor(TuioCursor tcur) {
-
- if (!cursorList.containsKey(tcur.getSessionID())) {
- cursorList.put(tcur.getSessionID(), tcur);
- repaint();
- }
-
- if (verbose)
- System.out.println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
- }
-
- public void updateTuioCursor(TuioCursor tcur) {
-
- repaint();
-
- if (verbose)
- System.out.println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
- }
-
- public void removeTuioCursor(TuioCursor tcur) {
-
- cursorList.remove(tcur.getSessionID());
- repaint();
-
- if (verbose)
- System.out.println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
- }
-
- public void addTuioString(TuioString tstr) {
-
- if (!stringList.containsKey(tstr.getSessionID())) {
- stringList.put(tstr.getSessionID(), tstr);
- repaint();
- }
-
- if (verbose)
- System.out.println("add str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
- }
-
- public void updateTuioString(TuioString tstr) {
-
- repaint();
-
- if (verbose)
- System.out.println("set str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
- }
-
- public void removeTuioString(TuioString tstr) {
-
- stringList.remove(tstr.getSessionID());
- repaint();
-
- if (verbose)
- System.out.println("del str "+tstr.getStringID()+" ("+tstr.getSessionID()+")");
- }
-
- public void refresh(TuioTime frameTime) {
- repaint();
- }
-
- public void paint(Graphics g) {
- update(g);
- }
-
- public void update(Graphics g) {
-
- Graphics2D g2 = (Graphics2D)g;
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
-
- g2.setColor(Color.white);
- g2.fillRect(0,0,width,height);
-
- int w = (int)Math.round(width-scale*finger_size/2.0f);
- int h = (int)Math.round(height-scale*finger_size/2.0f);
-
- Enumeration cursors = cursorList.elements();
- while (cursors.hasMoreElements()) {
- TuioCursor tcur = cursors.nextElement();
- if (tcur==null) continue;
- Vector path = tcur.getPath();
- TuioPoint current_point = path.elementAt(0);
- if (current_point!=null) {
- // draw the cursor path
- g2.setPaint(Color.blue);
- for (int i=0;i objects = objectList.elements();
- while (objects.hasMoreElements()) {
- TuioDemoObject tobj = objects.nextElement();
- if (tobj!=null) tobj.paint(g2, width,height);
- }
- }
-}
+/*
+ TUIO Java Demo - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.util.*;
+import javax.swing.*;
+import TUIO.*;
+
+public class TuioDemoComponent extends JComponent implements TuioListener {
+
+ private Hashtable objectList = new Hashtable();
+ private Hashtable cursorList = new Hashtable();
+ private Hashtable stringList = new Hashtable();
+
+ public static final int finger_size = 15;
+ public static final int object_size = 60;
+ public static final int table_size = 760;
+
+ public static int width, height;
+ private float scale = 1.0f;
+ public boolean verbose = false;
+
+ public void setSize(int w, int h) {
+ super.setSize(w,h);
+ width = w;
+ height = h;
+ scale = height/(float)TuioDemoComponent.table_size;
+ }
+
+ public void addTuioObject(TuioObject tobj) {
+ TuioDemoObject demo = new TuioDemoObject(tobj);
+ objectList.put(tobj.getSessionID(),demo);
+
+ if (verbose)
+ System.out.println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
+ }
+
+ public void updateTuioObject(TuioObject tobj) {
+
+ TuioDemoObject demo = (TuioDemoObject)objectList.get(tobj.getSessionID());
+ demo.update(tobj);
+
+ if (verbose)
+ System.out.println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
+ }
+
+ public void removeTuioObject(TuioObject tobj) {
+ objectList.remove(tobj.getSessionID());
+
+ if (verbose)
+ System.out.println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
+ }
+
+ public void addTuioCursor(TuioCursor tcur) {
+
+ if (!cursorList.containsKey(tcur.getSessionID())) {
+ cursorList.put(tcur.getSessionID(), tcur);
+ repaint();
+ }
+
+ if (verbose)
+ System.out.println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
+ }
+
+ public void updateTuioCursor(TuioCursor tcur) {
+
+ repaint();
+
+ if (verbose)
+ System.out.println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
+ }
+
+ public void removeTuioCursor(TuioCursor tcur) {
+
+ cursorList.remove(tcur.getSessionID());
+ repaint();
+
+ if (verbose)
+ System.out.println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
+ }
+
+ public void addTuioString(TuioString tstr) {
+
+ if (!stringList.containsKey(tstr.getSessionID())) {
+ stringList.put(tstr.getSessionID(), tstr);
+ repaint();
+ }
+
+ if (verbose)
+ System.out.println("add str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
+ }
+
+ public void updateTuioString(TuioString tstr) {
+
+ repaint();
+
+ if (verbose)
+ System.out.println("set str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
+ }
+
+ public void removeTuioString(TuioString tstr) {
+
+ stringList.remove(tstr.getSessionID());
+ repaint();
+
+ if (verbose)
+ System.out.println("del str "+tstr.getStringID()+" ("+tstr.getSessionID()+")");
+ }
+
+ public void refresh(TuioTime frameTime) {
+ repaint();
+ }
+
+ public void paint(Graphics g) {
+ update(g);
+ }
+
+ public void update(Graphics g) {
+
+ Graphics2D g2 = (Graphics2D)g;
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2.setColor(Color.white);
+ g2.fillRect(0,0,width,height);
+
+ int w = (int)Math.round(width-scale*finger_size/2.0f);
+ int h = (int)Math.round(height-scale*finger_size/2.0f);
+
+ Enumeration cursors = cursorList.elements();
+ while (cursors.hasMoreElements()) {
+ TuioCursor tcur = cursors.nextElement();
+ if (tcur==null) continue;
+ Vector path = tcur.getPath();
+ TuioPoint current_point = path.elementAt(0);
+ if (current_point!=null) {
+ // draw the cursor path
+ g2.setPaint(Color.blue);
+ for (int i=0;i objects = objectList.elements();
+ while (objects.hasMoreElements()) {
+ TuioDemoObject tobj = objects.nextElement();
+ if (tobj!=null) tobj.paint(g2, width,height);
+ }
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TuioDemoObject.java
--- a/front_processing/extern/TUIO_JAVA/src/TuioDemoObject.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TuioDemoObject.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,81 +1,81 @@
-/*
- TUIO Java Demo - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-import javax.swing.*;
-import java.awt.geom.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import TUIO.*;
-
-public class TuioDemoObject extends TuioObject {
-
- private Shape square;
-
- public TuioDemoObject(TuioObject tobj) {
- super(tobj);
- int size = TuioDemoComponent.object_size;
- square = new Rectangle2D.Float(-size/2,-size/2,size,size);
-
- AffineTransform transform = new AffineTransform();
- transform.translate(xpos,ypos);
- transform.rotate(angle,xpos,ypos);
- square = transform.createTransformedShape(square);
- }
-
- public void paint(Graphics2D g, int width, int height) {
-
- float Xpos = xpos*width;
- float Ypos = ypos*height;
- float scale = height/(float)TuioDemoComponent.table_size;
-
- AffineTransform trans = new AffineTransform();
- trans.translate(-xpos,-ypos);
- trans.translate(Xpos,Ypos);
- trans.scale(scale,scale);
- Shape s = trans.createTransformedShape(square);
-
- g.setPaint(Color.black);
- g.fill(s);
- g.setPaint(Color.white);
- g.drawString(symbol_id+"",Xpos-10,Ypos);
- }
-
- public void update(TuioObject tobj) {
-
- float dx = tobj.getX() - xpos;
- float dy = tobj.getY() - ypos;
- float da = tobj.getAngle() - angle;
-
- if ((dx!=0) || (dy!=0)) {
- AffineTransform trans = AffineTransform.getTranslateInstance(dx,dy);
- square = trans.createTransformedShape(square);
- }
-
- if (da!=0) {
- AffineTransform trans = AffineTransform.getRotateInstance(da,tobj.getX(),tobj.getY());
- square = trans.createTransformedShape(square);
- }
-
- super.update(tobj);
- }
-
-}
+/*
+ TUIO Java Demo - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+import javax.swing.*;
+import java.awt.geom.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import TUIO.*;
+
+public class TuioDemoObject extends TuioObject {
+
+ private Shape square;
+
+ public TuioDemoObject(TuioObject tobj) {
+ super(tobj);
+ int size = TuioDemoComponent.object_size;
+ square = new Rectangle2D.Float(-size/2,-size/2,size,size);
+
+ AffineTransform transform = new AffineTransform();
+ transform.translate(xpos,ypos);
+ transform.rotate(angle,xpos,ypos);
+ square = transform.createTransformedShape(square);
+ }
+
+ public void paint(Graphics2D g, int width, int height) {
+
+ float Xpos = xpos*width;
+ float Ypos = ypos*height;
+ float scale = height/(float)TuioDemoComponent.table_size;
+
+ AffineTransform trans = new AffineTransform();
+ trans.translate(-xpos,-ypos);
+ trans.translate(Xpos,Ypos);
+ trans.scale(scale,scale);
+ Shape s = trans.createTransformedShape(square);
+
+ g.setPaint(Color.black);
+ g.fill(s);
+ g.setPaint(Color.white);
+ g.drawString(symbol_id+"",Xpos-10,Ypos);
+ }
+
+ public void update(TuioObject tobj) {
+
+ float dx = tobj.getX() - xpos;
+ float dy = tobj.getY() - ypos;
+ float da = tobj.getAngle() - angle;
+
+ if ((dx!=0) || (dy!=0)) {
+ AffineTransform trans = AffineTransform.getTranslateInstance(dx,dy);
+ square = trans.createTransformedShape(square);
+ }
+
+ if (da!=0) {
+ AffineTransform trans = AffineTransform.getRotateInstance(da,tobj.getX(),tobj.getY());
+ square = trans.createTransformedShape(square);
+ }
+
+ super.update(tobj);
+ }
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/TuioDump.java
--- a/front_processing/extern/TUIO_JAVA/src/TuioDump.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/TuioDump.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,86 +1,86 @@
-/*
- TUIO Java Example - part of the reacTIVision project
- http://reactivision.sourceforge.net/
-
- Copyright (c) 2005-2009 Martin Kaltenbrunner
-
- This program is free software;you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation;either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY;without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program;if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-import javax.swing.*;
-import java.awt.geom.*;
-import java.awt.*;
-import java.awt.event.*;
-import TUIO.*;
-
-public class TuioDump implements TuioListener {
-
- public void addTuioObject(TuioObject tobj) {
- System.out.println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
- }
-
- public void updateTuioObject(TuioObject tobj) {
- System.out.println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
- }
-
- public void removeTuioObject(TuioObject tobj) {
- System.out.println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
- }
-
- public void addTuioCursor(TuioCursor tcur) {
- System.out.println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
- }
-
- public void updateTuioCursor(TuioCursor tcur) {
- System.out.println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
- }
-
- public void removeTuioCursor(TuioCursor tcur) {
- System.out.println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
- }
-
- public void addTuioString(TuioString tstr) {
- System.out.println("add str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
- }
-
- public void updateTuioString(TuioString tstr) {
- System.out.println("set str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
- }
-
- public void removeTuioString(TuioString tstr) {
- System.out.println("del str "+tstr.getStringID()+" ("+tstr.getSessionID()+")");
- }
-
- public void refresh(TuioTime frameTime) {
- //System.out.println("refresh "+frameTime.getTotalMilliseconds());
- }
-
- public static void main(String argv[]) {
-
- int port = 3333;
-
- if (argv.length==1) {
- try { port = Integer.parseInt(argv[0]); }
- catch (Exception e) { System.out.println("usage: java TuioDump [port]"); }
- }
-
- TuioDump demo = new TuioDump();
- TuioClient client = new TuioClient(port);
-
- System.out.println("listening to TUIO messages at port "+port);
- client.addTuioListener(demo);
- client.connect();
- }
-}
+/*
+ TUIO Java Example - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner
+
+ This program is free software;you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation;either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY;without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program;if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+import javax.swing.*;
+import java.awt.geom.*;
+import java.awt.*;
+import java.awt.event.*;
+import TUIO.*;
+
+public class TuioDump implements TuioListener {
+
+ public void addTuioObject(TuioObject tobj) {
+ System.out.println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
+ }
+
+ public void updateTuioObject(TuioObject tobj) {
+ System.out.println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
+ }
+
+ public void removeTuioObject(TuioObject tobj) {
+ System.out.println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
+ }
+
+ public void addTuioCursor(TuioCursor tcur) {
+ System.out.println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
+ }
+
+ public void updateTuioCursor(TuioCursor tcur) {
+ System.out.println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
+ }
+
+ public void removeTuioCursor(TuioCursor tcur) {
+ System.out.println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
+ }
+
+ public void addTuioString(TuioString tstr) {
+ System.out.println("add str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
+ }
+
+ public void updateTuioString(TuioString tstr) {
+ System.out.println("set str "+tstr.getStringID()+" ("+tstr.getSessionID()+") "+tstr.getMessage());
+ }
+
+ public void removeTuioString(TuioString tstr) {
+ System.out.println("del str "+tstr.getStringID()+" ("+tstr.getSessionID()+")");
+ }
+
+ public void refresh(TuioTime frameTime) {
+ //System.out.println("refresh "+frameTime.getTotalMilliseconds());
+ }
+
+ public static void main(String argv[]) {
+
+ int port = 3333;
+
+ if (argv.length==1) {
+ try { port = Integer.parseInt(argv[0]); }
+ catch (Exception e) { System.out.println("usage: java TuioDump [port]"); }
+ }
+
+ TuioDump demo = new TuioDump();
+ TuioClient client = new TuioClient(port);
+
+ System.out.println("listening to TUIO messages at port "+port);
+ client.addTuioListener(demo);
+ client.connect();
+ }
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCBundle.java
--- a/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCBundle.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCBundle.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,140 +1,140 @@
-
-/**
- * @author cramakrishnan
- *
- * Copyright (C) 2003, C. Ramakrishnan / Illposed Software
- * All rights reserved.
- *
- * See license.txt (or license.rtf) for license information.
- *
- *
- * OscBundle represents a collection of OscPackets.
- *
- * Use this when you want to send a bunch of OscPackets
- * in one go.
- *
- * Internally, I use Vector to maintain jdk1.1 compatability
- */
-
-package com.illposed.osc;
-import java.math.BigInteger;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.GregorianCalendar;
-import java.util.Vector;
-
-import com.illposed.osc.utility.*;
-
-public class OSCBundle extends OSCPacket {
-
- protected Date timestamp;
- // protected OSCPacket[] packets;
- protected Vector packets;
- public static final BigInteger SECONDS_FROM_1900_to_1970 =
- new BigInteger("2208988800");
- // 17 leap years
-
- /**
- * Create a new OSCBundle, with a timestamp of now.
- * You can add packets to the bundle with addPacket()
- */
- public OSCBundle() {
- this(null, GregorianCalendar.getInstance().getTime());
- }
-
- /**
- * Create an OSCBundle with the specified timestamp
- * @param timestamp
- */
- public OSCBundle(Date timestamp) {
- this(null, timestamp);
- }
-
- /**
- * @param newPackets Array of OSCPackets to initialize this object with
- */
- public OSCBundle(OSCPacket[] newPackets) {
- this(newPackets, GregorianCalendar.getInstance().getTime());
- }
-
- /**
- * @param newPackets OscPacket[]
- * @param time java.lang.Time
- */
- public OSCBundle(OSCPacket[] newPackets, Date newTimestamp) {
- super();
- if (null != newPackets) {
- packets = new Vector(newPackets.length);
- for (int i = 0; i < newPackets.length; i++) {
- packets.add(newPackets[i]);
- }
- } else
- packets = new Vector();
- timestamp = newTimestamp;
- init();
- }
-
- /**
- * Return the timestamp for this bundle
- * @return a Date
- */
- public Date getTimestamp() {
- return timestamp;
- }
-
- /**
- * Set the timestamp for this bundle
- * @param timestamp
- */
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- /**
- * Add a packet to the list of packets in this bundle
- * @param packet
- */
- public void addPacket(OSCPacket packet) {
- packets.add(packet);
- }
-
- /**
- * Get the packets contained in this bundle
- * @return an array of packets
- */
- public OSCPacket[] getPackets() {
- OSCPacket[] packetArray = new OSCPacket[packets.size()];
- packets.toArray(packetArray);
- return packetArray;
- }
-
- protected void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream) {
- long millisecs = timestamp.getTime();
- long secsSince1970 = (long) (millisecs / 1000);
- long secs = secsSince1970 + SECONDS_FROM_1900_to_1970.longValue();
- long picosecs = (long) (millisecs - (secsSince1970 * 1000)) * 1000;
-
- stream.write((int) secs);
- stream.write((int) picosecs);
-
- }
-
- /**
- * @param stream OscPacketByteArrayConverter
- */
- protected void computeByteArray(OSCJavaToByteArrayConverter stream) {
- stream.write("#bundle");
- computeTimeTagByteArray(stream);
- Enumeration enm = packets.elements();
- OSCPacket nextElement;
- byte[] packetBytes;
- while (enm.hasMoreElements()) {
- nextElement = (OSCPacket) enm.nextElement();
- packetBytes = nextElement.getByteArray();
- stream.write(packetBytes.length);
- stream.write(packetBytes);
- }
- byteArray = stream.toByteArray();
- }
-
+
+/**
+ * @author cramakrishnan
+ *
+ * Copyright (C) 2003, C. Ramakrishnan / Illposed Software
+ * All rights reserved.
+ *
+ * See license.txt (or license.rtf) for license information.
+ *
+ *
+ * OscBundle represents a collection of OscPackets.
+ *
+ * Use this when you want to send a bunch of OscPackets
+ * in one go.
+ *
+ * Internally, I use Vector to maintain jdk1.1 compatability
+ */
+
+package com.illposed.osc;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.GregorianCalendar;
+import java.util.Vector;
+
+import com.illposed.osc.utility.*;
+
+public class OSCBundle extends OSCPacket {
+
+ protected Date timestamp;
+ // protected OSCPacket[] packets;
+ protected Vector packets;
+ public static final BigInteger SECONDS_FROM_1900_to_1970 =
+ new BigInteger("2208988800");
+ // 17 leap years
+
+ /**
+ * Create a new OSCBundle, with a timestamp of now.
+ * You can add packets to the bundle with addPacket()
+ */
+ public OSCBundle() {
+ this(null, GregorianCalendar.getInstance().getTime());
+ }
+
+ /**
+ * Create an OSCBundle with the specified timestamp
+ * @param timestamp
+ */
+ public OSCBundle(Date timestamp) {
+ this(null, timestamp);
+ }
+
+ /**
+ * @param newPackets Array of OSCPackets to initialize this object with
+ */
+ public OSCBundle(OSCPacket[] newPackets) {
+ this(newPackets, GregorianCalendar.getInstance().getTime());
+ }
+
+ /**
+ * @param newPackets OscPacket[]
+ * @param time java.lang.Time
+ */
+ public OSCBundle(OSCPacket[] newPackets, Date newTimestamp) {
+ super();
+ if (null != newPackets) {
+ packets = new Vector(newPackets.length);
+ for (int i = 0; i < newPackets.length; i++) {
+ packets.add(newPackets[i]);
+ }
+ } else
+ packets = new Vector();
+ timestamp = newTimestamp;
+ init();
+ }
+
+ /**
+ * Return the timestamp for this bundle
+ * @return a Date
+ */
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Set the timestamp for this bundle
+ * @param timestamp
+ */
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ /**
+ * Add a packet to the list of packets in this bundle
+ * @param packet
+ */
+ public void addPacket(OSCPacket packet) {
+ packets.add(packet);
+ }
+
+ /**
+ * Get the packets contained in this bundle
+ * @return an array of packets
+ */
+ public OSCPacket[] getPackets() {
+ OSCPacket[] packetArray = new OSCPacket[packets.size()];
+ packets.toArray(packetArray);
+ return packetArray;
+ }
+
+ protected void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream) {
+ long millisecs = timestamp.getTime();
+ long secsSince1970 = (long) (millisecs / 1000);
+ long secs = secsSince1970 + SECONDS_FROM_1900_to_1970.longValue();
+ long picosecs = (long) (millisecs - (secsSince1970 * 1000)) * 1000;
+
+ stream.write((int) secs);
+ stream.write((int) picosecs);
+
+ }
+
+ /**
+ * @param stream OscPacketByteArrayConverter
+ */
+ protected void computeByteArray(OSCJavaToByteArrayConverter stream) {
+ stream.write("#bundle");
+ computeTimeTagByteArray(stream);
+ Enumeration enm = packets.elements();
+ OSCPacket nextElement;
+ byte[] packetBytes;
+ while (enm.hasMoreElements()) {
+ nextElement = (OSCPacket) enm.nextElement();
+ packetBytes = nextElement.getByteArray();
+ stream.write(packetBytes.length);
+ stream.write(packetBytes);
+ }
+ byteArray = stream.toByteArray();
+ }
+
}
\ No newline at end of file
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCCanNotListenException.java
--- a/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCCanNotListenException.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCCanNotListenException.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,49 +1,49 @@
-/* $Id: OSCCanNotListenException.java,v 1.1.1.1 2006/11/13 14:47:21 modin Exp $
- * Created on 21.02.2004
- */
-package com.illposed.osc;
-
-/**
- * @author cramakrishnan
- *
- * Copyright (C) 2004, C. Ramakrishnan / Auracle
- * All rights reserved.
- *
- * See license.txt (or license.rtf) for license information.
- */
-public class OSCCanNotListenException extends Exception {
-
- /**
- *
- */
- public OSCCanNotListenException() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- */
- public OSCCanNotListenException(String message) {
- super(message);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param message
- * @param cause
- */
-/* public OSCCanNotListenException(String message, Throwable cause) {
- super(message, cause);
- // TODO Auto-generated constructor stub
- }
-*/
- /**
- * @param cause
- */
-/* public OSCCanNotListenException(Throwable cause) {
- super(cause);
- // TODO Auto-generated constructor stub
- }
-*/
-}
+/* $Id: OSCCanNotListenException.java,v 1.1.1.1 2006/11/13 14:47:21 modin Exp $
+ * Created on 21.02.2004
+ */
+package com.illposed.osc;
+
+/**
+ * @author cramakrishnan
+ *
+ * Copyright (C) 2004, C. Ramakrishnan / Auracle
+ * All rights reserved.
+ *
+ * See license.txt (or license.rtf) for license information.
+ */
+public class OSCCanNotListenException extends Exception {
+
+ /**
+ *
+ */
+ public OSCCanNotListenException() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param message
+ */
+ public OSCCanNotListenException(String message) {
+ super(message);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+/* public OSCCanNotListenException(String message, Throwable cause) {
+ super(message, cause);
+ // TODO Auto-generated constructor stub
+ }
+*/
+ /**
+ * @param cause
+ */
+/* public OSCCanNotListenException(Throwable cause) {
+ super(cause);
+ // TODO Auto-generated constructor stub
+ }
+*/
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCListener.java
--- a/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCListener.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCListener.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,27 +1,27 @@
-/* $Id: OSCListener.java,v 1.1.1.1 2006/11/13 14:47:21 modin Exp $
- * Created on 28.10.2003
- */
-package com.illposed.osc;
-
-import java.util.Date;
-
-/**
- * @author cramakrishnan
- *
- * Copyright (C) 2003, C. Ramakrishnan / Auracle
- * All rights reserved.
- *
- * See license.txt (or license.rtf) for license information.
- *
- * Interface for things that listen for incoming OSC Messages
- */
-public interface OSCListener {
-
- /**
- * Accept an incoming OSCMessage
- * @param time the time this message is to be executed. null means execute now
- * @param message the message
- */
- public void acceptMessage(Date time, OSCMessage message);
-
-}
+/* $Id: OSCListener.java,v 1.1.1.1 2006/11/13 14:47:21 modin Exp $
+ * Created on 28.10.2003
+ */
+package com.illposed.osc;
+
+import java.util.Date;
+
+/**
+ * @author cramakrishnan
+ *
+ * Copyright (C) 2003, C. Ramakrishnan / Auracle
+ * All rights reserved.
+ *
+ * See license.txt (or license.rtf) for license information.
+ *
+ * Interface for things that listen for incoming OSC Messages
+ */
+public interface OSCListener {
+
+ /**
+ * Accept an incoming OSCMessage
+ * @param time the time this message is to be executed. null means execute now
+ * @param message the message
+ */
+ public void acceptMessage(Date time, OSCMessage message);
+
+}
diff -r 0f44b7360c8d -r 925b7ee746e3 front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCMessage.java
--- a/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCMessage.java Thu Mar 22 18:15:53 2012 +0100
+++ b/front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCMessage.java Fri Mar 23 16:24:36 2012 +0100
@@ -1,118 +1,118 @@
-/**
- * @author cramakrishnan
- *
- * Copyright (C) 2003, C. Ramakrishnan / Illposed Software
- * All rights reserved.
- *
- * See license.txt (or license.rtf) for license information.
- *
- *
- * An simple (non-bundle) OSC message. An OSC message is made up of
- * an address (who is this message sent to)
- * and arguments (what is the contents of this message).
- */
-
-package com.illposed.osc;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.illposed.osc.utility.*;
-
-public class OSCMessage extends OSCPacket {
-
- protected String address;
- protected Vector