Exemplo n.º 1
0
bool Interactor2D::ProcessKeyDownEvent( QKeyEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;

  if ( MainWindow::GetMainWindow()->IsEmpty() )
  {
    return Interactor::ProcessKeyDownEvent( event, renderview );
  }

  int nKeyCode = event->key();
  if ( event->modifiers() & Qt::ShiftModifier )
  {
      if ( nKeyCode == Qt::Key_Up )
      {
        view->Zoom(1.05);
      }
      else if ( nKeyCode == Qt::Key_Down )
      {
        view->Zoom(0.95);
      }
  }
  else if ( nKeyCode == Qt::Key_PageUp )
  {
    view->MoveSlice( 1 );
  }
  else if ( nKeyCode == Qt::Key_PageDown )
  {
    view->MoveSlice( -1 );
  }
  else if ( nKeyCode == Qt::Key_Up )
  {
    view->MoveUp();
  }
  else if ( nKeyCode == Qt::Key_Down )
  {
    view->MoveDown();
  }
  else if ( nKeyCode == Qt::Key_Left )
  {
    view->MoveLeft();
  }
  else if ( nKeyCode == Qt::Key_Right )
  {
    view->MoveRight();
  }
  else if ( nKeyCode == Qt::Key_3 /*|| nKeyCode == 'W' || nKeyCode == 'S'*/ || nKeyCode == Qt::Key_R || nKeyCode == Qt::Key_F )
  {
    // do nothing, just intercept these vtk default keycodes
  }
  else
  {
    return Interactor::ProcessKeyDownEvent( event, view );
  }

  return false;
}
Exemplo n.º 2
0
bool Interactor2D::ProcessKeyDownEvent( wxKeyEvent& event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;

  LayerCollectionManager* lcm = MainWindow::GetMainWindowPointer()->GetLayerCollectionManager();
  if ( !lcm->HasAnyLayer() )
  {
    return Interactor::ProcessKeyDownEvent( event, renderview );
  }

  int nKeyCode = event.GetKeyCode();
  if ( nKeyCode == WXK_PAGEUP )
  {
    view->MoveSlice( 1 );
  }
  else if ( nKeyCode == WXK_PAGEDOWN)
  {
    view->MoveSlice( -1 );
  }
  else if ( nKeyCode == WXK_UP )
  {
    view->MoveUp();
  }
  else if ( nKeyCode == WXK_DOWN )
  {
    view->MoveDown();
  }
  else if ( nKeyCode == WXK_LEFT )
  {
    view->MoveLeft();
  }
  else if ( nKeyCode == WXK_RIGHT )
  {
    view->MoveRight();
  }
  else if ( nKeyCode == '3' /*|| nKeyCode == 'W' || nKeyCode == 'S'*/ || nKeyCode == 'R' || nKeyCode == 'F' )
  {
    // do nothing, just intercept these vtk default keycodes
  }
  else
    return Interactor::ProcessKeyDownEvent( event, view );

  return false;
}