void FlyThrough::OnTimer(void) { vtkRenderWindowInteractor *rwi = Interactor; int Pos[2]; rwi->GetEventPosition(Pos); bool matchedUpState = true; switch (State) { case VTKIS_ROTATE: RotateAboutCamera3D(Pos[0], Pos[1]); rwi->CreateTimer(VTKI_TIMER_UPDATE); break; case VTKIS_PAN: PanCamera3D(Pos[0], Pos[1]); rwi->CreateTimer(VTKI_TIMER_UPDATE); break; case VTKIS_ZOOM: DollyCameraAndFocus3D(Pos[0], Pos[1]); rwi->CreateTimer(VTKI_TIMER_UPDATE); break; default: matchedUpState = false; break; } if (!matchedUpState && shouldSpin) { VisWindow *vw = proxy; if(!vw->GetSpinModeSuspended()) { if (vw->GetSpinMode()) { OldX = spinOldX; OldY = spinOldY; RotateAboutCamera3D(spinNewX, spinNewY); rwi->CreateTimer(VTKI_TIMER_UPDATE); } else { DisableSpinMode(); } } else if(vw->GetSpinMode()) { // Don't mess with the camera, just create another timer so // we keep getting into this method until spin mode is no // longer suspended. rwi->CreateTimer(VTKI_TIMER_UPDATE); } } }
void Zoom3D::EnableSpinMode(void) { VisWindow *vw = proxy; if (vw->GetSpinMode()) { shouldSpin = true; // // VTK will not be happy unless we enter one of its pre-defined modes. // Timer seems as appropriate as any (there idea of spin is much // different than ours). Also, set up the first timer so our spinning // can get started. // StartTimer(); vtkRenderWindowInteractor *rwi = Interactor; rwi->CreateTimer(VTKI_TIMER_UPDATE); } }