Class SoTouchEvent
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.events.SoEvent
-
- com.openinventor.inventor.touch.events.SoTouchEvent
-
public class SoTouchEvent extends SoEvent
Base class for touch events.SoTouchEvent
is the base class for touch events in the Open Inventor event model. A touch event typically represents a user finger action on a touch screen input device, such as putting a finger down on the screen.SoTouchEvent
is anSoEvent
with touch information including the displacement and speed of the finger and the state (UP, DOWN or MOVE).The
SoTouchEvent.getTouchManager()
method can be use to retrieve the corresponding touch device currently used and information about other fingers touching the screen at the same time.Open Inventor also supports gesture events (see
SoGestureEvent
) such as pinch and rotate. Gesture events are generated by gesture recognizers (seeSoGestureRecognizer
) which analyze a series of touch events.Note: Unlike mouse and keyboard events, the application must explicitly register a touch screen device (
SoWinTouchScreen
,SoQtTouchScreen
, etc) in order to get touch events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoTouchEvent.States
The different states a touch event can have.-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoTouchEvent()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SbVec2f
getAcceleration()
Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.SbVec2f
getDisplacement()
Gets the deplacement vector (in pixels) between the previous event and the current one.SbTime
getElapsedTimeSincePreviousEvent()
Gets the elapsed time since previous event, triggered by the same finger, in seconds.SbTime
getElapsedTimeUntilPreviousEvent()
Gets the elapsed time between the first contact and previous event, for the finger identified bygetFingerId()
, in seconds.long
getFingerId()
Gets the id of the finger triggering this event.SbTime
getFirstContactTime()
Gets the time of first contact in seconds of the finger identified bygetFingerId()
.SbVec2f
getFirstPosition()
Gets the first position (in pixels).SbTime
getPreviousEventTime()
Gets the time of previous event of the finger identified bygetFingerId()
.SbVec2f
getPreviousPosition()
Gets the previous position of the same finger (in pixels).SbVec2f
getPreviousSpeed()
Gets the previous speed (in pixels per second).SbVec2f
getSpeed()
Gets the speed (in pixels per second) between the previous event and the current one.SoTouchEvent.States
getState()
Gets the touch event state (Up, Down, Move or Unknown).SoTouchManager
getTouchManager()
Gets the corresponding TouchManager for this event.void
setFingerId(long idFinger)
Sets the id of the finger triggering this event.void
setFirstPosition(SbVec2f name_24139)
Sets the first position (in pixels).void
setPreviousSpeed()
Sets the previous speed in pixels per second.void
setState(SoTouchEvent.States b)
Sets the state of the touch event.void
setTouchManager(SoTouchManager manager)
Sets the TouchManager for this event.-
Methods inherited from class com.openinventor.inventor.events.SoEvent
getNormalizedPosition, getPosition, getPosition, getPositionFloat, getPositionFloat, getTime, setAltDown, setButton1Down, setCtrlDown, setPosition, setPosition, setShiftDown, setTime, wasAltDown, wasButton1Down, wasCtrlDown, wasShiftDown
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
setFingerId
public void setFingerId(long idFinger)
Sets the id of the finger triggering this event.
-
getFingerId
public long getFingerId()
Gets the id of the finger triggering this event.
-
getAcceleration
public SbVec2f getAcceleration()
Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.
-
setFirstPosition
public void setFirstPosition(SbVec2f name_24139)
Sets the first position (in pixels).
-
setPreviousSpeed
public void setPreviousSpeed()
Sets the previous speed in pixels per second.
-
getState
public SoTouchEvent.States getState()
Gets the touch event state (Up, Down, Move or Unknown). .
-
getSpeed
public SbVec2f getSpeed()
Gets the speed (in pixels per second) between the previous event and the current one.
-
getTouchManager
public SoTouchManager getTouchManager()
Gets the corresponding TouchManager for this event.
-
getPreviousEventTime
public SbTime getPreviousEventTime()
Gets the time of previous event of the finger identified bygetFingerId()
. If current event is a DOWN, the function returns the current time.
-
getDisplacement
public SbVec2f getDisplacement()
Gets the deplacement vector (in pixels) between the previous event and the current one.
-
getPreviousPosition
public SbVec2f getPreviousPosition()
Gets the previous position of the same finger (in pixels). If current event is a DOWN, the function returns the current position.
-
getPreviousSpeed
public SbVec2f getPreviousSpeed()
Gets the previous speed (in pixels per second).
-
getFirstContactTime
public SbTime getFirstContactTime()
Gets the time of first contact in seconds of the finger identified bygetFingerId()
. This date is set when the DOWN event occurs.
-
setState
public void setState(SoTouchEvent.States b)
Sets the state of the touch event.
-
getElapsedTimeSincePreviousEvent
public SbTime getElapsedTimeSincePreviousEvent()
Gets the elapsed time since previous event, triggered by the same finger, in seconds. If the current event is a DOWN, the function returns 0.
-
setTouchManager
public void setTouchManager(SoTouchManager manager)
Sets the TouchManager for this event.
-
getElapsedTimeUntilPreviousEvent
public SbTime getElapsedTimeUntilPreviousEvent()
Gets the elapsed time between the first contact and previous event, for the finger identified bygetFingerId()
, in seconds.
-
getFirstPosition
public SbVec2f getFirstPosition()
Gets the first position (in pixels). This position is set when the DOWN event occurs.
-
-