Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoTouchEvent.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : ... (MMM yyyy)
25** Modified by : ... (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50#ifndef _SO_TOUCH_EVENT_
51#define _SO_TOUCH_EVENT_
52
53#include <Inventor/SbBasic.h>
54#include <Inventor/events/SoSubEvent.h>
55#include <Inventor/SbTime.h>
56
57class SoTouchManager;
58
92class SoTouchEvent : public SoEvent
93{
94
95 SO_EVENT_HEADER();
96
97public:
98
118
123
124 #ifndef HIDDEN_FROM_DOC
125 virtual ~SoTouchEvent();
126 #endif // HIDDEN_FROM_DOC
127
133
137 unsigned long getFingerId() const;
138
144
150
155
161
167
173
179
185
190
195
200
205
210
214 void setFingerId(unsigned long idFinger);
215
220 virtual void setPosition(const SbVec2f &p);
221 virtual void setPosition(const SbVec2s &p);
222
226 virtual void setTime(SbTime t);
227
232
237
238private:
239 static void initClass();
240 static void exitClass();
241
242private:
243 // Id of the finger launching this event
244 unsigned long m_fingerId;
245 // Up, Down, Move or Unknown.
246 State m_state;
247 // The difference between the event position and the previous event position.
248 SbVec2f m_displacement;
249 // The time derivative of instant displacement
250 SbVec2f m_previousSpeed;
251 // The time elapsed since the first date contact and the previous event
252 SbTime m_elapsedTime;
253 // Date of first contact in seconds
254 SbTime m_firstContactTime;
255 // First position
256 SbVec2f m_firstPosition;
257
258 SoTouchManager* m_touchManager;
259};
260
261#endif /* _SO_TOUCH_EVENT_ */
262
263
Class for representation of a time.
Definition SbTime.h:91
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:700
Base class for all events.
Definition SoEvent.h:116
Base class for touch events.
SbVec2f getAcceleration() const
Gets the acceleration vector (in pixels per second squared) between the previous event and the curren...
SbVec2f getFirstPosition() const
Gets the first position (in pixels).
virtual void setPosition(const SbVec2s &p)
Sets the window pixel location of the cursor when the event occurred.
SoTouchEvent()
Constructor.
SbVec2f getDisplacement() const
Gets the deplacement vector (in pixels) between the previous event and the current one.
SbVec2f getSpeed() const
Gets the speed (in pixels per second) between the previous event and the current one.
SbTime getPreviousEventTime() const
Gets the time of previous event of the finger identified by getFingerId().
State
The different states a touch event can have.
@ DOWN
Down state : The finger is on the screen.
@ UNKNOWN
Unknown state.
@ MOVE
Move state : The finger is moving on the screen.
@ UP
Up state : The finger is off the screen.
SbVec2f getPreviousPosition() const
Gets the previous position of the same finger (in pixels).
SbTime getElapsedTimeUntilPreviousEvent() const
Gets the elapsed time between the first contact and previous event, for the finger identified by getF...
SbTime getElapsedTimeSincePreviousEvent() const
Gets the elapsed time since previous event, triggered by the same finger, in seconds.
virtual void setPosition(const SbVec2f &p)
Sets the current position (in pixels) and the displacement vector.
virtual void setTime(SbTime t)
Sets the time at which the event occurred.
void setPreviousSpeed()
Sets the previous speed in pixels per second.
void setFingerId(unsigned long idFinger)
Sets the id of the finger triggering this event.
void setTouchManager(SoTouchManager *manager)
Sets the TouchManager for this event.
SbTime getFirstContactTime() const
Gets the time of first contact in seconds of the finger identified by getFingerId().
unsigned long getFingerId() const
Gets the id of the finger triggering this event.
void setFirstPosition(SbVec2f)
Sets the first position (in pixels).
SbVec2f getPreviousSpeed() const
Gets the previous speed (in pixels per second).
State getState() const
Gets the touch event state (Up, Down, Move or Unknown).
void setState(SoTouchEvent::State b)
Sets the state of the touch event.
SoTouchManager * getTouchManager() const
Gets the corresponding TouchManager for this event.
Class for managing events from touch screen input devices.