Base class for touch events. More...
#include <Inventor/touch/events/SoTouchEvent.h>
Public Types | |
enum | State { UNKNOWN, UP, DOWN, MOVE } |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoTouchEvent () | |
State | getState () const |
unsigned long | getFingerId () const |
SbTime | getElapsedTimeSincePreviousEvent () const |
SbTime | getFirstContactTime () const |
SbTime | getElapsedTimeUntilPreviousEvent () const |
SbTime | getPreviousEventTime () const |
SbVec2f | getSpeed () const |
SbVec2f | getPreviousPosition () const |
SbVec2f | getDisplacement () const |
SbVec2f | getAcceleration () const |
SbVec2f | getPreviousSpeed () const |
SoTouchManager * | getTouchManager () const |
void | setTouchManager (SoTouchManager *manager) |
SbVec2f | getFirstPosition () const |
void | setState (SoTouchEvent::State b) |
void | setFingerId (unsigned long idFinger) |
virtual void | setPosition (const SbVec2f &p) |
virtual void | setPosition (const SbVec2s &p) |
virtual void | setTime (SbTime t) |
void | setPreviousSpeed () |
void | setFirstPosition (SbVec2f) |
Static Public Member Functions | |
static SoType | getClassTypeId () |
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
enum SoTouchEvent::State |
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 SoType SoTouchEvent::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoEvent.
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 SoType SoTouchEvent::getTypeId | ( | ) | const [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 void SoTouchEvent::setPosition | ( | const SbVec2s & | p | ) | [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.
virtual void SoTouchEvent::setPosition | ( | const SbVec2f & | p | ) | [virtual] |
Sets the current position (in pixels) and the displacement vector.
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::setTime | ( | SbTime | t | ) | [virtual] |
Sets the time at which the event occurred.
Reimplemented from SoEvent.
void SoTouchEvent::setTouchManager | ( | SoTouchManager * | manager | ) |
Sets the TouchManager for this event.