bool Interactor2DMeasure::ProcessMouseUpEvent( QMouseEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;
  UpdateCursor( event, renderview );

  if ( m_bDrawing )
  {
    if ( ( m_nAction == MM_Spline || m_nAction == MM_Polyline ) && m_region )
    {
      return false;
    }

    if ( m_nMousePosX != event->x() || m_nMousePosY != event->y() )
    {
      m_nMousePosX = event->x();
      m_nMousePosY = event->y();

      //    if ( event->LeftUp() )

//     LayerCollection* lc = MainWindow::GetMainWindowPointer()->GetLayerCollection( "MRI" );
//     LayerVolumeBase* mri = ( LayerVolumeBase* )lc->GetActiveLayer();
//     mri->SendBroadcast( "LayerEdited", mri );
      if ( m_region )
      {
        if ( m_nAction == MM_Line )
        {
          ((Region2DLine*)m_region)->SetPoint2( m_nMousePosX, m_nMousePosY );
        }
        else if ( m_nAction == MM_Rectangle )
        {
          ((Region2DRectangle*)m_region)->SetBottomRight( m_nMousePosX, m_nMousePosY );
        }
      }
    }
    else
    {
      if ( m_region && m_nAction != MM_Polyline && m_nAction != MM_Spline )
      {
        view->DeleteRegion( m_region );
        m_region = NULL;
      }
    }

    m_bEditing = false;
    m_bDrawing = false;
    return false;
  }
  else if ( m_bEditing )
  {
    m_bEditing = false;
    m_bDrawing = false;
    return false;
  }
  else
  {
    return Interactor2D::ProcessMouseUpEvent( event, renderview );
  }
}
bool Interactor2DMeasure::ProcessKeyDownEvent( QKeyEvent* event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;
  UpdateCursor( event, renderview );

  if ( m_region && event->key() == Qt::Key_Delete )
  {
    view->DeleteRegion( m_region );
    m_region = NULL;
    return false;
  }
  else
  {
    return Interactor2D::ProcessKeyDownEvent( event, renderview );
  }
}
bool Interactor2DMeasure::ProcessKeyDownEvent( wxKeyEvent& event, RenderView* renderview )
{
  RenderView2D* view = ( RenderView2D* )renderview;
  UpdateCursor( event, renderview );

  if ( m_region && ( event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_NUMPAD_DELETE ) )
  {
    view->DeleteRegion( m_region );
    m_region = NULL;
    return false;
  }
  else
  {
    return Interactor2D::ProcessKeyDownEvent( event, renderview );
  }
}