Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoTouchManager Class Reference

Class for managing events from touch screen input devices. More...

#include <Inventor/touch/SoTouchManager.h>

Public Member Functions

 SoTouchManager ()
 
virtual ~SoTouchManager ()
 
const SoTouchEventgetEventById (unsigned long id) const
 Get the corresponding event for the finger id, NULL if id is incorrect.
 
const SoTouchEventgetEventbyIndex (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 SoTouchEventupdateAndProcessTouchEvent (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.
 

Detailed Description

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.

EXAMPLE

SEE ALSO

SoQtTouchScreen, SoWinTouchScreen, SoTouchEvent, SoGestureEvent, SoGestureRecognizer

Definition at line 95 of file SoTouchManager.h.

Constructor & Destructor Documentation

◆ SoTouchManager() [1/2]

SoTouchManager::SoTouchManager ( )

◆ ~SoTouchManager()

virtual SoTouchManager::~SoTouchManager ( )
virtual

◆ SoTouchManager() [2/2]

SoDEPRECATED SoTouchManager::SoTouchManager ( SoSceneManager sM)

Member Function Documentation

◆ addDefaultRecognizers()

void SoTouchManager::addDefaultRecognizers ( )

Add a default list of recognizers to the recognizer list.

The following recognizers are added:

◆ addRecognizer()

void SoTouchManager::addRecognizer ( SoGestureRecognizer recognizer)

Add a gesture recognizer to the recognizer list.

◆ getAllFingerIds()

const std::vector< unsigned long > & SoTouchManager::getAllFingerIds ( ) const

Get the table with ids of all fingers touching the screen.

◆ getEventById()

const SoTouchEvent * SoTouchManager::getEventById ( unsigned long  id) const

Get the corresponding event for the finger id, NULL if id is incorrect.

◆ getEventbyIndex()

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.

◆ getFingerNumber()

int SoTouchManager::getFingerNumber ( ) const

Get the current number of fingers touching the screen.

◆ getMaxSimultaneousFingers()

int SoTouchManager::getMaxSimultaneousFingers ( ) const

Get the maximum number of simultaneous fingers supported by the device.

◆ getRecognizerList()

const std::vector< SoGestureRecognizer * > & SoTouchManager::getRecognizerList ( ) const

Returns the gesture recognizers list.

◆ getThreshold()

float SoTouchManager::getThreshold ( ) const

Get the detection threshold (in pixels).

◆ getTouchDownEvent()

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.

Returns
this list.
Parameters
fingerIdid of the finger used.
fingerPosposition of the finger in pixels.
timetimestamp of the touch event in seconds.

◆ getTouchMoveEvent()

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.

Returns
this list.
Parameters
fingerIdid of the finger used.
fingerPosposition of the finger in pixels.
timetimestamp of the touch event in seconds.

◆ getTouchUpEvent()

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.

Returns
this list.
Parameters
fingerIdid of the finger used.
fingerPosposition of the finger in pixels.
timetimestamp of the touch event in seconds.

◆ isTouchScreenAvailable()

bool SoTouchManager::isTouchScreenAvailable ( )

Returns true if the touch screen device is available, false otherwise.

◆ removeDefaultRecognizers()

void SoTouchManager::removeDefaultRecognizers ( )

Remove the default recognizers from the recognizer list.

It removes all the recognizers previously added by addDefaultRecognizers().

◆ removeRecognizer()

void SoTouchManager::removeRecognizer ( SoGestureRecognizer gesture)

Remove a gesture recognizer from the recognizer list.

◆ setMaxSimultaneousFingers()

void SoTouchManager::setMaxSimultaneousFingers ( int  fingers)

Set the maximum number of simultaneous fingers supported by the device.

◆ setThreshold()

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.

◆ setTouchScreenAvailability()

void SoTouchManager::setTouchScreenAvailability ( bool  available)

Set the touch screen availability.

◆ updateAndProcessTouchEvent()

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.


The documentation for this class was generated from the following file: