View Javadoc

1   /**
2    * 
3    */
4   package org.ximtec.igesture.io.tuio;
5   
6   import java.awt.Color;
7   import java.awt.Dimension;
8   import java.util.Hashtable;
9   import java.util.List;
10  import java.util.Set;
11  
12  import javax.swing.BorderFactory;
13  
14  import org.sigtec.ink.Note;
15  import org.sigtec.ink.Point;
16  import org.sigtec.ink.Trace;
17  import org.sigtec.util.Constant;
18  import org.ximtec.igesture.Recogniser;
19  import org.ximtec.igesture.core.Gesture;
20  import org.ximtec.igesture.core.GestureSample;
21  import org.ximtec.igesture.core.GestureSample3D;
22  import org.ximtec.igesture.io.AbstractGestureDevice;
23  import org.ximtec.igesture.io.Gesture3DDevice;
24  import org.ximtec.igesture.io.tuio.interfaces.AbstractTuioCursor;
25  import org.ximtec.igesture.io.tuio.interfaces.AbstractTuioObject;
26  import org.ximtec.igesture.io.tuio.tuio2D.TuioCursor;
27  import org.ximtec.igesture.io.tuio.tuio2D.TuioObject;
28  import org.ximtec.igesture.io.tuio.tuio3D.TuioCursor3D;
29  import org.ximtec.igesture.io.tuio.tuio3D.TuioObject3D;
30  import org.ximtec.igesture.util.additions3d.AccelerationSample;
31  import org.ximtec.igesture.util.additions3d.Accelerations;
32  import org.ximtec.igesture.util.additions3d.Point3D;
33  import org.ximtec.igesture.util.additions3d.RecordedGesture3D;
34  
35  /**
36   * Reader that initializes the TuioConnection and handles the events caused by the TuioConnection. There are three ways to use the TuioReader.
37   * 1) Manually
38   * After performing the gesture, you can get the gesture with getGesture() or getGesture3D() and do the recognition.
39   * 2) GestureEventListener interface
40   * Register with the TuioReader as a GestureEventListener, it will notify you when a gesture was performed. The recognition of the performed
41   * gesture can then be done.
42   * 3) Configure the TuioReader with a Recogniser
43   * When a gesture was performed, the recogniser will automatically try to recognise the gesture and notify GestureHandlers.
44   *  
45   * General steps to use:
46   * 	1. create the TuioReader
47   * 	2. connect to a tuio service
48   *  3. In case of GestureEventListener : register as a listener
49   *     In case of Recogniser : set this TuioReaders recogniser
50   *  4. set the modifiers/tuio messages to listen for
51   *  
52   *  Note that this class is not fully compatible with the workbench.
53   *  
54   * @author Bjorn Puype, bpuype@gmail.com
55   * @see TuioConnection
56   */
57  public class TuioReader extends AbstractGestureDevice<Note,Point> implements TuioListener, Gesture3DDevice<RecordedGesture3D, Point3D>{
58  
59  	
60  	//*******************************************************************************************************************
61  	//	DO NOT USE WITH THE WORKBENCH!!!!!!!!!!!!!!!
62  	//*******************************************************************************************************************
63  	
64  	/** List of Notes (2D gestures) */
65  	private Hashtable<Long,Note> notes = new Hashtable<Long,Note>();
66  	/** List of RecordedGesture3D (3D gestures) */
67  	private Hashtable<Long,RecordedGesture3D> gestures = new Hashtable<Long,RecordedGesture3D>();
68  	
69  	/** List of AbstractTuioObject */
70  	private Hashtable<Long,AbstractTuioObject> objectList = new Hashtable<Long,AbstractTuioObject>();
71  	/** List of AbstractTuioCursor */
72  	private Hashtable<Long,AbstractTuioCursor> cursorList = new Hashtable<Long,AbstractTuioCursor>();
73  	
74  	/** TUIO Connection used */
75  	protected TuioConnection connection;
76  	
77  	/** Recogniser to recognise the gestures */
78  	private Recogniser recogniser;
79  	
80  	private boolean debug = true;
81  	
82  	protected GestureSample gesture;
83  	protected Note lastNoteAdded;
84  	protected GestureSample3D gesture3D;
85  	protected RecordedGesture3D lastRecordedGesture3DAdded;
86  	
87  	/**
88  	 * Default Constructor
89  	 * @param recogniser Recogniser to use.
90  	 */
91  	public TuioReader()
92  	{
93  		this(TuioConstants.DEFAULT_PORT);
94  	}
95  	
96  	/**
97  	 * Constructor
98  	 * @param port	Port to listen to.
99  	 */
100 	public TuioReader(int port)
101 	{
102 		//customize TuioProcessor with portnumber
103 		// 			more than one tuioserver can connect and send information
104 	
105 		connection = new TuioConnection(port);
106 		
107 		setDeviceID(String.valueOf(port));
108 		setConnectionType(org.ximtec.igesture.util.Constant.CONNECTION_TUIO);
109 //		setDeviceType("2D_3D");
110 		setName("Tuio Service on Port "+port);
111 		
112 		//MODIFIED >
113 		lastNoteAdded = new Note();
114 		gesture = new GestureSample(this,"", lastNoteAdded);
115 		
116 		lastRecordedGesture3DAdded = new RecordedGesture3D();
117 		gesture3D = new GestureSample3D(this,"", lastRecordedGesture3DAdded);
118 		//MODIFIED <
119 	}
120 	
121 	/**
122 	 * Set the recogniser to use.
123 	 * @param recogniser	Recogniser to use.
124 	 */
125 	public void setRecogniser(Recogniser recogniser)
126 	{
127 		this.recogniser = recogniser;
128 	}
129 	
130 	private void debug(String message)
131 	{
132 		if(debug)
133 			System.out.println("[TUIO]: "+message);
134 	}
135 	
136 	/* (non-Javadoc)
137 	 * @see org.ximtec.igesture.io.AbstractGestureDevice#connect()
138 	 */
139 	@Override
140 	public void connect() {
141 		connection.connect();
142 		setIsConnected(connection.isConnected());
143 	}
144 
145 	/* (non-Javadoc)
146 	 * @see org.ximtec.igesture.io.AbstractGestureDevice#disconnect()
147 	 */
148 	@Override
149 	public void disconnect() {
150 		connection.disconnect();
151 		setIsConnected(connection.isConnected());
152 	}
153 
154 	/* (non-Javadoc)
155 	 * @see org.ximtec.igesture.io.GestureDevice#clear()
156 	 */
157 	@Override
158 	public void clear() {
159 		lastNoteAdded = new Note();
160 		lastRecordedGesture3DAdded = new RecordedGesture3D();
161 	}
162 
163 	/* (non-Javadoc)
164 	 * @see org.ximtec.igesture.io.GestureDevice#dispose()
165 	 */
166 	@Override
167 	public void dispose() {
168 		removeAllListener();
169 		clear();
170 	}
171 
172 	/* (non-Javadoc)
173 	 * @see org.ximtec.igesture.io.GestureDevice#getChunks()
174 	 */
175 	@Override
176 	public List<Point> getChunks() {
177 		return null;
178 	}
179 	
180 	/* (non-Javadoc)
181 	 * @see org.ximtec.igesture.io.Gesture3DDevice#getChunks3D()
182 	 */
183 	@Override
184 	public List<Point3D> getChunks3D() {
185 		return null;
186 	}
187 
188 	/* (non-Javadoc)
189 	 * @see org.ximtec.igesture.io.GestureDevice#getGesture()
190 	 */
191 	@Override
192 	public Gesture<Note> getGesture() {
193 		return new GestureSample(this,gesture.getName(),lastNoteAdded);
194 	}
195 
196 	/* (non-Javadoc)
197 	 * @see org.ximtec.igesture.io.Gesture3DDevice#getGesture3D()
198 	 */
199 	@Override
200 	public Gesture<RecordedGesture3D> getGesture3D()
201 	{
202 		return new GestureSample3D(this,gesture3D.getName(),lastRecordedGesture3DAdded);
203 	}
204 	
205 	/* (non-Javadoc)
206 	 * @see org.ximtec.igesture.io.GestureDevice#init()
207 	 */
208 	@Override
209 	public void init() {	
210 	}
211 	
212 	/**
213 	 * Set-up the processor to listen for and act on messages of the desired profiles.
214 	 * @param	modifiers	the desired TUIO profiles	
215 	 */
216 	public void addTuioMessages(Set<String> modifiers) {
217 		connection.addTuioListener(this, modifiers);
218 	}
219 	
220 	/**
221 	 * Stop the processor of listening for and act on messages of the desired profiles.
222 	 * @param	modifiers	the desired TUIO profiles
223 	 */
224 	public void removeTuioMessages(Set<String> modifiers) {
225 		connection.removeTuioListener(this, modifiers);
226 	}
227 	
228 	/**
229 	 * Create a AccelerationSample
230 	 * @param xs	X speed
231 	 * @param ys	Y speed
232 	 * @param zs	Z speed
233 	 * @param ms	motion speed
234 	 * @param macc	motion acceleration
235 	 * @param time	timestamp
236 	 * @return
237 	 */
238 	private AccelerationSample createAccelerationSample(double xs, double ys, double zs, double ms, double macc, long time)
239 	{
240 		double dt = ms/macc;
241 		AccelerationSample sample = new AccelerationSample(xs/dt,ys/dt,zs/dt,time);
242 		return sample;
243 	}
244 
245 	/* (non-Javadoc)
246 	 * @see org.ximtec.tuio.TuioListener#addTuioCursor(org.ximtec.tuio.interfaces.AbstractTuioCursor)
247 	 */
248 	@Override
249 	public void addTuioCursor(AbstractTuioCursor atcur) {
250 		if(atcur instanceof TuioCursor)
251 		{
252 			TuioCursor tcur = (TuioCursor)atcur;
253 			if (!cursorList.containsKey(tcur.getSessionID())) {
254 				cursorList.put(tcur.getSessionID(), tcur);
255 				
256 				//TODO
257 				//calculate timestamp
258 				long time = tcur.getTuioTime().add(tcur.getStartTime()).getTotalMilliseconds();
259 				
260 				//create new note and add first point to it
261 				Note note = new Note();
262 				Trace trace = new Trace();
263 				Point point = new Point(tcur.getX(),tcur.getY(),time);
264 				trace.add(point);
265 				note.add(trace);
266 				//save note
267 				notes.put(tcur.getSessionID(), note);
268 			}	 
269 			debug("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
270 		}
271 		else if(atcur instanceof TuioCursor3D)
272 		{
273 			TuioCursor3D tcur = (TuioCursor3D)atcur;
274 			if (!cursorList.containsKey(tcur.getSessionID())) 
275 			{
276 				cursorList.put(tcur.getSessionID(), tcur);
277 				
278 				//TODO
279 				//calculate timestamp
280 				long time = tcur.getTuioTime().add(tcur.getStartTime()).getTotalMilliseconds();
281 				//OR
282 				//long time = tcur.getTuioTime().getTotalMilliseconds();
283 				
284 				//create new recordedgesture3D and add first point to it
285 				RecordedGesture3D gesture = new RecordedGesture3D();
286 				Point3D point = new Point3D(tcur.getX(),tcur.getY(),tcur.getZ(),time);
287 				gesture.add(point);
288 				
289 				//create accelerations and an acceleration sample
290 				Accelerations accelerations = new Accelerations();
291 				AccelerationSample sample = createAccelerationSample(tcur.getXSpeed(),tcur.getYSpeed(),tcur.getZSpeed(),tcur.getMotionSpeed(),tcur.getMotionSpeed(),time);
292 				//add sample to accelerations
293 				accelerations.addSample(sample);
294 				//set the gesture accelerations
295 				gesture.setAccelerations(accelerations);
296 				//save recordedgesture3D
297 				gestures.put(tcur.getSessionID(), gesture);
298 			}	 
299 			debug("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getZ());
300 		}
301 	}
302 
303 	/* (non-Javadoc)
304 	 * @see org.ximtec.tuio.TuioListener#addTuioObject(org.ximtec.tuio.interfaces.AbstractTuioObject)
305 	 */
306 	@Override
307 	public void addTuioObject(AbstractTuioObject atobj) {
308 		if(atobj instanceof TuioObject)
309 		{
310 			TuioObject tobj = (TuioObject)atobj;
311 			if(!objectList.containsKey(tobj.getSessionID()))
312 			{
313 				objectList.put(tobj.getSessionID(),tobj);
314 				
315 				//TODO
316 				//calculate timestamp
317 				long time = tobj.getTuioTime().add(tobj.getStartTime()).getTotalMilliseconds();
318 				
319 				//create new note and add first point to it
320 				Note note = new Note();
321 				Trace trace = new Trace();
322 				Point point = new Point(tobj.getX(),tobj.getY(),time);
323 				trace.add(point);
324 				note.add(trace);
325 				//save note
326 				notes.put(tobj.getSessionID(), note);
327 			}
328 			debug("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
329 		}
330 		else if(atobj instanceof TuioObject3D)
331 		{
332 			TuioObject3D tobj = (TuioObject3D)atobj;
333 			if(!objectList.containsKey(tobj.getSessionID()))
334 			{
335 				objectList.put(tobj.getSessionID(),tobj);
336 				
337 				//TODO
338 				//calculate timestamp
339 				long time = tobj.getTuioTime().add(tobj.getStartTime()).getTotalMilliseconds();
340 				
341 				//create new recordedgesture3D and add first point to it
342 				RecordedGesture3D gesture = new RecordedGesture3D();
343 				Point3D point = new Point3D(tobj.getX(),tobj.getY(),tobj.getZ(),time);
344 				gesture.add(point);
345 				//create accelerations and an acceleration sample
346 				Accelerations accelerations = new Accelerations();
347 				AccelerationSample sample = createAccelerationSample(tobj.getXSpeed(),tobj.getYSpeed(),tobj.getZSpeed(),tobj.getMotionSpeed(),tobj.getMotionAccel(),time);
348 				//add sample to accelerations
349 				accelerations.addSample(sample);
350 				//set the gesture accelerations
351 				gesture.setAccelerations(accelerations);
352 				//save recordedgesture3D
353 				gestures.put(tobj.getSessionID(), gesture);
354 
355 			}
356 			debug("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getZ());
357 		}
358 	}
359 
360 	/* (non-Javadoc)
361 	 * @see org.ximtec.tuio.TuioListener#refresh(org.ximtec.tuio.TuioTime)
362 	 */
363 	@Override
364 	public void refresh(TuioTime ftime) {	
365 	}
366 
367 	/* (non-Javadoc)
368 	 * @see org.ximtec.tuio.TuioListener#removeTuioCursor(org.ximtec.tuio.interfaces.AbstractTuioCursor)
369 	 */
370 	@Override
371 	public void removeTuioCursor(AbstractTuioCursor atcur) {
372 		if(atcur instanceof TuioCursor)
373 		{
374 			TuioCursor tcur = (TuioCursor)atcur;
375 			cursorList.remove(tcur.getSessionID());	
376 			
377 			lastNoteAdded = notes.get(tcur.getSessionID());
378 			fireGestureEvent(getGesture());
379 			if(recogniser != null)
380 			{	
381 				//process note by recognizing it and notifying listeners		
382 				recogniser.recognise(lastNoteAdded);
383 						//recogniser automatically performs fireEvent which warns 
384 						//gestureHandlers of new performed gestures
385 			}
386 			
387 			//remove note from the list
388 			notes.remove(tcur.getSessionID());
389 			
390 			debug("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")"); 
391 		}
392 		else if(atcur instanceof TuioCursor3D)
393 		{
394 			TuioCursor3D tcur = (TuioCursor3D)atcur;
395 			cursorList.remove(tcur.getSessionID());	
396 			
397 			lastRecordedGesture3DAdded = gestures.get(tcur.getSessionID());
398 			fireGestureEvent(gesture3D);
399 			if(recogniser != null)
400 			{
401 				//process recordedGesture3D by recognizing it and notifying listeners
402 				recogniser.recognise(new GestureSample3D(this,Constant.EMPTY_STRING, lastRecordedGesture3DAdded),false);
403 						//recogniser automatically performs fireEvent which warns 
404 						//gestureHandlers of new performed gestures
405 			}
406 			
407 			//remove note from the list
408 			gestures.remove(tcur.getSessionID());
409 
410 			debug("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
411 		}
412 	}
413 
414 	/* (non-Javadoc)
415 	 * @see org.ximtec.tuio.TuioListener#removeTuioObject(org.ximtec.tuio.interfaces.AbstractTuioObject)
416 	 */
417 	@Override
418 	public void removeTuioObject(AbstractTuioObject atobj) {
419 		if(atobj instanceof TuioObject)
420 		{
421 			TuioObject tobj = (TuioObject)atobj;
422 			objectList.remove(tobj.getSessionID());
423 			
424 			Note note = notes.get(tobj.getSessionID());
425 			Trace trace = note.get(0);
426 			
427 			//if the trace contains more than one point, then the object was used to perform a gesture
428 			//otherwise not, so no recognition is needed
429 			if(trace.size() > 1)
430 			{
431 				lastNoteAdded = note;
432 				fireGestureEvent(getGesture());
433 				if(recogniser != null)
434 				{
435 					//process note by recognizing it and notifying listeners		
436 					recogniser.recognise(notes.get(tobj.getSessionID()));
437 							//recogniser automatically performs fireEvent which warns 
438 							//gestureHandlers of new performed gestures
439 				}
440 			}
441 			//remove note from the list
442 			notes.remove(tobj.getSessionID());
443 			
444 			debug("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
445 		}
446 		else if(atobj instanceof TuioObject3D)
447 		{
448 			TuioObject3D tobj = (TuioObject3D)atobj;
449 			objectList.remove(tobj.getSessionID());	
450 			
451 			RecordedGesture3D record = gestures.get(tobj.getSessionID());
452 			//if the recorded gesture contains more than one point3D, then the object was used to perform a gesture
453 			//otherwise not, so no recognition is TuioCursor tcur = (TuioCursor)atcur;needed.
454 			if(record.size() > 1)
455 			{
456 				lastRecordedGesture3DAdded = record;
457 				fireGestureEvent(getGesture3D());
458 				if(recogniser != null)
459 				{
460 					//process recordedGesture3D by recognizing it and notifying listeners
461 					recogniser.recognise(new GestureSample3D(this,Constant.EMPTY_STRING, gestures.get(tobj.getSessionID())),false);
462 							//recogniser automatically performs fireEvent which warns 
463 							//gestureHandlers of new performed gestures
464 				}
465 			}
466 			//remove note from the list
467 			gestures.remove(tobj.getSessionID());
468 			
469 			debug("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
470 		}		
471 	}
472 
473 	/* (non-Javadoc)
474 	 * @see org.ximtec.tuio.TuioListener#updateTuioCursor(org.ximtec.tuio.interfaces.AbstractTuioCursor)
475 	 */
476 	@Override
477 	public void updateTuioCursor(AbstractTuioCursor atcur) {
478 		if(atcur instanceof TuioCursor)
479 		{
480 			TuioCursor tcur = (TuioCursor)atcur;
481 			if(notes.containsKey(tcur.getSessionID()))
482 			{
483 				//TODO
484 				//calculate timestamp
485 				long time = tcur.getTuioTime().add(tcur.getStartTime()).getTotalMilliseconds();
486 				
487 				//add new point to the corresponding note
488 				Point p = new Point(tcur.getX(),tcur.getY(),time);
489 				Note note = notes.get(tcur.getSessionID());
490 				note.get(0).add(p);
491 				
492 				//DEBUG
493 				TuioCursor demo = (TuioCursor)cursorList.get(tcur.getSessionID());
494 				demo.update(tcur);
495 			}
496 			debug("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
497 		}
498 		else if(atcur instanceof TuioCursor3D)
499 		{
500 			TuioCursor3D tcur = (TuioCursor3D)atcur;
501 			if(gestures.containsKey(tcur.getSessionID()))
502 			{
503 				//TODO
504 				//calculate timestamp
505 				long time = tcur.getTuioTime().add(tcur.getStartTime()).getTotalMilliseconds();
506 				
507 				//add new point to the corresponding recordedgesture3D
508 				Point3D p = new Point3D(tcur.getX(),tcur.getY(),tcur.getZ(),time);
509 				RecordedGesture3D gesture = gestures.get(tcur.getSessionID());
510 				gesture.add(p);
511 				//add new acceleration sample to the recordedgesture3D's accelerations
512 				AccelerationSample sample = createAccelerationSample(tcur.getXSpeed(),tcur.getYSpeed(),tcur.getZSpeed(),tcur.getMotionSpeed(),tcur.getMotionAccel(),time);
513 				//add sample to accelerations
514 				Accelerations accelerations = gesture.getAccelerations(); 
515 				accelerations.addSample(sample);
516 				
517 				//DEBUG
518 				TuioCursor3D demo = (TuioCursor3D)cursorList.get(tcur.getSessionID());
519 				demo.update(tcur);
520 			}	
521 			debug("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
522 		}
523 	}
524 
525 	/* (non-Javadoc)
526 	 * @see org.ximtec.tuio.TuioListener#updateTuioObject(org.ximtec.tuio.interfaces.AbstractTuioObject)
527 	 */
528 	@Override
529 	public void updateTuioObject(AbstractTuioObject atobj) {
530 		if(atobj instanceof TuioObject)
531 		{
532 			TuioObject tobj = (TuioObject)atobj;
533 			if(notes.containsKey(tobj.getSessionID()))
534 			{
535 				//TODO
536 				//calculate timestamp
537 				long time = tobj.getTuioTime().add(tobj.getStartTime()).getTotalMilliseconds();
538 				
539 				//add new point to the corresponding note
540 				Point p = new Point(tobj.getX(),tobj.getY(),time);
541 				Note note = notes.get(tobj.getSessionID());
542 				note.get(0).add(p);
543 				
544 				//DEBUG
545 				TuioObject demo = (TuioObject)objectList.get(tobj.getSessionID());
546 				demo.update(tobj);
547 			}
548 			debug("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
549 		}
550 		else if(atobj instanceof TuioObject3D)
551 		{
552 			TuioObject3D tobj = (TuioObject3D)atobj;
553 			if(gestures.containsKey(tobj.getSessionID()))
554 			{
555 				//TODO
556 				//calculate timestamp
557 				long time = tobj.getTuioTime().add(tobj.getStartTime()).getTotalMilliseconds();
558 				
559 				//add new point to the corresponding recordedgesture3D
560 				Point3D p = new Point3D(tobj.getX(),tobj.getY(),tobj.getZ(),time);
561 				RecordedGesture3D gesture = gestures.get(tobj.getSessionID());
562 				gesture.add(p);
563 				//add new acceleration sample to the recordedgesture3D's accelerations
564 				AccelerationSample sample = createAccelerationSample(tobj.getXSpeed(),tobj.getYSpeed(),tobj.getZSpeed(),tobj.getMotionSpeed(),tobj.getMotionAccel(),time);
565 				//add sample to accelerations
566 				Accelerations accelerations = gesture.getAccelerations(); 
567 				accelerations.addSample(sample);
568 				
569 				//DEBUG
570 				TuioObject3D demo = (TuioObject3D)objectList.get(tobj.getSessionID());
571 				demo.update(tobj);
572 			}
573 			debug("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getZ());
574 		}
575 	}
576 	
577 	public TuioReaderPanel getPanel()
578 	{
579 		return getPanel(new Dimension(200,200));
580 	}
581 	
582 	public TuioReaderPanel getPanel(Dimension dimension)
583 	{
584 		TuioReaderPanel panel = new TuioReaderPanel();
585 		panel.setSize(dimension);
586 		panel.setPreferredSize(dimension);
587 		panel.setOpaque(true);
588 		panel.setBackground(Color.WHITE);
589 		panel.setBorder(BorderFactory.createLineBorder(Color.BLUE));
590 		return panel;
591 	}
592 
593 }