--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/front_processing/extern/TUIO_JAVA/src/TuioDemoObject.java Fri Mar 09 14:52:11 2012 +0100
@@ -0,0 +1,81 @@
+/*
+ TUIO Java Demo - part of the reacTIVision project
+ http://reactivision.sourceforge.net/
+
+ Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu>
+
+ 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);
+ }
+
+}