Package org.jmol.multitouch.sparshui
Class TwoPointGesture
- java.lang.Object
-
- org.jmol.multitouch.sparshui.TwoPointGesture
-
- All Implemented Interfaces:
com.sparshui.gestures.Gesture
public class TwoPointGesture extends java.lang.Object implements com.sparshui.gestures.Gesture
TWO_POINT_GESTURE This gesture requires two points of contact, but its type is not initially defined. Instead, its type is determined on-the-fly to be one of ZOOM, ROTATE, or 2-point DRAG based on the direction of motion and relative positions of the starting points. Two traces are obtained, assuming nothing about the ID of the incoming points from the input device but instead operating from position on the screen. v00 from pt(1,0) to pt(2,0) ZOOM IN: <---- x -----> (at any angle) ZOOM OUT: ----> x <----- (at any angle) ROTATE CW: ^ | | x | (at any angle, not implemented) | V ROTATE CCW: | ^ | x | (at any angle, not implemented) V | 2-point drag: ---------> x (any direction) ---------> Bob Hanson 12/13/2009
-
-
Field Summary
Fields Modifier and Type Field Description private int
_id1
private int
_id2
private int
_myType
private int
_nTraces
protected com.sparshui.common.Location
_offset
protected com.sparshui.common.Location
_offsetCentroid
private float
_rotation
private float
_scale
private java.util.List<com.sparshui.common.Location>
_traces1
private java.util.List<com.sparshui.common.Location>
_traces2
private long
time
-
Constructor Summary
Constructors Constructor Description TwoPointGesture()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkType()
int
getGestureType()
Get the integer value of this gesture type.java.lang.String
getName()
Get the name of this gesture.protected java.util.List<com.sparshui.common.Event>
processBirth(com.sparshui.server.TouchPoint touchPoint)
java.util.List<com.sparshui.common.Event>
processChange(java.util.List<com.sparshui.server.TouchPoint> touchPoints, com.sparshui.server.TouchPoint changedPoint)
Process a touch point change in the gesture.private java.util.List<com.sparshui.common.Event>
processChangeSync(com.sparshui.server.TouchPoint changedPoint)
protected java.util.List<com.sparshui.common.Event>
processDeath(com.sparshui.server.TouchPoint touchPoint)
protected java.util.List<com.sparshui.common.Event>
processMove(com.sparshui.server.TouchPoint touchPoint)
private boolean
updateLocations(com.sparshui.server.TouchPoint touchPoint)
private boolean
updateParameters()
-
-
-
Field Detail
-
_myType
private int _myType
-
_offset
protected com.sparshui.common.Location _offset
-
_offsetCentroid
protected com.sparshui.common.Location _offsetCentroid
-
_traces1
private java.util.List<com.sparshui.common.Location> _traces1
-
_traces2
private java.util.List<com.sparshui.common.Location> _traces2
-
_id1
private int _id1
-
_id2
private int _id2
-
_nTraces
private int _nTraces
-
_scale
private float _scale
-
_rotation
private float _rotation
-
time
private long time
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:com.sparshui.gestures.Gesture
Get the name of this gesture.- Specified by:
getName
in interfacecom.sparshui.gestures.Gesture
- Returns:
- The name of this gesture.
-
getGestureType
public int getGestureType()
Description copied from interface:com.sparshui.gestures.Gesture
Get the integer value of this gesture type. Gesture values are defined in GestureType.java.- Specified by:
getGestureType
in interfacecom.sparshui.gestures.Gesture
- Returns:
- The gesture type.
-
processChange
public java.util.List<com.sparshui.common.Event> processChange(java.util.List<com.sparshui.server.TouchPoint> touchPoints, com.sparshui.server.TouchPoint changedPoint)
Description copied from interface:com.sparshui.gestures.Gesture
Process a touch point change in the gesture.- Specified by:
processChange
in interfacecom.sparshui.gestures.Gesture
- Parameters:
touchPoints
- The list of touch points that currently belong to this gesture.changedPoint
- The touch point that has changed.- Returns:
- An ArrayList of events that will be delivered to the client.
-
processChangeSync
private java.util.List<com.sparshui.common.Event> processChangeSync(com.sparshui.server.TouchPoint changedPoint)
-
processBirth
protected java.util.List<com.sparshui.common.Event> processBirth(com.sparshui.server.TouchPoint touchPoint)
-
processDeath
protected java.util.List<com.sparshui.common.Event> processDeath(com.sparshui.server.TouchPoint touchPoint)
-
processMove
protected java.util.List<com.sparshui.common.Event> processMove(com.sparshui.server.TouchPoint touchPoint)
-
updateLocations
private boolean updateLocations(com.sparshui.server.TouchPoint touchPoint)
-
checkType
private void checkType()
-
updateParameters
private boolean updateParameters()
-
-