Class SoTouchEvent


  • public class SoTouchEvent
    extends SoEvent
    Base class for touch events. SoTouchEvent is the base class for touch events in the Open Inventor event model. A touch event typically represents a user finger action on a touch screen input device, such as putting a finger down on the screen. SoTouchEvent is an SoEvent with touch information including the displacement and speed of the finger and the state (UP, DOWN or MOVE).

    The SoTouchEvent.getTouchManager() method can be use to retrieve the corresponding touch device currently used and information about other fingers touching the screen at the same time.

    Open Inventor also supports gesture events (see SoGestureEvent) such as pinch and rotate. Gesture events are generated by gesture recognizers (see SoGestureRecognizer) which analyze a series of touch events.

    Note: Unlike mouse and keyboard events, the application must explicitly register a touch screen device (SoWinTouchScreen, SoQtTouchScreen, etc) in order to get touch events.

    See Also:
    SoEvent, SoButtonEvent, SoMouseButtonEvent, SoKeyboardEvent, SoLocation2Event, SoMotion3Event, SoSpaceballButtonEvent, SoTouchManager
    • Constructor Detail

      • SoTouchEvent

        public SoTouchEvent()
        Constructor.
    • Method Detail

      • setFingerId

        public void setFingerId​(long idFinger)
        Sets the id of the finger triggering this event.
      • getFingerId

        public long getFingerId()
        Gets the id of the finger triggering this event.
      • getAcceleration

        public SbVec2f getAcceleration()
        Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.
      • setFirstPosition

        public void setFirstPosition​(SbVec2f name_24225)
        Sets the first position (in pixels).
      • setPreviousSpeed

        public void setPreviousSpeed()
        Sets the previous speed in pixels per second.
      • getState

        public SoTouchEvent.States getState()
        Gets the touch event state (Up, Down, Move or Unknown). .
      • getSpeed

        public SbVec2f getSpeed()
        Gets the speed (in pixels per second) between the previous event and the current one.
      • getTouchManager

        public SoTouchManager getTouchManager()
        Gets the corresponding TouchManager for this event.
      • getPreviousEventTime

        public SbTime getPreviousEventTime()
        Gets the time of previous event of the finger identified by getFingerId(). If current event is a DOWN, the function returns the current time.
      • getDisplacement

        public SbVec2f getDisplacement()
        Gets the deplacement vector (in pixels) between the previous event and the current one.
      • getPreviousPosition

        public SbVec2f getPreviousPosition()
        Gets the previous position of the same finger (in pixels). If current event is a DOWN, the function returns the current position.
      • getPreviousSpeed

        public SbVec2f getPreviousSpeed()
        Gets the previous speed (in pixels per second).
      • getFirstContactTime

        public SbTime getFirstContactTime()
        Gets the time of first contact in seconds of the finger identified by getFingerId(). This date is set when the DOWN event occurs.
      • setState

        public void setState​(SoTouchEvent.States b)
        Sets the state of the touch event.
      • getElapsedTimeSincePreviousEvent

        public SbTime getElapsedTimeSincePreviousEvent()
        Gets the elapsed time since previous event, triggered by the same finger, in seconds. If the current event is a DOWN, the function returns 0.
      • setTouchManager

        public void setTouchManager​(SoTouchManager manager)
        Sets the TouchManager for this event.
      • getElapsedTimeUntilPreviousEvent

        public SbTime getElapsedTimeUntilPreviousEvent()
        Gets the elapsed time between the first contact and previous event, for the finger identified by getFingerId(), in seconds.
      • getFirstPosition

        public SbVec2f getFirstPosition()
        Gets the first position (in pixels). This position is set when the DOWN event occurs.