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 #include <Inventor/sys/port.h> 00010 00011 #ifdef _WIN32 00012 # if defined(_DEBUG) 00013 # define __VIEWERCOMPONENTSLIB "fei.inventor.ViewerComponentsD.lib" 00014 # else 00015 # define __VIEWERCOMPONENTSLIB "fei.inventor.ViewerComponents.lib" 00016 # endif 00017 # ifndef ViewerComponents_EXPORTS 00018 # ifndef OIV_DISABLE_AUTOLINK 00019 # pragma comment(lib,__VIEWERCOMPONENTSLIB) 00020 # endif 00021 # endif 00022 #endif 00023 00024 class SoMouseWheelEvent; 00025 class SoKeyboardEvent; 00026 class SoLocation2Event; 00027 class SoScaleGestureEvent; 00028 class SoEvent; 00029 class SoTouchEvent; 00030 class SoRotateGestureEvent; 00031 class SoDoubleTapGestureEvent; 00032 class SoLongTapGestureEvent; 00033 class SeekAnimator; 00034 class NavigationInteraction; 00035 class SelectionInteraction; 00036 class BaseInteraction; 00037 class SiInteractionModeListener; 00038 00178 class VIEWERCOMPONENTS_API SceneExaminer : public SceneInteractor 00179 { 00180 00181 public: 00182 00186 enum InteractionMode 00187 { 00188 NAVIGATION, 00189 SELECTION 00190 }; 00191 00195 enum NavigationMode 00196 { 00197 ORBIT, 00198 PLANE 00199 }; 00200 00202 SceneExaminer(); 00203 00205 virtual ~SceneExaminer(); 00206 00210 void enableSelection(bool enabled); 00211 00215 bool isSelectionEnabled(); 00216 00220 void enableZoom(bool enabled); 00221 00225 bool isZoomEnabled(); 00226 00230 void enablePan(bool enabled); 00231 00235 bool isPanEnabled(); 00236 00240 void enableOrbit(bool enabled); 00241 00245 bool isOrbitEnabled(); 00246 00250 void enableRotate(bool enabled); 00251 00255 bool isRotateEnabled(); 00256 00260 void enableSeek(bool enabled); 00261 00265 bool isSeekEnabled(); 00266 00270 void setNavigationMode(SceneExaminer::NavigationMode mode); 00271 00275 SceneExaminer::NavigationMode getNavigationMode(); 00276 00280 void setInteractionMode(SceneExaminer::InteractionMode mode); 00281 00285 SceneExaminer::InteractionMode getInteractionMode(); 00286 00287 virtual void setCameraMode( SceneInteractor::CameraMode mode ); 00288 00292 void setSeekMode( bool onOrOff ); 00293 00297 void addInteractionModeListener( SiInteractionModeListener* listener ); 00298 00302 void removeInteractionModeListener( SiInteractionModeListener* listener ); 00303 00304 private: 00305 virtual void mouseWheelMoved( SoMouseWheelEvent* wheelEvent, SoHandleEventAction* action ); 00306 virtual void mouseMoved( SoLocation2Event* mouseEvent, SoHandleEventAction* action ); 00307 virtual void mousePressed( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action ); 00308 virtual void mouseReleased( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action ); 00309 virtual void keyPressed( SoKeyboardEvent* keyEvent, SoHandleEventAction* action ); 00310 virtual void keyReleased( SoKeyboardEvent* keyEvent, SoHandleEventAction* action ); 00311 virtual void touch( SoTouchEvent* touchEvent, SoHandleEventAction* action ); 00312 virtual void zoom( SoScaleGestureEvent* scaleEvent, SoHandleEventAction* action ); 00313 virtual void rotate( SoRotateGestureEvent* rotateEvent, SoHandleEventAction* action ); 00314 virtual void doubleTap(SoDoubleTapGestureEvent* doubleTapEvent, SoHandleEventAction* action); 00315 virtual void longTap(SoLongTapGestureEvent* longTapEvent, SoHandleEventAction* action); 00316 00317 private: 00318 void switchInteractionMode(); 00319 00320 NavigationInteraction* m_navigation; 00321 SelectionInteraction* m_selection; 00322 BaseInteraction* m_currentInteraction; 00323 bool m_isSelectionEnabled; 00324 std::vector<SiInteractionModeListener*> m_interactionModeListeners; 00325 }; 00326 00327 #endif // _SceneExaminer_ 00328