Class for managing events from touch screen input devices. More...
#include <Inventor/touch/SoTouchManager.h>
Public Member Functions | |
SoTouchManager () | |
virtual | ~SoTouchManager () |
const SoTouchEvent * | getEventById (unsigned long id) const |
Get the corresponding event for the finger id, NULL if id is incorrect. | |
const SoTouchEvent * | getEventbyIndex (int index) const |
Get the corresponding event for the index, NULL if index is incorrect. | |
const std::vector< unsigned long > & | getAllFingerIds () const |
Get the table with ids of all fingers touching the screen. | |
int | getFingerNumber () const |
Get the current number of fingers touching the screen. | |
int | getMaxSimultaneousFingers () const |
Get the maximum number of simultaneous fingers supported by the device. | |
void | setMaxSimultaneousFingers (int fingers) |
Set the maximum number of simultaneous fingers supported by the device. | |
void | setThreshold (float t) |
Set the detection threshold (0.0001 pixels by default). | |
float | getThreshold () const |
Get the detection threshold (in pixels). | |
bool | isTouchScreenAvailable () |
Returns true if the touch screen device is available, false otherwise. | |
void | setTouchScreenAvailability (bool available) |
Set the touch screen availability. | |
void | removeRecognizer (SoGestureRecognizer *gesture) |
Remove a gesture recognizer from the recognizer list. | |
void | addRecognizer (SoGestureRecognizer *recognizer) |
Add a gesture recognizer to the recognizer list. | |
void | addDefaultRecognizers () |
Add a default list of recognizers to the recognizer list. | |
void | removeDefaultRecognizers () |
Remove the default recognizers from the recognizer list. | |
const std::vector< SoGestureRecognizer * > & | getRecognizerList () const |
Returns the gesture recognizers list. | |
const std::vector< const SoEvent * > & | getTouchDownEvent (unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time) |
Translate the given touch down event into a list of SoEvent. | |
const std::vector< const SoEvent * > & | getTouchUpEvent (unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time) |
Translate the given touch up event into a list of SoEvent. | |
const std::vector< const SoEvent * > & | getTouchMoveEvent (unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time) |
Translate the given touch move event into a list of SoEvent. | |
Deprecated | |
SoDEPRECATED | SoTouchManager (SoSceneManager *sM) |
SoDEPRECATED SoTouchEvent * | updateAndProcessTouchEvent (unsigned long id, SoTouchEvent::State state, SbVec2f position, SbTime time) |
Update finger's id of the event identified by id and process it with the scene manager. | |
Class for managing events from touch screen input devices.
This is the base class for managing events from touch screen input devices. A touch manager has a SoTouchEvent table and a finger ids table which are updated each time a finger moves. A touch manager has a list of gesture recognizers that generate events when the gesture is recognized. By default, the list is empty and recognizers must be added to generate the corresponding events. The addDefaultRecognizers() method is provided for convenience.
Note that all registered gesture recognizers are active simultaneously. During a gesture event, events may generated for a different gesture. The application is responsible for enforcing a "one gesture at a time" policy if appropriate.
Note: Unlike mouse and keyboard events, the application must explicitly register a touch screen device (e.g. SoWinTouchScreen) in order to get touch events.
SoQtTouchScreen, SoWinTouchScreen, SoTouchEvent, SoGestureEvent, SoGestureRecognizer
Definition at line 95 of file SoTouchManager.h.
SoTouchManager::SoTouchManager | ( | ) |
|
virtual |
SoDEPRECATED SoTouchManager::SoTouchManager | ( | SoSceneManager * | sM | ) |
void SoTouchManager::addDefaultRecognizers | ( | ) |
Add a default list of recognizers to the recognizer list.
The following recognizers are added:
void SoTouchManager::addRecognizer | ( | SoGestureRecognizer * | recognizer | ) |
Add a gesture recognizer to the recognizer list.
const std::vector< unsigned long > & SoTouchManager::getAllFingerIds | ( | ) | const |
Get the table with ids of all fingers touching the screen.
const SoTouchEvent * SoTouchManager::getEventById | ( | unsigned long | id | ) | const |
Get the corresponding event for the finger id, NULL if id is incorrect.
const SoTouchEvent * SoTouchManager::getEventbyIndex | ( | int | index | ) | const |
Get the corresponding event for the index, NULL if index is incorrect.
Use getFingerNumber() to know the number of fingers touching the screen.
int SoTouchManager::getFingerNumber | ( | ) | const |
Get the current number of fingers touching the screen.
int SoTouchManager::getMaxSimultaneousFingers | ( | ) | const |
Get the maximum number of simultaneous fingers supported by the device.
const std::vector< SoGestureRecognizer * > & SoTouchManager::getRecognizerList | ( | ) | const |
Returns the gesture recognizers list.
float SoTouchManager::getThreshold | ( | ) | const |
Get the detection threshold (in pixels).
const std::vector< const SoEvent * > & SoTouchManager::getTouchDownEvent | ( | unsigned long | fingerId, |
const SbVec2f & | fingerPos, | ||
const SbTime & | time | ||
) |
Translate the given touch down event into a list of SoEvent.
This list may contain some recognized SoGestureEvent.
fingerId | id of the finger used. |
fingerPos | position of the finger in pixels. |
time | timestamp of the touch event in seconds. |
const std::vector< const SoEvent * > & SoTouchManager::getTouchMoveEvent | ( | unsigned long | fingerId, |
const SbVec2f & | fingerPos, | ||
const SbTime & | time | ||
) |
Translate the given touch move event into a list of SoEvent.
This list may contain some recognized SoGestureEvent.
fingerId | id of the finger used. |
fingerPos | position of the finger in pixels. |
time | timestamp of the touch event in seconds. |
const std::vector< const SoEvent * > & SoTouchManager::getTouchUpEvent | ( | unsigned long | fingerId, |
const SbVec2f & | fingerPos, | ||
const SbTime & | time | ||
) |
Translate the given touch up event into a list of SoEvent.
This list may contain some recognized SoGestureEvent.
fingerId | id of the finger used. |
fingerPos | position of the finger in pixels. |
time | timestamp of the touch event in seconds. |
bool SoTouchManager::isTouchScreenAvailable | ( | ) |
Returns true if the touch screen device is available, false otherwise.
void SoTouchManager::removeDefaultRecognizers | ( | ) |
Remove the default recognizers from the recognizer list.
It removes all the recognizers previously added by addDefaultRecognizers().
void SoTouchManager::removeRecognizer | ( | SoGestureRecognizer * | gesture | ) |
Remove a gesture recognizer from the recognizer list.
void SoTouchManager::setMaxSimultaneousFingers | ( | int | fingers | ) |
Set the maximum number of simultaneous fingers supported by the device.
void SoTouchManager::setThreshold | ( | float | t | ) |
Set the detection threshold (0.0001 pixels by default).
This is the minimum difference between previous and current event positions to consider that the finger has moved.
void SoTouchManager::setTouchScreenAvailability | ( | bool | available | ) |
Set the touch screen availability.
SoDEPRECATED SoTouchEvent * SoTouchManager::updateAndProcessTouchEvent | ( | unsigned long | id, |
SoTouchEvent::State | state, | ||
SbVec2f | position, | ||
SbTime | time | ||
) |
Update finger's id of the event identified by id and process it with the scene manager.
Events are also analyzed by every recognizer in the recognizers list. Position is in pixels and time is in seconds.