11.3. SoTouchManager

SoTouchManager SoTouchManager SoTouchManager is the class for touch management in Open Inventor.

Every touch manager has an SoTouchEvent SoTouchEvent SoTouchEvent table and every cell represents the state of one finger at a given time. SoTouchEvent SoTouchEvent SoTouchEvent has a pointer on this class so if you are analyzing an event, you can access to the SoTouchEvent SoTouchEvent SoTouchEvent table and know the state of other fingers. Several functions are implemented to use this table. Fingers are identified by an integer and SoTouchManager SoTouchManager SoTouchManager allows you to find the event corresponding to an identifier with getCorrespondingEvent(). getFingerNumber() gives you the number of fingers touching the screen. getMaxSimultaneousFingers() returns the maximum number of inputs supported by your device.

In the Open Inventor model, touch events are released only if the position of the finger has changed. To determine if a finger has moved, there is a threshold which is the minimum difference between previous and current position. You can edit this value with setThreshold(). By default, the threshold is equal to 0.0001 to consider every movement. So, every time the monitor is touched, a series of events are released beginning with one DOWN event and finishing with one UP event. SoTouchManager SoTouchManager SoTouchManager contains the table of current fingers identifiers. You can query them with getAllFingersId().

There are two environments supported in Open Inventor: SoWinTouchScreen SoWinTouchScreen for Windows and SoQtTouchScreen for Qt that represent touch devices. They respectively inherit from SoWinDevice SoWinDevice and SoQtDevice .

To add your own touch device, you must create a new class derived from the corresponding device and containing a SoTouchManager SoTouchManager SoTouchManager .

SoTouchManager:: updateAndProcessTouchEvent():

In each SoTouchEvent SoTouchEvent SoTouchEvent , fields are updated in a specific order because, to be calculated, some fields need information about previous event. For example, setPreviousSpeed() needs the previous displacement to be evaluated.

All SoTouchEvent SoTouchEvent SoTouchEvent are updated but not necessarily sent to the render area. Each event contains the finger’s position and an event is released only if the position has changed according to the threshold.