public class SoTouchEvent extends SoEvent
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 an SoEvent
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 (see SoGestureRecognizer
) 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.
See also:
SoEvent
, SoButtonEvent
, SoMouseButtonEvent
, SoKeyboardEvent
, SoLocation2Event
, SoMotion3Event
, SoSpaceballButtonEvent
, SoTouchManager
Modifier and Type | Class and Description |
---|---|
static class |
SoTouchEvent.States
The different states a touch event can have.
|
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
DOWN
Deprecated.
Use
SoTouchEvent.States.DOWN instead. |
static int |
MOVE
Deprecated.
Use
SoTouchEvent.States.MOVE instead. |
static int |
UNKNOWN
Deprecated.
Use
SoTouchEvent.States.UNKNOWN instead. |
static int |
UP
Deprecated.
Use
SoTouchEvent.States.UP instead. |
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoTouchEvent()
Constructor.
|
Modifier and Type | Method and 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 by
getFingerId() , 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 by
getFingerId() . |
SbVec2f |
getFirstPosition()
Gets the first position (in pixels).
|
SbTime |
getPreviousEventTime()
Gets the time of previous event of the finger identified by
getFingerId() . |
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_27681)
Sets the first position (in pixels).
|
void |
setPosition(SbVec2f p)
Sets the current position (in pixels) and the displacement vector.
|
void |
setPosition(SbVec2s p)
Sets the window pixel location of the cursor when the event occurred.
|
void |
setPreviousSpeed()
Sets the previous speed in pixels per second.
|
void |
setState(SoTouchEvent.States b)
Sets the state of the touch event.
|
void |
setTime(SbTime t)
Sets the time at which the event occurred.
|
void |
setTouchManager(SoTouchManager manager)
Sets the TouchManager for this event.
|
getNormalizedPosition, getPosition, getPosition, getPositionFloat, getPositionFloat, getTime, setAltDown, setButton1Down, setCtrlDown, setShiftDown, wasAltDown, wasButton1Down, wasCtrlDown, wasShiftDown
dispose, getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int UNKNOWN
SoTouchEvent.States.UNKNOWN
instead.@Deprecated public static final int UP
SoTouchEvent.States.UP
instead.@Deprecated public static final int DOWN
SoTouchEvent.States.DOWN
instead.@Deprecated public static final int MOVE
SoTouchEvent.States.MOVE
instead.public void setTime(SbTime t)
public SbTime getElapsedTimeUntilPreviousEvent()
getFingerId()
, in seconds.public void setPosition(SbVec2s p)
SoEvent
setPosition
in class SoEvent
public SbVec2f getSpeed()
public SbTime getPreviousEventTime()
getFingerId()
.
If current event is a DOWN, the function returns the current time.public void setPreviousSpeed()
public void setFirstPosition(SbVec2f name_27681)
public void setPosition(SbVec2f p)
setPosition
in class SoEvent
public SoTouchManager getTouchManager()
public SbVec2f getDisplacement()
public void setTouchManager(SoTouchManager manager)
public SbTime getFirstContactTime()
getFingerId()
.
This date is set when the DOWN event occurs.public SbVec2f getPreviousSpeed()
public SbTime getElapsedTimeSincePreviousEvent()
public long getFingerId()
public SoTouchEvent.States getState()
public void setFingerId(long idFinger)
public SbVec2f getAcceleration()
public SbVec2f getFirstPosition()
public SbVec2f getPreviousPosition()
public void setState(SoTouchEvent.States b)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com