//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
-::setGUIWindow(QWidget* theWindow)
+::SetRenderWidget(QWidget* theWidget)
{
- myGUIWindow = theWindow;
+ myRenderWidget = theWidget;
}
//----------------------------------------------------------------------------
cam->Elevation(ryf);
cam->OrthogonalizeViewUp();
::ResetCameraClippingRange(this->CurrentRenderer);
- //this->Interactor->Render();
- myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
//----------------------------------------------------------------------------
::PanXY(int x, int y, int oldX, int oldY)
{
TranslateView(x, y, oldX, oldY);
- //this->Interactor->Render();
- myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
::ResetCameraClippingRange(this->CurrentRenderer);
}
- //this->Interactor->Render();
- myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
//----------------------------------------------------------------------------
cam->Roll(newAngle - oldAngle);
cam->OrthogonalizeViewUp();
- //this->Interactor->Render();
- myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
onOperation(QPoint(x, y));
else if (ForcedState == VTK_INTERACTOR_STYLE_CAMERA_NONE)
onCursorMove(QPoint(x, y));
-
- if( needsRedrawing() )
- emit RenderWindowModified() ;
}
SVTK_InteractorStyle
::eventFilter(QObject* object, QEvent* event)
{
- if (!myGUIWindow) return false;
- if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myGUIWindow)
+ if (!myRenderWidget) return false;
+ if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myRenderWidget)
{
qApp->removeEventFilter(this);
startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
if (myViewWindow) myViewWindow->onFitAll();
- if (myGUIWindow) myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
qApp->installEventFilter(this);
}
-//----------------------------------------------------------------------------
-// returns TRUE if needs redrawing
-bool
-SVTK_InteractorStyle
-::needsRedrawing()
-{
- return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM ||
- State == VTK_INTERACTOR_STYLE_CAMERA_PAN ||
- State == VTK_INTERACTOR_STYLE_CAMERA_ROTATE ||
- State == VTK_INTERACTOR_STYLE_CAMERA_SPIN ||
- State == VTK_INTERACTOR_STYLE_CAMERA_NONE;
-}
-
-
//----------------------------------------------------------------------------
// fits viewer contents to rect
void
::ResetCameraClippingRange(this->CurrentRenderer);
}
- myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
SVTK_InteractorStyle
::setCursor(const int operation)
{
- if (!myGUIWindow) return;
+ if (!myRenderWidget) return;
switch (operation)
{
case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
- myGUIWindow->setCursor(myZoomCursor);
+ myRenderWidget->setCursor(myZoomCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_PAN:
- myGUIWindow->setCursor(myPanCursor);
+ myRenderWidget->setCursor(myPanCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
- myGUIWindow->setCursor(myRotateCursor);
+ myRenderWidget->setCursor(myRotateCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
- myGUIWindow->setCursor(mySpinCursor);
+ myRenderWidget->setCursor(mySpinCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN:
- myGUIWindow->setCursor(myGlobalPanCursor);
+ myRenderWidget->setCursor(myGlobalPanCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
- myGUIWindow->setCursor(myHandCursor);
+ myRenderWidget->setCursor(myHandCursor);
myCursorState = true;
break;
case VTK_INTERACTOR_STYLE_CAMERA_NONE:
default:
- myGUIWindow->setCursor(myDefCursor);
+ myRenderWidget->setCursor(myDefCursor);
myCursorState = false;
break;
}
SVTK_InteractorStyle
::onStartOperation()
{
- if (!myGUIWindow) return;
+ if (!myRenderWidget) return;
// VSV: LOD actor activisation
// this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
switch (State) {
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
- QPainter p(myGUIWindow);
+ QPainter p(myRenderWidget);
p.setPen(Qt::lightGray);
p.setRasterOp(Qt::XorROP);
p.drawRect(QRect(myPoint, myOtherPoint));
SVTK_InteractorStyle
::onFinishOperation()
{
- if (!myGUIWindow)
+ if (!myRenderWidget)
return;
// VSV: LOD actor activisation
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
- QPainter p(myGUIWindow);
+ QPainter p(myRenderWidget);
p.setPen(Qt::lightGray);
p.setRasterOp(Qt::XorROP);
QRect rect(myPoint, myOtherPoint);
}
break;
}
- if (myGUIWindow) myGUIWindow->update();
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
SVTK_InteractorStyle
::onOperation(QPoint mousePos)
{
- if (!myGUIWindow) return;
- int w, h;
- GetInteractor()->GetSize(w, h);
+ if (!myRenderWidget)
+ return;
+
switch (State) {
case VTK_INTERACTOR_STYLE_CAMERA_PAN:
{
- // processing panning
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
this->PanXY(mousePos.x(), myPoint.y(), myPoint.x(), mousePos.y());
myPoint = mousePos;
break;
}
case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
{
- // processing zooming
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
this->DollyXY(mousePos.x() - myPoint.x(), mousePos.y() - myPoint.y());
myPoint = mousePos;
break;
}
case VTK_INTERACTOR_STYLE_CAMERA_ROTATE:
{
- // processing rotation
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
this->RotateXY(mousePos.x() - myPoint.x(), myPoint.y() - mousePos.y());
myPoint = mousePos;
break;
}
case VTK_INTERACTOR_STYLE_CAMERA_SPIN:
{
- // processing spinning
- //this->FindPokedCamera(mousePos.x(), mousePos.y());
this->SpinXY(mousePos.x(), mousePos.y(), myPoint.x(), myPoint.y());
myPoint = mousePos;
break;
}
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
- QPainter p(myGUIWindow);
+ QPainter p(myRenderWidget);
p.setPen(Qt::lightGray);
p.setRasterOp(Qt::XorROP);
p.drawRect(QRect(myPoint, myOtherPoint));
break;
}
}
- this->LastPos[0] = mousePos.x();
- this->LastPos[1] = h - mousePos.y() - 1;
}
// called when user moves mouse inside viewer window and there is no active viewer operation
Interactor->EndPickCallback();
- if(anIsChanged){
- Interactor->CreateTimer(VTKI_TIMER_FIRST);
- //Interactor->Render();
- }
-
- this->LastPos[0] = x;
- this->LastPos[1] = y;
+ if(anIsChanged)
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
// called on finsh GlobalPan operation
cam->SetParallelScale(myScale);
::ResetCameraClippingRange(this->CurrentRenderer);
- if (myGUIWindow) myGUIWindow->update();
-
+ this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
bottomView->Initialize();
*/
myInteractorStyle = SVTK_InteractorStyle::New();
- myInteractorStyle->setGUIWindow( myView );
+ myInteractorStyle->SetRenderWidget( myView );
myInteractorStyle->setViewWindow( this );
myView->SetInteractorStyle( myInteractorStyle );
myView->setFocusPolicy( StrongFocus );
myView->setFocus();
- /*
- connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )),
- this, SLOT(onKeyPressed( QKeyEvent* )) );
- connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )),
- this, SLOT(onKeyReleased( QKeyEvent* )) );
- connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )),
- this, SLOT(onMousePressed( QMouseEvent* )) );
- connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )),
- this, SLOT(onMouseReleased( QMouseEvent* )) );
- connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )),
- this, SLOT(onMouseDoubleClicked( QMouseEvent* )) );
- connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )),
- this, SLOT(onMouseMoving( QMouseEvent* )) );
- */
-
- connect( myInteractorStyle, SIGNAL(RenderWindowModified()),
- myView, SLOT(update()) );
connect( myView, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) );