Every touch manager has a list of gesture recognizers that release events when a gesture is recognized. By default, the list is empty and recognizers must be added to release corresponding events. These classes are described in the next part.
A gesture is a series of touch events beginning with a DOWN event and ending with an UP event. Some Open Inventor objects can analyze this series and release events if gestures are identified. For every gesture there is a recognizer and the associated event. A recognized gesture is a series of gesture events starting with a BEGIN event. It is updated by DELTA event and terminated by END event.
SoGestureEvent is the base class for gesture events. It contains the state of the gesture: BEGIN, DELTA or END.
SoGestureRecognizer is the abstract base class for all recognizers and contains only one virtual function: SoEvent* recognize(SoEvent*). Each recognizer has its own event to release derived from SoGestureEvent, so you can add your own recognizer with its own associated event.
This gesture recognition is totally independent to multi-touch so, for example, gesture recognizers can be implemented to recognized gestures from other devices.
Open Inventor suggests three gestures:
,_long_tap,_zoom_and_rotate_gestures
The BEGIN event is sent when the second finger is put down. As long as one finger, at least, moves on the screen, DELTA events will be generated. Finally, when one finger is lifted, the END event is released.
+ Maximum tap duration. + Radius of the circle in which a finger has to stay.
+ Maximum tap duration. + Elapsed time between taps. + Radius of the circle in which a finger has to stay.
For every tap gesture, you can edit, with setLimitationCircle(int), the radius of the circle in which the finger has to stay to consider the gesture. For example, a double tap is not generated if you tap too far away from the position of the first tap.
Only one tap gesture can be recognized at a time.
To use the SoGestureRecognizer, first, you have to register the device in the render area. Then, you have to add the recognizers you want in the recognizers list.
Like other events, you write a callback to use the released event.