00001 #pragma once
00002
00003 #include <Inventor/Axis.h>
00004 #include <Inventor/ViewerComponents/nodes/SceneInteractor.h>
00005
00006 class SoMouseWheelEvent;
00007 class SoKeyboardEvent;
00008 class SoLocation2Event;
00009 class SoEvent;
00010 class SoViewingCube;
00011 class InteractionOrbiter;
00012 class SoNodeSensor;
00013 class SoFieldSensor;
00014
00151 class VIEWERCOMPONENTS_API SceneOrbiter : public SceneInteractor
00152 {
00153
00154 public:
00155
00159 enum RotationMethod
00160 {
00166 TURNTABLE,
00171 TRACKBALL
00172 };
00173
00175 SceneOrbiter();
00176
00178 virtual ~SceneOrbiter();
00179
00195 void setConstraintLevel( float level );
00196
00203 float getConstraintLevel();
00204
00209 void setRotationMethod( RotationMethod method );
00210
00214 RotationMethod getRotationMethod();
00215
00221 void setUpAxis( openinventor::inventor::Axis::Type axis );
00222
00226 openinventor::inventor::Axis::Type getUpAxis();
00227
00231 void enableViewingCube( bool enabled );
00232
00236 bool isViewingCubeEnabled() const;
00237
00241 SoViewingCube* getViewingCube();
00242
00246 virtual void setCameraMode( SceneInteractor::CameraMode mode );
00247
00248 private:
00249 virtual void mouseWheelMoved( SoMouseWheelEvent* wheelEvent, SoHandleEventAction* action );
00250 virtual void mouseMoved( SoLocation2Event* mouseEvent, SoHandleEventAction* action );
00251 virtual void mousePressed( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
00252 virtual void mouseReleased( SoMouseButtonEvent* mouseEvent, SoHandleEventAction* action );
00253 virtual void keyPressed( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
00254 virtual void keyReleased( SoKeyboardEvent* keyEvent, SoHandleEventAction* action );
00255 virtual void touch( SoTouchEvent* touchEvent, SoHandleEventAction* action );
00256 virtual void zoom(SoScaleGestureEvent* scaleEvent, SoHandleEventAction* action);
00257 virtual void rotate( SoRotateGestureEvent* rotateEvent, SoHandleEventAction* action );
00258
00259 private:
00260 InteractionOrbiter* m_interaction;
00261 SoViewingCube* m_viewingCube;
00262 SoRef<SoSwitch> m_viewingCubeSwitch;
00263 SoFieldSensor* m_upAxisSensor;
00264
00265
00266 SoNodeSensor* m_cameraSensor;
00267 static void cameraSensorCallback(void* data, SoSensor* sensor);
00268
00269 SbViewportRegion m_viewportRegion;
00270 };
00271