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
00096 class SoTouchManager
00097 {
00098
00099 public :
00100
00101 SoTouchManager();
00102
00103 virtual ~SoTouchManager();
00104
00108 const SoTouchEvent* getEventById(unsigned long id) const;
00109
00114 const SoTouchEvent* getEventbyIndex(int index) const;
00115
00119 const std::vector<unsigned long>& getAllFingerIds() const;
00120
00124 int getFingerNumber() const;
00125
00129 int getMaxSimultaneousFingers() const;
00130
00134 void setMaxSimultaneousFingers(int fingers);
00135
00141 void setThreshold(float t);
00142
00146 float getThreshold() const;
00147
00151 bool isTouchScreenAvailable();
00152
00156 void setTouchScreenAvailability(bool available);
00157
00162 void removeRecognizer(SoGestureRecognizer* gesture);
00163
00168 void addRecognizer(SoGestureRecognizer* recognizer);
00169
00178 void addDefaultRecognizers();
00179
00184 void removeDefaultRecognizers();
00185
00189 const std::vector<SoGestureRecognizer*>& getRecognizerList() const;
00190
00199 const std::vector<const SoEvent*>& getTouchDownEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00200
00209 const std::vector<const SoEvent*>& getTouchUpEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00210
00219 const std::vector<const SoEvent*>& getTouchMoveEvent(unsigned long fingerId, const SbVec2f& fingerPos, const SbTime& time);
00220
00221 #if 1
00222 // The scene manager argument is useless. The process event should be now done by using the
00223
00225 SoTouchManager(SoSceneManager* sM);
00226 SoDEPRECATED
00233 SoTouchEvent* updateAndProcessTouchEvent(unsigned long id, SoTouchEvent::State state, SbVec2f position, SbTime time);
00234
00235 #endif
00237 private :
00238 void init();
00239
00240
00241 void replaceEvent(int i, int j);
00242
00243 const std::vector<const SoEvent*>& getTouchEvent(unsigned long fingerId, SoTouchEvent::State state, const SbVec2f& fingerPos, const SbTime& time);
00244
00245
00246 std::vector<SoTouchEvent> m_touchEvent;
00247
00248
00249 std::vector<SoGestureRecognizer*> m_recognizerList;
00250
00251
00252 SoScaleGestureRecognizer* m_scaleRecognizer;
00253 SoRotateGestureRecognizer* m_rotateRecognizer;
00254 SoDoubleTapGestureRecognizer* m_doubleTapRecognizer;
00255 SoLongTapGestureRecognizer* m_longTapRecognizer;
00256
00257 bool m_touchScreenAvailable;
00258
00259 unsigned int m_supportedFingersNumber;
00260 float m_threshold;
00261
00262 int m_fingerNumber;
00263
00264 std::vector<unsigned long> m_allFingers;
00265
00266 bool m_fingerWasUp;
00267
00268 int m_eventIndex;
00269
00270 int m_maxSimultaneousFingers;
00271
00272 std::vector<const SoEvent*> m_soeventlist;
00273
00274
00275
00276 SoSceneManager* m_sceneManager;
00277 };
00278
00279 #endif
00280
00281
00282