Base class for touch events. More...
#include <Inventor/touch/events/SoTouchEvent.h>
Public Types | |
enum | State { UNKNOWN , UP , DOWN , MOVE } |
The different states a touch event can have. More... | |
Public Member Functions | |
virtual SoType | getTypeId () const |
Returns the type identifier for this specific instance. | |
SoTouchEvent () | |
Constructor. | |
State | getState () const |
Gets the touch event state (Up, Down, Move or Unknown). | |
unsigned long | getFingerId () const |
Gets the id of the finger triggering this event. | |
SbTime | getElapsedTimeSincePreviousEvent () const |
Gets the elapsed time since previous event, triggered by the same finger, in seconds. | |
SbTime | getFirstContactTime () const |
Gets the time of first contact in seconds of the finger identified by getFingerId(). | |
SbTime | getElapsedTimeUntilPreviousEvent () const |
Gets the elapsed time between the first contact and previous event, for the finger identified by getFingerId(), in seconds. | |
SbTime | getPreviousEventTime () const |
Gets the time of previous event of the finger identified by getFingerId(). | |
SbVec2f | getSpeed () const |
Gets the speed (in pixels per second) between the previous event and the current one. | |
SbVec2f | getPreviousPosition () const |
Gets the previous position of the same finger (in pixels). | |
SbVec2f | getDisplacement () const |
Gets the deplacement vector (in pixels) between the previous event and the current one. | |
SbVec2f | getAcceleration () const |
Gets the acceleration vector (in pixels per second squared) between the previous event and the current one. | |
SbVec2f | getPreviousSpeed () const |
Gets the previous speed (in pixels per second). | |
SoTouchManager * | getTouchManager () const |
Gets the corresponding TouchManager for this event. | |
void | setTouchManager (SoTouchManager *manager) |
Sets the TouchManager for this event. | |
SbVec2f | getFirstPosition () const |
Gets the first position (in pixels). | |
void | setState (SoTouchEvent::State b) |
Sets the state of the touch event. | |
void | setFingerId (unsigned long idFinger) |
Sets the id of the finger triggering this event. | |
virtual void | setPosition (const SbVec2f &p) |
Sets the current position (in pixels) and the displacement vector. | |
virtual void | setPosition (const SbVec2s &p) |
Sets the window pixel location of the cursor when the event occurred. | |
virtual void | setTime (SbTime t) |
Sets the time at which the event occurred. | |
void | setPreviousSpeed () |
Sets the previous speed in pixels per second. | |
void | setFirstPosition (SbVec2f) |
Sets the first position (in pixels). | |
Public Member Functions inherited from SoEvent | |
SoEvent () | |
Constructor. | |
virtual | ~SoEvent () |
Destructor. | |
SbTime | getTime () const |
Gets the time at which the event occurred. | |
const SbVec2s & | getPosition () const |
Returns the window pixel location of the cursor when the event occurred as integer values. | |
const SbVec2f & | getPositionFloat () const |
Returns the window pixel location of the cursor when the event occurred as float values. | |
const SbVec2s & | getPosition (const SbViewportRegion &vpRgn) const |
Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values. | |
const SbVec2f & | getPositionFloat (const SbViewportRegion &vpRgn) const |
Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values. | |
const SbVec2f & | getNormalizedPosition (const SbViewportRegion &vpRgn) const |
Gets the normalized location of the cursor when the event occurred, relative to the specified viewport region. | |
void | setShiftDown (SbBool isDown) |
Sets whether the shift key was down when the event occurred. | |
void | setCtrlDown (SbBool isDown) |
Sets whether the CTRL key was down when the event occurred. | |
void | setAltDown (SbBool isDown) |
Sets whether the ALT key was down when the event occurred. | |
void | setButton1Down (SbBool isDown) |
Sets whether mouse Button 1 was down when the event occurred. | |
SbBool | wasShiftDown () const |
Returns true if the shift key was down when the event occurred. | |
SbBool | wasCtrlDown () const |
Returns true if the CTRL key was down when the event occurred. | |
SbBool | wasAltDown () const |
Returns true if the ALT key was down when the event occurred. | |
SbBool | wasButton1Down () const |
Returns true if mouse button 1 was down when the event occurred. | |
virtual const SbTrackerInfo * | getTrackerInfo () const |
Gets whether an event object has associated tracker information. | |
SbTrackerInfo * | getTrackerInfo () |
Gets whether an event object has associated tracker information. | |
Public Member Functions inherited from SoTypedObject | |
SbBool | isOfType (const SoType &type) const |
Returns TRUE if this object is of the type specified in type or is derived from that type. | |
template<typename TypedObjectClass > | |
SbBool | isOfType () const |
Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class. | |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Static Public Member Functions inherited from SoEvent | |
static SoType | getClassTypeId () |
Returns the type id for the SoEvent class. | |
Static Public Member Functions inherited from SoTypedObject | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
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 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.
SoEvent, SoButtonEvent, SoMouseButtonEvent, SoKeyboardEvent, SoLocation2Event, SoMotion3Event, SoSpaceballButtonEvent, SoTouchManager
Definition at line 92 of file SoTouchEvent.h.
enum SoTouchEvent::State |
The different states a touch event can have.
Enumerator | |
---|---|
UNKNOWN | Unknown state. |
UP | Up state : The finger is off the screen. |
DOWN | Down state : The finger is on the screen. |
MOVE | Move state : The finger is moving on the screen. |
Definition at line 100 of file SoTouchEvent.h.
SoTouchEvent::SoTouchEvent | ( | ) |
Constructor.
SbVec2f SoTouchEvent::getAcceleration | ( | ) | const |
Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.
|
static |
Returns the type identifier for this class.
SbVec2f SoTouchEvent::getDisplacement | ( | ) | const |
Gets the deplacement vector (in pixels) between the previous event and the current one.
SbTime SoTouchEvent::getElapsedTimeSincePreviousEvent | ( | ) | const |
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.
SbTime SoTouchEvent::getElapsedTimeUntilPreviousEvent | ( | ) | const |
Gets the elapsed time between the first contact and previous event, for the finger identified by getFingerId(), in seconds.
unsigned long SoTouchEvent::getFingerId | ( | ) | const |
Gets the id of the finger triggering this event.
SbTime SoTouchEvent::getFirstContactTime | ( | ) | const |
Gets the time of first contact in seconds of the finger identified by getFingerId().
This date is set when the DOWN event occurs.
SbVec2f SoTouchEvent::getFirstPosition | ( | ) | const |
Gets the first position (in pixels).
This position is set when the DOWN event occurs.
SbTime SoTouchEvent::getPreviousEventTime | ( | ) | const |
Gets the time of previous event of the finger identified by getFingerId().
If current event is a DOWN, the function returns the current time.
SbVec2f SoTouchEvent::getPreviousPosition | ( | ) | const |
Gets the previous position of the same finger (in pixels).
If current event is a DOWN, the function returns the current position.
SbVec2f SoTouchEvent::getPreviousSpeed | ( | ) | const |
Gets the previous speed (in pixels per second).
SbVec2f SoTouchEvent::getSpeed | ( | ) | const |
Gets the speed (in pixels per second) between the previous event and the current one.
State SoTouchEvent::getState | ( | ) | const |
Gets the touch event state (Up, Down, Move or Unknown).
Use enum State.
SoTouchManager * SoTouchEvent::getTouchManager | ( | ) | const |
Gets the corresponding TouchManager for this event.
|
virtual |
Returns the type identifier for this specific instance.
Reimplemented from SoEvent.
void SoTouchEvent::setFingerId | ( | unsigned long | idFinger | ) |
Sets the id of the finger triggering this event.
void SoTouchEvent::setFirstPosition | ( | SbVec2f | ) |
Sets the first position (in pixels).
|
virtual |
Sets the current position (in pixels) and the displacement vector.
Reimplemented from SoEvent.
|
virtual |
Sets the window pixel location of the cursor when the event occurred.
The position is relative to the lower left corner of the window in which the event occurred.
Reimplemented from SoEvent.
void SoTouchEvent::setPreviousSpeed | ( | ) |
Sets the previous speed in pixels per second.
void SoTouchEvent::setState | ( | SoTouchEvent::State | b | ) |
Sets the state of the touch event.
|
virtual |
void SoTouchEvent::setTouchManager | ( | SoTouchManager * | manager | ) |
Sets the TouchManager for this event.