// set default values of properties. user may edit them in preferences.
mySpeedIncrement = 10;
- mySpaceMouseBtns[0] = 1;
- mySpaceMouseBtns[1] = 2;
- mySpaceMouseBtns[2] = 10;
- mySpaceMouseBtns[3] = 11;
- mySpaceMouseBtns[4] = 9;
+ mySMDecreaseSpeedBtn = 1;
+ mySMIncreaseSpeedBtn = 2;
+ mySMDominantCombinedSwitchBtn = 9;
}
//----------------------------------------------------------------------------
::SetInteractor( vtkRenderWindowInteractor* theInteractor )
{
// register EventCallbackCommand as observer of standard events (keypress, mousemove, etc)
- vtkInteractorStyle::SetInteractor( theInteractor );
+ Superclass::SetInteractor( theInteractor );
myInteractor = dynamic_cast<SVTK_GenericRenderWindowInteractor*>(theInteractor);
- if ( myInteractor.GetPointer() ) {
+ if(theInteractor) {
// register EventCallbackCommand as observer of custorm event (3d space mouse event)
theInteractor->AddObserver( SVTK::SpaceMouseMoveEvent, EventCallbackCommand, Priority );
theInteractor->AddObserver( SVTK::SpaceMouseButtonEvent, EventCallbackCommand, Priority );
theInteractor->AddObserver( SVTK::MinusSpeedIncrementEvent, EventCallbackCommand, Priority );
theInteractor->AddObserver( SVTK::SetSpeedIncrementEvent, EventCallbackCommand, Priority );
- theInteractor->AddObserver( SVTK::SetSpaceMouseF1Event, EventCallbackCommand, Priority );
- theInteractor->AddObserver( SVTK::SetSpaceMouseF2Event, EventCallbackCommand, Priority );
- theInteractor->AddObserver( SVTK::SetSpaceMouseF3Event, EventCallbackCommand, Priority );
- theInteractor->AddObserver( SVTK::SetSpaceMouseF4Event, EventCallbackCommand, Priority );
- theInteractor->AddObserver( SVTK::SetSpaceMouseF5Event, EventCallbackCommand, Priority );
+ theInteractor->AddObserver( SVTK::SetSMDecreaseSpeedEvent, EventCallbackCommand, Priority );
+ theInteractor->AddObserver( SVTK::SetSMIncreaseSpeedEvent, EventCallbackCommand, Priority );
+ theInteractor->AddObserver( SVTK::SetSMDominantCombinedSwitchEvent, EventCallbackCommand, Priority );
theInteractor->AddObserver( SVTK::StartZoom, EventCallbackCommand, Priority );
theInteractor->AddObserver( SVTK::StartPan, EventCallbackCommand, Priority );
SVTK_InteractorStyle
::onSpaceMouseMove( double* data )
{
- // printf( "x=%+5.0lf y=%+5.0lf z=%+5.0lf a=%+5.0lf b=%+5.0lf c=%+5.0lf\n",
- // data[0], data[1], data[2], data[3], data[4], data[5] );
-
// general things, do SetCurrentRenderer() within FindPokedRenderer()
int x, y;
GetEventPosition( this->Interactor, x, y ); // current mouse position (from last mouse move event or any other event)
SVTK_InteractorStyle
::onSpaceMouseButton( int button )
{
- if ( mySpaceMouseBtns[0] == button ) --mySpeedIncrement;
- if ( mySpaceMouseBtns[1] == button ) ++mySpeedIncrement;
- if ( mySpaceMouseBtns[2] == button ) DecreaseGaussPointMagnification();
- if ( mySpaceMouseBtns[3] == button ) IncreaseGaussPointMagnification();
- if ( mySpaceMouseBtns[4] == button ) DominantCombinedSwitch();
-}
-
-//----------------------------------------------------------------------------
-void
-SVTK_InteractorStyle
-::DecreaseGaussPointMagnification()
-{
- printf( "\n--DecreaseGaussPointMagnification() NOT IMPLEMENTED--\n" );
-}
-
-//----------------------------------------------------------------------------
-void
-SVTK_InteractorStyle
-::IncreaseGaussPointMagnification()
-{
- printf( "\n--IncreaseGaussPointMagnification() NOT IMPLEMENTED--\n" );
+ if( mySMDecreaseSpeedBtn == button )
+ --mySpeedIncrement;
+ if( mySMIncreaseSpeedBtn == button )
+ ++mySpeedIncrement;
+ if( mySMDominantCombinedSwitchBtn == button )
+ DominantCombinedSwitch();
}
//----------------------------------------------------------------------------
self->mySpeedIncrement = *((int*)callData);
return;
- case SVTK::SetSpaceMouseF1Event:
- self->mySpaceMouseBtns[0] = *((int*)callData);
- return;
- case SVTK::SetSpaceMouseF2Event:
- self->mySpaceMouseBtns[1] = *((int*)callData);
+ case SVTK::SetSMDecreaseSpeedEvent:
+ self->mySMDecreaseSpeedBtn = *((int*)callData);
return;
- case SVTK::SetSpaceMouseF3Event:
- self->mySpaceMouseBtns[2] = *((int*)callData);
+ case SVTK::SetSMIncreaseSpeedEvent:
+ self->mySMIncreaseSpeedBtn = *((int*)callData);
return;
- case SVTK::SetSpaceMouseF4Event:
- self->mySpaceMouseBtns[3] = *((int*)callData);
- return;
- case SVTK::SetSpaceMouseF5Event:
- self->mySpaceMouseBtns[4] = *((int*)callData);
+ case SVTK::SetSMDominantCombinedSwitchEvent:
+ self->mySMDominantCombinedSwitchBtn = *((int*)callData);
return;
case SVTK::StartZoom:
}
}
}
- vtkInteractorStyle::ProcessEvents( object, event, clientData, callData );
+
+ Superclass::ProcessEvents( object, event, clientData, callData );
}
IncrementalRotate( const int incrX, const int incrY );
// custom event handling function (to handle 3d space mouse events)
- static void ProcessEvents( vtkObject* object, unsigned long event,
- void* clientData, void* callData );
+ static
+ void
+ ProcessEvents(vtkObject* object,
+ unsigned long event,
+ void* clientData,
+ void* callData );
float MotionFactor;
float RadianToDegree; // constant: for conv from deg to rad
void setCursor(const int operation);
void onSpaceMouseMove( double* data );
- void onSpaceMouseButton( int button );
+ virtual void onSpaceMouseButton( int button );
- void DecreaseGaussPointMagnification();
- void IncreaseGaussPointMagnification();
void DominantCombinedSwitch();
protected:
bool myShiftState;
int ForcedState;
- int mySpeedIncrement; // "increment" for pan/rotate/zoom operations
- int mySpaceMouseBtns[5]; // space_mouse_button assigned for functions 1..5 :
- // [1] Decrease Speed Increment
- // [2] Increase Speed Increment
- // [3] Decrease Gauss Point Magnification
- // [4] Increase Gauss Point Magnification
- // [5] Dominant Combined Switch
+ // "increment" for pan/rotate/zoom operations
+ int mySpeedIncrement;
+
+ // SpaceMouse short cuts
+ int mySMDecreaseSpeedBtn;
+ int mySMIncreaseSpeedBtn;
+ int mySMDominantCombinedSwitchBtn;
QWidget* myRenderWidget;
vtkSmartPointer<SVTK_GenericRenderWindowInteractor> myInteractor;