00001 #ifndef _SceneExaminer_ 00002 #define _SceneExaminer_ 00003 00004 #include <Inventor/ViewerComponents/nodes/SceneInteractor.h> 00005 #include <Inventor/events/SoMouseButtonEvent.h> 00006 #include <Inventor/events/SoLocation2Event.h> 00007 #include <vector> 00008 00009 class SoMouseWheelEvent; 00010 class SoKeyboardEvent; 00011 class SoLocation2Event; 00012 class SoScaleGestureEvent; 00013 class SoEvent; 00014 class SoTouchEvent; 00015 class SoRotateGestureEvent; 00016 class SoDoubleTapGestureEvent; 00017 class SoLongTapGestureEvent; 00018 class SeekAnimator; 00019 class NavigationInteraction; 00020 class SelectionInteraction; 00021 class BaseInteraction; 00022 class SoSensor; 00023 class SoOneShotSensor; 00024 class SiInteractionModeListener; 00025 00169 class VIEWERCOMPONENTS_API SceneExaminer : public SceneInteractor 00170 { 00171 00172 public: 00173 00177 enum InteractionMode 00178 { 00179 NAVIGATION, 00180 SELECTION 00181 }; 00182 00186 enum NavigationMode 00187 { 00188 ORBIT, 00189 PLANE 00190 }; 00191 00193 SceneExaminer(); 00194 00196 virtual ~SceneExaminer(); 00197 00201 void enableSelection(bool enabled); 00202 00206 bool isSelectionEnabled(); 00207 00211 void enableZoom(bool enabled); 00212 00216 bool isZoomEnabled(); 00217 00221 void enablePan(bool enabled); 00222 00226 bool isPanEnabled(); 00227 00231 void enableOrbit(bool enabled); 00232 00236 bool isOrbitEnabled(); 00237 00241 void enableRotate(bool enabled); 00242 00246 bool isRotateEnabled(); 00247 00251 void enableSeek(bool enabled); 00252 00256 bool isSeekEnabled(); 00257 00261 void setNavigationMode(SceneExaminer::NavigationMode mode); 00262 00266 bool isSpinEnabled() const; 00267 00277 void enableSpin(bool enable); 00278 00282 SceneExaminer::NavigationMode getNavigationMode(); 00283 00287 void setInteractionMode(SceneExaminer::InteractionMode mode); 00288 00292 SceneExaminer::InteractionMode getInteractionMode(); 00293 00297 virtual void setCameraMode( SceneInteractor::CameraMode mode ); 00298 00302 void setSeekMode( bool onOrOff ); 00303 00307 void addInteractionModeListener( SiInteractionModeListener* listener ); 00308 00312 void removeInteractionModeListener( SiInteractionModeListener* listener ); 00313 00314 private: 00315 virtual void mouseWheelMoved( SoMouseWheelEvent* wheelEvent, SoHandleEventAction* action ); 00316 virtual void mouseMoved( SoLocation2Event* mouseEvent, SoHandleEventAction* action ); 00317 virtual void mousePressed( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action ); 00318 virtual void mouseReleased( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action ); 00319 virtual void keyPressed( SoKeyboardEvent* keyEvent, SoHandleEventAction* action ); 00320 virtual void keyReleased( SoKeyboardEvent* keyEvent, SoHandleEventAction* action ); 00321 virtual void touch( SoTouchEvent* touchEvent, SoHandleEventAction* action ); 00322 virtual void zoom( SoScaleGestureEvent* scaleEvent, SoHandleEventAction* action ); 00323 virtual void rotate( SoRotateGestureEvent* rotateEvent, SoHandleEventAction* action ); 00324 virtual void doubleTap(SoDoubleTapGestureEvent* doubleTapEvent, SoHandleEventAction* action); 00325 virtual void longTap(SoLongTapGestureEvent* longTapEvent, SoHandleEventAction* action); 00326 00327 private: 00328 void switchInteractionMode(SoHandleEventAction* action); 00329 00330 NavigationInteraction* m_navigation; 00331 SelectionInteraction* m_selection; 00332 BaseInteraction* m_currentInteraction; 00333 bool m_isSelectionEnabled; 00334 std::vector<SiInteractionModeListener*> m_interactionModeListeners; 00335 SoOneShotSensor* m_modeSwitchDelayer; 00336 }; 00337 00338 #endif // _SceneExaminer_ 00339