00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_TOUCH_MANAGER
00026 #define _SO_TOUCH_MANAGER
00027
00028 #include <Inventor/gestures/recognizers/SoGestureRecognizer.h>
00029 #include <Inventor/touch/events/SoTouchEvent.h>
00030 #include <Inventor/SoSceneManager.h>
00031
00032 class SoTouchEvent;
00033 class SoScaleGestureRecognizer;
00034 class SoRotateGestureRecognizer;
00035 class SoDoubleTapGestureRecognizer;
00036 class SoLongTapGestureRecognizer;
00037
00095 class SoTouchManager
00096 {
00097
00098 public :
00099
00100 SoTouchManager();
00101
00102 virtual ~SoTouchManager();
00103
00107 const SoTouchEvent* getEventById(unsigned long id) const;
00108
00113 const SoTouchEvent* getEventbyIndex(int index) const;
00114
00118 const std::vector<unsigned long>& getAllFingerIds() const;
00119
00123 int getFingerNumber() const;
00124
00128 int getMaxSimultaneousFingers() const;
00129
00133 void setMaxSimultaneousFingers(int fingers);
00134
00140 void setThreshold(float t);
00141
00145 float getThreshold() const;
00146
00150 bool isTouchScreenAvailable();
00151
00155 void setTouchScreenAvailability(bool available);
00156
00161 void removeRecognizer(SoGestureRecognizer* gesture);
00162
00167 void addRecognizer(SoGestureRecognizer* recognizer);
00168
00177 void addDefaultRecognizers();
00178
00183 void removeDefaultRecognizers();
00184
00188 const std::vector<SoGestureRecognizer*>& getRecognizerList() const;
00189
00198 const std::vector<const SoEvent*>& getTouchDownEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00199
00208 const std::vector<const SoEvent*>& getTouchUpEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00209
00218 const std::vector<const SoEvent*>& getTouchMoveEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00219
00220 #if 1
00221 // The scene manager argument is useless. The process event should be now done by using the
00222
00224 SoTouchManager(SoSceneManager* sM);
00225 SoDEPRECATED
00232 SoTouchEvent* updateAndProcessTouchEvent(unsigned long id, SoTouchEvent::State state, SbVec2f position, SbTime time);
00233
00234 #endif
00236 private :
00237 void init();
00238
00239
00240 void replaceEvent(int i, int j);
00241
00242 const std::vector<const SoEvent*>& getTouchEvent(unsigned long fingerId, SoTouchEvent::State state, const SbVec2f& fingerPos, const SbTime& time);
00243
00244
00245 std::vector<SoTouchEvent> m_touchEvent;
00246
00247
00248 std::vector<SoGestureRecognizer*> m_recognizerList;
00249
00250
00251 SoScaleGestureRecognizer* m_scaleRecognizer;
00252 SoRotateGestureRecognizer* m_rotateRecognizer;
00253 SoDoubleTapGestureRecognizer* m_doubleTapRecognizer;
00254 SoLongTapGestureRecognizer* m_longTapRecognizer;
00255
00256 bool m_touchScreenAvailable;
00257
00258 unsigned int m_supportedFingersNumber;
00259 float m_threshold;
00260
00261 int m_fingerNumber;
00262
00263 std::vector<unsigned long> m_allFingers;
00264
00265 bool m_fingerWasUp;
00266
00267 int m_eventIndex;
00268
00269 int m_maxSimultaneousFingers;
00270
00271 std::vector<const SoEvent*> m_soeventlist;
00272
00273
00274
00275 SoSceneManager* m_sceneManager;
00276 };
00277
00278 #endif
00279
00280
00281