Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoTouchManager.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : ... (MMM yyyy)
22** Modified by : ... (MMM yyyy)
23**=======================================================================*/
24
25#ifndef _SO_TOUCH_MANAGER
26#define _SO_TOUCH_MANAGER
27
28#include <Inventor/gestures/recognizers/SoGestureRecognizer.h>
29#include <Inventor/touch/events/SoTouchEvent.h>
30#include <Inventor/SoSceneManager.h>
31
32class SoTouchEvent;
37
96{
97
98public :
99
101
103
107 const SoTouchEvent* getEventById(unsigned long id) const;
108
113 const SoTouchEvent* getEventbyIndex(int index) const;
114
118 const std::vector<unsigned long>& getAllFingerIds() const;
119
123 int getFingerNumber() const;
124
129
133 void setMaxSimultaneousFingers(int fingers);
134
140 void setThreshold(float t);
141
145 float getThreshold() const;
146
151
155 void setTouchScreenAvailability(bool available);
156
162
168
178
184
188 const std::vector<SoGestureRecognizer*>& getRecognizerList() const;
189
198 const std::vector<const SoEvent*>& getTouchDownEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
199
208 const std::vector<const SoEvent*>& getTouchUpEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
209
218 const std::vector<const SoEvent*>& getTouchMoveEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
219
220#if 1
221 // The scene manager argument is useless. The process event should be now done by using the
222 // class SoRenderAreaCore.SoDEPRECATED
225SoDEPRECATED
233
234#endif
236private :
237 void init();
238
239 //Replace event indexed by i with j
240 void replaceEvent(int i, int j);
241
242 const std::vector<const SoEvent*>& getTouchEvent(unsigned long fingerId, SoTouchEvent::State state, const SbVec2f& fingerPos, const SbTime& time);
243
244 // Events table
245 std::vector<SoTouchEvent> m_touchEvent;
246
247 // Recognizers list
248 std::vector<SoGestureRecognizer*> m_recognizerList;
249
250 // default recognizers
251 SoScaleGestureRecognizer* m_scaleRecognizer;
252 SoRotateGestureRecognizer* m_rotateRecognizer;
253 SoDoubleTapGestureRecognizer* m_doubleTapRecognizer;
254 SoLongTapGestureRecognizer* m_longTapRecognizer;
255
256 bool m_touchScreenAvailable;
257
258 unsigned int m_supportedFingersNumber;
259 float m_threshold;
260 // Number of fingers touching the screen
261 int m_fingerNumber;
262 // ID of all fingers touching the screen
263 std::vector<unsigned long> m_allFingers;
264 // Notify if the last event state was UP
265 bool m_fingerWasUp;
266 // Index of the event
267 int m_eventIndex;
268
269 int m_maxSimultaneousFingers;
270
271 std::vector<const SoEvent*> m_soeventlist;
272
273 // Deprecated member: process event should be done by using SoRenderAreaCore
274 // Kept only for compat as it is used by the deprecated method updateAndProcessTouchEvent
275 SoSceneManager* m_sceneManager;
276};
277
278#endif /* _SO_TOUCH_MANAGER */
279
280
Class for representation of a time.
Definition SbTime.h:91
2D vector class.
Definition SbVec.h:76
Double tap gesture recognizer.
Base class for all gesture recognizers.
Long tap gesture recognizer.
Rotate gesture recognizer.
Scale (pinch) gesture recognizer.
Manages scene graph rendering and event handling.
Base class for touch events.
State
The different states a touch event can have.
Class for managing events from touch screen input devices.
const std::vector< unsigned long > & getAllFingerIds() const
Get the table with ids of all fingers touching the screen.
float getThreshold() const
Get the detection threshold (in pixels).
void addRecognizer(SoGestureRecognizer *recognizer)
Add a gesture recognizer to the recognizer list.
void addDefaultRecognizers()
Add a default list of recognizers to the recognizer list.
int getFingerNumber() const
Get the current number of fingers touching the screen.
const std::vector< const SoEvent * > & getTouchUpEvent(unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time)
Translate the given touch up event into a list of SoEvent.
void setThreshold(float t)
Set the detection threshold (0.0001 pixels by default).
SoDEPRECATED SoTouchEvent * updateAndProcessTouchEvent(unsigned long id, SoTouchEvent::State state, SbVec2f position, SbTime time)
Update finger's id of the event identified by id and process it with the scene manager.
void setMaxSimultaneousFingers(int fingers)
Set the maximum number of simultaneous fingers supported by the device.
SoDEPRECATED SoTouchManager(SoSceneManager *sM)
const SoTouchEvent * getEventById(unsigned long id) const
Get the corresponding event for the finger id, NULL if id is incorrect.
bool isTouchScreenAvailable()
Returns true if the touch screen device is available, false otherwise.
void removeRecognizer(SoGestureRecognizer *gesture)
Remove a gesture recognizer from the recognizer list.
virtual ~SoTouchManager()
void setTouchScreenAvailability(bool available)
Set the touch screen availability.
void removeDefaultRecognizers()
Remove the default recognizers from the recognizer list.
const std::vector< const SoEvent * > & getTouchMoveEvent(unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time)
Translate the given touch move event into a list of SoEvent.
int getMaxSimultaneousFingers() const
Get the maximum number of simultaneous fingers supported by the device.
const std::vector< const SoEvent * > & getTouchDownEvent(unsigned long fingerId, const SbVec2f &fingerPos, const SbTime &time)
Translate the given touch down event into a list of SoEvent.
const SoTouchEvent * getEventbyIndex(int index) const
Get the corresponding event for the index, NULL if index is incorrect.
const std::vector< SoGestureRecognizer * > & getRecognizerList() const
Returns the gesture recognizers list.