예제 #1
0
bool Interactor2DNavigate::ProcessMouseDownEvent( QMouseEvent* event, RenderView* renderview )
{
  if (m_nCurrentLandmark < 0)
    return Interactor2D::ProcessMouseDownEvent(event, renderview);

  RenderView2D* view = ( RenderView2D* )renderview;

  if ( event->button() == Qt::LeftButton )
  {
    if ( event->modifiers() & CONTROL_MODIFIER && event->modifiers() & Qt::ShiftModifier )
    {
      return Interactor2D::ProcessMouseDownEvent( event, renderview );
    }

    LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer("Landmarks");
    if ( !landmarks )
    {
      emit Error( "Landmarks non-exist", landmarks );
    }
    else
    {
      m_bEditing = true;
      double pos[3];
      view->MousePositionToRAS( event->x(), event->y(), pos );
      landmarks->SetLandmarkPosition(m_nCurrentLandmark, pos);
    }

    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseDownEvent( event, renderview );  // pass down the event
  }
}
예제 #2
0
bool Interactor2DNavigate::ProcessMouseMoveEvent( QMouseEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;
  if ( m_bEditing && m_nCurrentLandmark >= 0 )
  {
    UpdateCursor( event, view );
    LayerLandmarks* landmarks = (LayerLandmarks*)MainWindow::GetMainWindow()->GetSupplementLayer("Landmarks");
    if ( landmarks )
    {
      double pos[3];
      view->MousePositionToRAS( event->x(), event->y(), pos );
      landmarks->SetLandmarkPosition(m_nCurrentLandmark, pos);
    }
    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseMoveEvent( event, renderview );
  }
}