Class SoTouchManager


  • public class SoTouchManager
    extends Inventor
    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

    Get the touch manager from the touch device to register gesture recognizers. Not available

    See Also:
    SoQtTouchScreen, SoWinTouchScreen, SoTouchEvent, SoGestureEvent, SoGestureRecognizer
    • Constructor Detail

      • SoTouchManager

        @Deprecated
        public SoTouchManager​(SoSceneManager sM)
        Deprecated.
        As of Open Inventor 9500. Scene manager argument is useless.

        Warning Deprecated since Open Inventor 9500. Scene manager argument is useless.

      • SoTouchManager

        public SoTouchManager()
    • Method Detail

      • addRecognizer

        public void addRecognizer​(SoGestureRecognizer recognizer)
        Add a gesture recognizer to the recognizer list.
      • removeRecognizer

        public void removeRecognizer​(SoGestureRecognizer gesture)
        Remove a gesture recognizer from the recognizer list.
      • getEventbyIndex

        public SoTouchEvent getEventbyIndex​(int index)
        Get the corresponding event for the index, NULL if index is incorrect. Use getFingerNumber() to know the number of fingers touching the screen.
      • getTouchMoveEvent

        public java.util.ArrayList<SoEvent> getTouchMoveEvent​(long fingerId,
                                                              SbVec2f fingerPos,
                                                              SbTime time)
        Translate the given touch move event into a list of SoEvent. This list may contain some recognized SoGestureEvent.

        Parameters:
        fingerId - id of the finger used.

        fingerPos - position of the finger in pixels.

        time - timestamp of the touch event in seconds.
        Returns:
        this list.

      • getAllFingerIds

        public long[] getAllFingerIds()
        Get the table with ids of all fingers touching the screen.
      • setTouchScreenAvailability

        public void setTouchScreenAvailability​(boolean available)
        Set the touch screen availability.
      • updateAndProcessTouchEvent

        @Deprecated
        public SoTouchEvent updateAndProcessTouchEvent​(long id,
                                                       SoTouchEvent.States state,
                                                       SbVec2f position,
                                                       SbTime time)
        Deprecated.
        As of Open Inventor 9500. Use getTouchDownEvent, getTouchUpEvent or getTouchMoveEvent instead. Process the events by using SoRenderAreaCore instead.
        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.

        Warning Deprecated since Open Inventor 9500. Use getTouchDownEvent, getTouchUpEvent or getTouchMoveEvent instead. Process the events by using SoRenderAreaCore instead.

      • getEventById

        public SoTouchEvent getEventById​(long id)
        Get the corresponding event for the finger id, NULL if id is incorrect.
      • getFingerNumber

        public int getFingerNumber()
        Get the current number of fingers touching the screen.
      • removeDefaultRecognizers

        public void removeDefaultRecognizers()
        Remove the default recognizers from the recognizer list. It removes all the recognizers previously added by addDefaultRecognizers().
      • setThreshold

        public void 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.
      • getThreshold

        public float getThreshold()
        Get the detection threshold (in pixels).
      • isTouchScreenAvailable

        public boolean isTouchScreenAvailable()
        Returns true if the touch screen device is available, false otherwise.
      • getMaxSimultaneousFingers

        public int getMaxSimultaneousFingers()
        Get the maximum number of simultaneous fingers supported by the device.
      • getTouchUpEvent

        public java.util.ArrayList<SoEvent> getTouchUpEvent​(long fingerId,
                                                            SbVec2f fingerPos,
                                                            SbTime time)
        Translate the given touch up event into a list of SoEvent. This list may contain some recognized SoGestureEvent.

        Parameters:
        fingerId - id of the finger used.

        fingerPos - position of the finger in pixels.

        time - timestamp of the touch event in seconds.
        Returns:
        this list.

      • getTouchDownEvent

        public java.util.ArrayList<SoEvent> getTouchDownEvent​(long fingerId,
                                                              SbVec2f fingerPos,
                                                              SbTime time)
        Translate the given touch down event into a list of SoEvent. This list may contain some recognized SoGestureEvent.

        Parameters:
        fingerId - id of the finger used.

        fingerPos - position of the finger in pixels.

        time - timestamp of the touch event in seconds.
        Returns:
        this list.

      • getRecognizerList

        public java.util.ArrayList<SoGestureRecognizer> getRecognizerList()
        Returns the gesture recognizers list.
      • setMaxSimultaneousFingers

        public void setMaxSimultaneousFingers​(int fingers)
        Set the maximum number of simultaneous fingers supported by the device.