Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoTouchEvent Class Reference

Base class for touch events. More...

#include <Inventor/touch/events/SoTouchEvent.h>

+ Inheritance diagram for SoTouchEvent:

Public Types

enum  State {
  UNKNOWN ,
  UP ,
  DOWN ,
  MOVE
}
 The different states a touch event can have. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoTouchEvent ()
 Constructor.
 
State getState () const
 Gets the touch event state (Up, Down, Move or Unknown).
 
unsigned long getFingerId () const
 Gets the id of the finger triggering this event.
 
SbTime getElapsedTimeSincePreviousEvent () const
 Gets the elapsed time since previous event, triggered by the same finger, in seconds.
 
SbTime getFirstContactTime () const
 Gets the time of first contact in seconds of the finger identified by getFingerId().
 
SbTime getElapsedTimeUntilPreviousEvent () const
 Gets the elapsed time between the first contact and previous event, for the finger identified by getFingerId(), in seconds.
 
SbTime getPreviousEventTime () const
 Gets the time of previous event of the finger identified by getFingerId().
 
SbVec2f getSpeed () const
 Gets the speed (in pixels per second) between the previous event and the current one.
 
SbVec2f getPreviousPosition () const
 Gets the previous position of the same finger (in pixels).
 
SbVec2f getDisplacement () const
 Gets the deplacement vector (in pixels) between the previous event and the current one.
 
SbVec2f getAcceleration () const
 Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.
 
SbVec2f getPreviousSpeed () const
 Gets the previous speed (in pixels per second).
 
SoTouchManagergetTouchManager () const
 Gets the corresponding TouchManager for this event.
 
void setTouchManager (SoTouchManager *manager)
 Sets the TouchManager for this event.
 
SbVec2f getFirstPosition () const
 Gets the first position (in pixels).
 
void setState (SoTouchEvent::State b)
 Sets the state of the touch event.
 
void setFingerId (unsigned long idFinger)
 Sets the id of the finger triggering this event.
 
virtual void setPosition (const SbVec2f &p)
 Sets the current position (in pixels) and the displacement vector.
 
virtual void setPosition (const SbVec2s &p)
 Sets the window pixel location of the cursor when the event occurred.
 
virtual void setTime (SbTime t)
 Sets the time at which the event occurred.
 
void setPreviousSpeed ()
 Sets the previous speed in pixels per second.
 
void setFirstPosition (SbVec2f)
 Sets the first position (in pixels).
 
- Public Member Functions inherited from SoEvent
 SoEvent ()
 Constructor.
 
virtual ~SoEvent ()
 Destructor.
 
SbTime getTime () const
 Gets the time at which the event occurred.
 
const SbVec2sgetPosition () const
 Returns the window pixel location of the cursor when the event occurred as integer values.
 
const SbVec2fgetPositionFloat () const
 Returns the window pixel location of the cursor when the event occurred as float values.
 
const SbVec2sgetPosition (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values.
 
const SbVec2fgetPositionFloat (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values.
 
const SbVec2fgetNormalizedPosition (const SbViewportRegion &vpRgn) const
 Gets the normalized location of the cursor when the event occurred, relative to the specified viewport region.
 
void setShiftDown (SbBool isDown)
 Sets whether the shift key was down when the event occurred.
 
void setCtrlDown (SbBool isDown)
 Sets whether the CTRL key was down when the event occurred.
 
void setAltDown (SbBool isDown)
 Sets whether the ALT key was down when the event occurred.
 
void setButton1Down (SbBool isDown)
 Sets whether mouse Button 1 was down when the event occurred.
 
SbBool wasShiftDown () const
 Returns true if the shift key was down when the event occurred.
 
SbBool wasCtrlDown () const
 Returns true if the CTRL key was down when the event occurred.
 
SbBool wasAltDown () const
 Returns true if the ALT key was down when the event occurred.
 
SbBool wasButton1Down () const
 Returns true if mouse button 1 was down when the event occurred.
 
virtual const SbTrackerInfogetTrackerInfo () const
 Gets whether an event object has associated tracker information.
 
SbTrackerInfogetTrackerInfo ()
 Gets whether an event object has associated tracker information.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEvent
static SoType getClassTypeId ()
 Returns the type id for the SoEvent class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

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

Definition at line 92 of file SoTouchEvent.h.

Member Enumeration Documentation

◆ State

The different states a touch event can have.

Enumerator
UNKNOWN 

Unknown state.

UP 

Up state : The finger is off the screen.

DOWN 

Down state : The finger is on the screen.

MOVE 

Move state : The finger is moving on the screen.

Definition at line 100 of file SoTouchEvent.h.

Constructor & Destructor Documentation

◆ SoTouchEvent()

SoTouchEvent::SoTouchEvent ( )

Constructor.

Member Function Documentation

◆ getAcceleration()

SbVec2f SoTouchEvent::getAcceleration ( ) const

Gets the acceleration vector (in pixels per second squared) between the previous event and the current one.

◆ getClassTypeId()

static SoType SoTouchEvent::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getDisplacement()

SbVec2f SoTouchEvent::getDisplacement ( ) const

Gets the deplacement vector (in pixels) between the previous event and the current one.

◆ getElapsedTimeSincePreviousEvent()

SbTime SoTouchEvent::getElapsedTimeSincePreviousEvent ( ) const

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.

◆ getElapsedTimeUntilPreviousEvent()

SbTime SoTouchEvent::getElapsedTimeUntilPreviousEvent ( ) const

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

◆ getFingerId()

unsigned long SoTouchEvent::getFingerId ( ) const

Gets the id of the finger triggering this event.

◆ getFirstContactTime()

SbTime SoTouchEvent::getFirstContactTime ( ) const

Gets the time of first contact in seconds of the finger identified by getFingerId().

This date is set when the DOWN event occurs.

◆ getFirstPosition()

SbVec2f SoTouchEvent::getFirstPosition ( ) const

Gets the first position (in pixels).

This position is set when the DOWN event occurs.

◆ getPreviousEventTime()

SbTime SoTouchEvent::getPreviousEventTime ( ) const

Gets the time of previous event of the finger identified by getFingerId().

If current event is a DOWN, the function returns the current time.

◆ getPreviousPosition()

SbVec2f SoTouchEvent::getPreviousPosition ( ) const

Gets the previous position of the same finger (in pixels).

If current event is a DOWN, the function returns the current position.

◆ getPreviousSpeed()

SbVec2f SoTouchEvent::getPreviousSpeed ( ) const

Gets the previous speed (in pixels per second).

◆ getSpeed()

SbVec2f SoTouchEvent::getSpeed ( ) const

Gets the speed (in pixels per second) between the previous event and the current one.

◆ getState()

State SoTouchEvent::getState ( ) const

Gets the touch event state (Up, Down, Move or Unknown).

Use enum State.

◆ getTouchManager()

SoTouchManager * SoTouchEvent::getTouchManager ( ) const

Gets the corresponding TouchManager for this event.

◆ getTypeId()

virtual SoType SoTouchEvent::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoEvent.

◆ setFingerId()

void SoTouchEvent::setFingerId ( unsigned long  idFinger)

Sets the id of the finger triggering this event.

◆ setFirstPosition()

void SoTouchEvent::setFirstPosition ( SbVec2f  )

Sets the first position (in pixels).

◆ setPosition() [1/2]

virtual void SoTouchEvent::setPosition ( const SbVec2f p)
virtual

Sets the current position (in pixels) and the displacement vector.

Reimplemented from SoEvent.

◆ setPosition() [2/2]

virtual void SoTouchEvent::setPosition ( const SbVec2s p)
virtual

Sets the window pixel location of the cursor when the event occurred.

The position is relative to the lower left corner of the window in which the event occurred.

Reimplemented from SoEvent.

◆ setPreviousSpeed()

void SoTouchEvent::setPreviousSpeed ( )

Sets the previous speed in pixels per second.

◆ setState()

void SoTouchEvent::setState ( SoTouchEvent::State  b)

Sets the state of the touch event.

◆ setTime()

virtual void SoTouchEvent::setTime ( SbTime  t)
virtual

Sets the time at which the event occurred.


Reimplemented from SoEvent.

◆ setTouchManager()

void SoTouchEvent::setTouchManager ( SoTouchManager manager)

Sets the TouchManager for this event.


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