Commit 89539d3d authored by Eric Tobias's avatar Eric Tobias
Browse files

Major code review to prepare for merging intern's dev branch into regular dev branch.

~ Changed preference files to use the correct null check in Eclipse.
+ Removed code from the neverfear namespace as it was integrated rather than use a library. This required the removal of some tests. These should be reintegrated when the project was moved to maven and the library containing that namespace can be integrated correctly.
~ Changed some naming in the properties file.
+ Corrected some errors while doing code review.
+ Refactored some of the adapter code related to drops, lift, and updates to centralized code and reduce redundancy.
~ Preparing for a review of the drawing mechanism. Hence, changed some names in the Corona class and it's Image child.
parent e73bfd50
......@@ -9,11 +9,11 @@ org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=dbc.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=dbc.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=dbc.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
......
......@@ -20,8 +20,8 @@ centred = false
# Properties for the calibration of the object manager
#The value below is best left at or above 1024
cursorIDRemappingConstant = 1024
cursor.id.remapping.constant = 1024
# Add the property "tableAdapter" with the adapter to load
# Syntax is : tableAdapter = packageName.ClassName
# i.e : tableAdapter = lu.list.itis.dkd.tui.adapter.TuioAdapter
\ No newline at end of file
# The low-level computer vision (or similar) adapter to load.
# Syntax is : adapter.class = packageName.ClassName
adapter.class = lu.list.itis.dkd.tui.adapter.TuioAdapter
\ No newline at end of file
......@@ -105,33 +105,28 @@ public abstract class TangibleApplication {
interfaceManager = new TangibleInterfaceManager(this, logger, properties);
try {
adapter = (TuiAdapter) Class.forName(properties.getProperty("tableAdapter")).getConstructor(TangibleInterfaceManager.class).newInstance(interfaceManager); //$NON-NLS-1$
adapter = (TuiAdapter) Class.forName(properties.getProperty("adapter.class")).getConstructor(TangibleInterfaceManager.class).newInstance(interfaceManager); //$NON-NLS-1$
} catch (InstantiationException e) {
logger.log(Level.SEVERE, "Cannot instantiate adapter. You try to instantiate an abstract class or an interface!"); //$NON-NLS-1$s
logger.log(Level.SEVERE, "Cannot instantiate adapter. The adapter must be a concrete class, not an interface or abstract class and it must directly inherit from TuiAdapter! Check your properties file and set adapter.class accordingly."); //$NON-NLS-1$s
System.exit(42);
} catch (IllegalAccessException e) {
logger.log(Level.SEVERE, "The currently executing method does not have access to the definition of the constructor."); //$NON-NLS-1$
System.exit(42);
} catch (IllegalArgumentException e) {
logger.log(Level.SEVERE, "A wrong argument has been passed to the adapter."); //$NON-NLS-1$
logger.log(Level.SEVERE, "A erroneous argument has been passed to the adapter."); //$NON-NLS-1$
System.exit(42);
} catch (InvocationTargetException e) {
logger.log(Level.SEVERE, "An exception has been thrown in the constructor of the adapter"); //$NON-NLS-1$
logger.log(Level.SEVERE, "An exception has been thrown in the constructor of the adapter."); //$NON-NLS-1$
System.exit(42);
} catch (NoSuchMethodException e) {
logger.log(Level.SEVERE, "The called method was not found"); //$NON-NLS-1$
logger.log(Level.SEVERE, "The called method was not found. Make sure your implementation supports the method."); //$NON-NLS-1$
System.exit(42);
} catch (SecurityException e) {
logger.log(Level.SEVERE, "Security violation"); //$NON-NLS-1$
logger.log(Level.SEVERE, "Security violation."); //$NON-NLS-1$
System.exit(42);
} catch (ClassNotFoundException e) {
logger.log(Level.SEVERE, "The class " + properties.getProperty("tableAdapter") + " was not found. Check the spelling !"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
logger.log(Level.SEVERE, "The class " + properties.getProperty("adapter.class") + " was not found. Check your spelling!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
System.exit(42);
}
......
......@@ -40,8 +40,9 @@ import java.util.logging.Logger;
* locks to synchronise all calls to manage objects.
*
* @author Eric TOBIAS [eric.tobias@list.lu]
* @author Nicolas Gilmard
* @since 1.0
* @version 1.0.2
* @version 2.0.2
*/
@NonNullByDefault
public abstract class TangibleObjectManager {
......@@ -85,7 +86,7 @@ public abstract class TangibleObjectManager {
* widgets to use by implementing this method. <b>By default, no widgets are instantiated</b>.<br>
* <br>
*
* When adding Widgets to map to cursors, refer to {@link IDMapper#remapCursorID(int)}. Cursor
* When adding Widgets to map to cursors, refer to {@link IDMapper#remapCursorId(int)}. Cursor
* IDs are remapped as not to clash with any symbol ID assigned by reacTIVision. A good practice
* is to reason with regular cursor IDs and add them to the map by calling for example:
* <code>objectList.put(remapCursorID(0), W extends BaseWidget);</code> to the first cursor that
......@@ -172,7 +173,6 @@ public abstract class TangibleObjectManager {
cursorList.get(tangibleObject.getObjectId()).actionDrop(tangibleObject);
ensureConsistency();
break;
case OBJECT:
......@@ -184,11 +184,12 @@ public abstract class TangibleObjectManager {
break;
case BLOB:
// TODO This line add a small shadow with each blob. This behaviour might not be
// desired but needs to be investigated. Opening issue #27.
blobList.putIfAbsent(tangibleObject.getObjectId(), new BaseWidgetBuilder().withCorona(tangibleObject.getObjectId(), new ShadowBuilder(new Point()).withShape(ShapeFactory.buildCircle(5)).build()).build());
blobList.get(tangibleObject.getObjectId()).actionDrop(tangibleObject);
ensureConsistency();
break;
default:
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
......@@ -224,6 +225,7 @@ public abstract class TangibleObjectManager {
if (blobList.containsKey(tangibleObject.getObjectId())) {
blobList.remove(tangibleObject.getObjectId()).actionLift(tangibleObject);
}
break;
default:
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
......@@ -261,6 +263,7 @@ public abstract class TangibleObjectManager {
} else {
logger.log(Level.WARNING, "The blob could not be recognised!"); //$NON-NLS-1$
}
break;
default:
logger.log(Level.WARNING, "The recognised symbol was not assigned to a widget!"); //$NON-NLS-1$
break;
......
......@@ -17,6 +17,7 @@ import lu.list.itis.dkd.tui.TangibleApplication;
import lu.list.itis.dkd.tui.utility.Point;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import lu.tudor.ssi.kiss.dbc.annotation.Nullable;
import java.util.ArrayList;
import java.util.logging.Level;
......@@ -79,7 +80,10 @@ public class TangibleObject {
/** The rotation acceleration value. */
protected float rotationAccel;
/** A Vector of {@link Point} containing all the previous positions of the tangible object. */
/**
* An {@link ArrayList} of {@link Point} containing all the previous positions of the tangible
* object.
*/
protected ArrayList<Point> path;
/** Reflects the current state of the {@link TangibleObject} */
......@@ -94,6 +98,7 @@ public class TangibleObject {
this.identifier = identifier;
}
@Nullable
static State getState(int id) {
switch (id) {
case 0:
......@@ -110,10 +115,8 @@ public class TangibleObject {
return State.ROTATING;
default:
logger.log(Level.WARNING, "Unrecognised state identifier!"); //$NON-NLS-1$
break;
return null;
}
return null;
}
/**
......@@ -137,9 +140,10 @@ public class TangibleObject {
/**
* Default constructor
* Default constructor.
*
* @param tangibleObjectBuilder
* The builder holding the values from which to instantiate this object.
*
*/
public TangibleObject(TangibleObjectBuilder tangibleObjectBuilder) {
......@@ -474,4 +478,4 @@ public class TangibleObject {
public void setArea(float area) {
this.area = area;
}
}
}
\ No newline at end of file
......@@ -22,15 +22,13 @@ import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import java.util.ArrayList;
/**
* REFACTORED Method names should be refactored due to them not being additions as suggested. Use
* the "with" naming style such as "withMotionAcceleration".
*
* {@link TangibleObjectBuilder} class used to construct a {@link TangibleObject} by providing
* methods to set all parameters.
*
* @author Nicolas GILMARD [nicolas.gilmard@list.lu]
* @since 2.0
* @version 2.0.1
* @version 2.0.2
*/
@NonNullByDefault
@SuppressWarnings("hiding")
......@@ -87,8 +85,9 @@ public class TangibleObjectBuilder {
* Constructor setting the required fields of a tangibleObject
*
* @param objectId
* The id of the tangibleObject
* The id of the tangible object.
* @param type
* The {@link Type} of the tangible object.
* @param x
* The X coordinate
* @param y
......@@ -271,8 +270,9 @@ public class TangibleObjectBuilder {
* Method for building a {@link TangibleObject} with the values set by the builder.
*
* @return An instance of {@link TangibleObject} as by the values issued to the builder.
* @pre objectId and path != null
* @pre path contains at least one point
* @pre objectId != <code>null</code>
* @pre path != <code>null</code>
* @pre path != empty
*/
public TangibleObject build() {
return new TangibleObject(this);
......
......@@ -20,15 +20,18 @@ import lu.list.itis.dkd.tui.logging.EventLogger;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
/**
* Abstract class managing interaction with a tangible table using a typical protocol.
*
* @author Nicolas GILMARD [nicolas.gilmard@list.lu]
* @author Nicolas GILMARD
* @author Eric TOBIAS [eric.tobias@list.lu]
* @since 2.0
* @version 2.0.1
* @version 2.0.2
*/
@NonNullByDefault
public abstract class TuiAdapter {
......@@ -101,7 +104,7 @@ public abstract class TuiAdapter {
* Method returning the {@link TangibleObject} (cursor) with the given id
*
* @param id
* of the cursor to get
* The ID of the cursor to get.
*
* @return The {@link TangibleObject} with objectId = id.
*/
......@@ -111,7 +114,7 @@ public abstract class TuiAdapter {
* Method returning the {@link TangibleObject} (object) with the given id
*
* @param id
* of the object to get
* The ID of the object to get.
*
* @return The {@link TangibleObject} with objectId = id.
*/
......@@ -121,46 +124,35 @@ public abstract class TuiAdapter {
* Method returning the {@link TangibleObject} (blob) with the given id
*
* @param id
* of the blob to get
* The ID of the blob to get.
*
* @return The {@link TangibleObject} with objectId = id.
*/
public abstract TangibleObject getBlob(long id);
/**
* create a string representation of a tangible object to the logging mechanism
*
* @param tangibleObject
* is the concerned object.
* @param operation
* is the move done.
*/
public synchronized void addObjInfo(TangibleObject tangibleObject, String operation) {
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
}
/**
* create a string representation of a tangible object to the logging mechanism
*
* @param tangibleObject
* is the concerned cursor.
* @param operation
* is the move done.
*/
public synchronized void addCurInfo(TangibleObject tangibleObject, String operation) {
EventLogger.getInstance().addCurInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), operation, tangibleObject.getTotalMilliseconds());
}
/**
* create a string representation of a tangible object to the logging mechanism
* Method called to log all available information of a {@link TangibleObject}.
*
* @param tangibleObject
* is the concerned blob.
* The cursor for which to log the info for.
* @param operation
* is the move done.
* The operation to register.
*/
public synchronized void addBlobInfo(TangibleObject tangibleObject, String operation) {
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
public synchronized void logInfo(TangibleObject tangibleObject, String operation) {
switch (tangibleObject.getType()) {
case BLOB:
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
break;
case CURSOR:
EventLogger.getInstance().addCurInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), operation, tangibleObject.getTotalMilliseconds());
break;
case OBJECT:
EventLogger.getInstance().addObjInfo(tangibleObject.getObjectId(), tangibleObject.getX(), tangibleObject.getY(), tangibleObject.getAngle(), operation, tangibleObject.getTotalMilliseconds());
break;
default:
Logger.getLogger(TuiAdapter.class.getSimpleName()).log(Level.WARNING, "A logging attempt was made for a tangible object that did not conform to any prescribed type. The type was:" + tangibleObject.getType()); //$NON-NLS-1$
break;
}
}
}
}
\ No newline at end of file
......@@ -21,7 +21,6 @@ import lu.list.itis.dkd.tui.utility.IDMapper;
import lu.list.itis.dkd.tui.utility.Point;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import lu.tudor.ssi.kiss.dbc.annotation.Nullable;
import TUIO.TuioBlob;
import TUIO.TuioClient;
......@@ -40,9 +39,10 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* Adapter class managing interaction with reacTIVision tangible table using TUIO protocol.
*
* @author Nicolas GILMARD [nicolas.gilmard@list.lu]
* @author Nicolas GILMARD
* @author Eric TOBIAS [eric.tobias@list.lu]
* @since 2.0
* @version 2.0.2
* @version 2.0.3
*/
@NonNullByDefault
public class TuioAdapter extends TuiAdapter implements TuioListener {
......@@ -66,6 +66,7 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
*
* @param interfaceManager
* The {@link TangibleInterfaceManager} display.
* @pre interfaceManager != <code>null</code>
*/
public TuioAdapter(TangibleInterfaceManager interfaceManager) {
super(interfaceManager);
......@@ -76,9 +77,11 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
*
* @param objectManager
* The value to set objectManager to.
* @pre objectManager != <code>null</code>
*/
@Override
public void setObjectManager(TangibleObjectManager objectManager) {
Preconditions.checkArgument(objectManager != null, "The passed object manager cannot be null!"); //$NON-NLS-1$
this.objectManager = objectManager;
}
......@@ -88,7 +91,6 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
* @return The value of objectManager.
*/
@Override
@Nullable
public TangibleObjectManager getObjectManager() {
return objectManager;
}
......@@ -97,7 +99,10 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
* Method used to connect the application to the NUI device sending out events for the listener
* to capture.
*
* @pre objectManager != null
* @pre objectManager != <code>null</code>
* @pre interfaceManager != <code>null</code>
* @post client.getTuioListeners().includes(this)
* @post client.isConnexted() == <code>true</code>
*/
@Override
public void connect() {
......@@ -114,26 +119,28 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
*/
@Override
public void disconnect() {
client.removeAllTuioListeners();
client.removeTuioListener(this);
client.disconnect();
}
/**
* Convert a TUIO object into a tangibleObject
* Convert a {@link TuioObject} into a {@link TangibleObject}.
*
* @param tuioObject
* @pre tangibleObject != null
* @return tangibleObject with TuioObject values
* The {@link TuioObject} to convert.
* @pre tuioObject != <code>null</code>
* @return The converted {@link TuioObject} as a {@link TangibleObject}.
*/
private TangibleObject convertTuioObjectToTangibleObject(TuioObject tuioObject) {
Preconditions.checkArgument(tuioObject != null, "The passed tangible cursor cannot be null!"); //$NON-NLS-1$
// get the object if present
TangibleObject updateObject = tangibleObjectList.get(tuioObject.getSymbolID());
TangibleObject convertedTangibleObject;
if (updateObject == null) {
// if the object is not present simply convert the tuioPath
ArrayList<Point> tempPath = new ArrayList<>();
tuioObject.getPath().forEach(path -> tempPath.add(new Point(path.getX(), path.getY(), tuioObject.getAngle())));
convertedTangibleObject = new TangibleObjectBuilder(tuioObject.getSymbolID(), Type.OBJECT, tuioObject.getPath().get(tuioObject.getPath().size() - 1).getX(), tuioObject.getPath().get(tuioObject.getPath().size() - 1).getY())
.withSeconds(tuioObject.getTuioTime().getSeconds())
.withMicroSeconds(tuioObject.getTuioTime().getMicroseconds())
......@@ -153,6 +160,7 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
tempPath = updateObject.getPath();
int index = tuioObject.getPath().size() - 1;
tempPath.add(new Point(tuioObject.getPath().get(index).getX(), tuioObject.getPath().get(index).getY(), tuioObject.getAngle()));
convertedTangibleObject = new TangibleObjectBuilder(tuioObject.getSymbolID(), Type.OBJECT, tuioObject.getPath().get(tuioObject.getPath().size() - 1).getX(), tuioObject.getPath().get(tuioObject.getPath().size() - 1).getY())
.withSeconds(tuioObject.getTuioTime().getSeconds())
.withMicroSeconds(tuioObject.getTuioTime().getMicroseconds())
......@@ -166,25 +174,26 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
.withState(tuioObject.getTuioState())
.build();
}
return convertedTangibleObject;
}
/**
* Convert a TUIO cursor into a tangibleObject
* Convert a {@link TuioCursor} into a {@link TangibleObject}.
*
* @param tuioCursor
* != null
* @pre tangibleCursor != null
* @return tangibleObject with TuioCursor's values
* The {@link TuioCursor} to convert.
* @pre tuioCursor != <code>null</code>
* @return The converted {@link TuioCursor} as a {@link TangibleObject}.
*/
private TangibleObject convertTuioCursorToTangibleObject(TuioCursor tuioCursor) {
Preconditions.checkArgument(tuioCursor != null, "The passed tangible cursor cannot be null!"); //$NON-NLS-1$
// TODO There should be a check whether the cursor already exists and take it from there if
// it does.
ArrayList<Point> tempPath = new ArrayList<>();
tuioCursor.getPath().forEach(path -> tempPath.add(new Point(path.getX(), path.getY(), 0)));
TangibleObject convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorID(tuioCursor.getCursorID()), Type.CURSOR, tuioCursor.getPath().get(tuioCursor.getPath().size() - 1).getX(), tuioCursor.getPath().get(tuioCursor.getPath().size() - 1).getY())
TangibleObject convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorId(tuioCursor.getCursorID()), Type.CURSOR, tuioCursor.getPath().get(tuioCursor.getPath().size() - 1).getX(), tuioCursor.getPath().get(tuioCursor.getPath().size() - 1).getY())
.withSeconds(tuioCursor.getTuioTime().getSeconds())
.withMicroSeconds(tuioCursor.getTuioTime().getMicroseconds())
.withxSpeed(tuioCursor.getXSpeed())
......@@ -199,23 +208,35 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
}
/**
* Convert a TUIO cursor into a tangibleObject
* Convert a {@link TuioBlob} into a {@link TangibleObject}.
*
* @param tuioCursor
* != null
* @pre tangibleCursor != null
* @return tangibleObject with TuioCursor's values
* @param tuioBlob
* The {@link TuioBlob} to convert.
* @pre tuioBlob != <code>null</code>
* @return The converted {@link TuioBlob} as a {@link TangibleObject}.
*/
private TangibleObject convertTuioBlobToTangibleObject(TuioBlob tuioBlob) {
Preconditions.checkArgument(tuioBlob != null, "The passed tangible blob cannot be null!"); //$NON-NLS-1$
// get the object if present
// Get the object if present
TangibleObject updateObject = tangibleObjectList.get(tuioBlob.getBlobID());
TangibleObject convertedTangibleObject;
if (updateObject == null) {
// if the object is not present simply convert the tuioPath
ArrayList<Point> tempPath = new ArrayList<>();
tuioBlob.getPath().forEach(path -> tempPath.add(new Point(path.getX(), path.getY(), tuioBlob.getAngle())));
convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorID(tuioBlob.getBlobID()), Type.BLOB, tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getX(), tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getY()).withSeconds(tuioBlob.getTuioTime().getSeconds()).withMicroSeconds(tuioBlob.getTuioTime().getMicroseconds()).withxSpeed(tuioBlob.getXSpeed()).withySpeed(tuioBlob.getYSpeed()).withMotionSpeed(tuioBlob.getMotionSpeed()).withMotionAccel(tuioBlob.getMotionAccel()).withRotationSpeed(tuioBlob.getRotationSpeed()).withRotationAccel(tuioBlob.getRotationAccel()).withPath(tempPath).withState(tuioBlob.getTuioState()).build();
convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorId(tuioBlob.getBlobID()), Type.BLOB, tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getX(), tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getY())
.withSeconds(tuioBlob.getTuioTime().getSeconds())
.withMicroSeconds(tuioBlob.getTuioTime().getMicroseconds())
.withxSpeed(tuioBlob.getXSpeed())
.withySpeed(tuioBlob.getYSpeed())
.withMotionSpeed(tuioBlob.getMotionSpeed())
.withMotionAccel(tuioBlob.getMotionAccel())
.withRotationSpeed(tuioBlob.getRotationSpeed())
.withRotationAccel(tuioBlob.getRotationAccel())
.withPath(tempPath)
.withState(tuioBlob.getTuioState())
.build();
} else {
// if the object is present in the list, get previous path and add the last point
......@@ -223,56 +244,73 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
tempPath = updateObject.getPath();
int index = tuioBlob.getPath().size() - 1;
tempPath.add(new Point(tuioBlob.getPath().get(index).getX(), tuioBlob.getPath().get(index).getY(), tuioBlob.getAngle()));
convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorID(tuioBlob.getBlobID()), Type.BLOB, tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getX(), tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getY()).withSeconds(tuioBlob.getTuioTime().getSeconds()).withMicroSeconds(tuioBlob.getTuioTime().getMicroseconds()).withxSpeed(tuioBlob.getXSpeed()).withySpeed(tuioBlob.getYSpeed()).withMotionSpeed(tuioBlob.getMotionSpeed()).withMotionAccel(tuioBlob.getMotionAccel()).withRotationSpeed(tuioBlob.getRotationSpeed()).withRotationAccel(tuioBlob.getRotationAccel()).withPath(tempPath).withState(tuioBlob.getTuioState()).build();
}
convertedTangibleObject = new TangibleObjectBuilder(IDMapper.remapCursorId(tuioBlob.getBlobID()), Type.BLOB, tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getX(), tuioBlob.getPath().get(tuioBlob.getPath().size() - 1).getY())
.withSeconds(tuioBlob.getTuioTime().getSeconds())
.withMicroSeconds(tuioBlob.getTuioTime().getMicroseconds())
.withxSpeed(tuioBlob.getXSpeed())
.withySpeed(tuioBlob.getYSpeed())
.withMotionSpeed(tuioBlob.getMotionSpeed())
.withMotionAccel(tuioBlob.getMotionAccel())
.withRotationSpeed(tuioBlob.getRotationSpeed())
.withRotationAccel(tuioBlob.getRotationAccel())
.withPath(tempPath)
.withState(tuioBlob.getTuioState())
.build();
}
return convertedTangibleObject;
}
/**
* {@inheritDoc} It will output several notices to the {@link EventLogger} before issuing a call
* to the {@link TangibleObjectManager} which drop mapped handle.
* {@inheritDoc}
*
* It will output several notices to the {@link EventLogger} before issuing a call to the
* {@link TangibleObjectManager} which drop mapped handle.
*
* @pre tuioCursor != <code>null</code>
*/
@Override
public synchronized void addTuioCursor(TuioCursor tangibleCursor) {
Preconditions.checkArgument(tangibleCursor != null, "The passed tangible cursor cannot be null!"); //$NON-NLS-1$
TangibleObject convertedTangibleObject = convertTuioCursorToTangibleObject(tangibleCursor);
super.addCurInfo(convertedTangibleObject, "down"); //$NON-NLS-1$
public synchronized void addTuioCursor(TuioCursor tuioCursor) {
Preconditions.checkArgument(tuioCursor != null, "The passed TUIO cursor cannot be null!"); //$NON-NLS-1$
objectManager.dropObject(convertedTangibleObject);
addTangibleObject(convertTuioCursorToTangibleObject(tuioCursor));
}
/**
* {@inheritDoc} It will output several notices to the {@link EventLogger} before issuing a call
* to the {@link TangibleObjectManager} which drop mapped handle.
* {@inheritDoc}
*
* It will output several notices to the {@link EventLogger} before issuing a call to the
* {@link TangibleObjectManager} which drop mapped handle.
*
* @pre tuiObject != <code>null</code>
*/
@Override
public synchronized void addTuioObject(TuioObject tangibleObject) {
Preconditions.checkArgument(tangibleObject != null, "The passed tangible object cannot be null!"); //$NON-NLS-1$
TangibleObject convertedTangibleObject = convertTuioObjectToTangibleObject(tangibleObject);
tangibleObjectList.put(convertedTangibleObject.getObjectId(), convertedTangibleObject);
super.addObjInfo(convertedTangibleObject, "down"); //$NON-NLS-1$
objectManager.dropObject(convertedTangibleObject);
public synchronized void addTuioObject(TuioObject tuiObject) {
Preconditions.checkArgument(tuiObject != null, "The passed TUIO object cannot be null!"); //$NON-NLS-1$
addTangibleObject(convertTuioObjectToTangibleObject(tuiObject));
}
/** {@inheritDoc} */
@Override
public void addTuioBlob(TuioBlob tangibleObject) {
Preconditions.checkArgument(tangibleObject != null, "The passed tangible blob cannot be null!"); //$NON-NLS-1$
public void addTuioBlob(TuioBlob tuioBlob) {
Preconditions.checkArgument(tuioBlob != null, "The passed TUIO blob cannot be null!"); //$NON-NLS-1$
TangibleObject convertedTangibleObject = convertTuioBlobToTangibleObject(tangibleObject);
tangibleObjectList.put(convertedTangibleObject.getObjectId(), convertedTangibleObject);