//ButtonReleased
 bool OverlayManager::ButtonReleased( const OIS::JoyStickEvent& e, int button )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->PovMoved( e, button );
     }
     return false;
 }
 //SliderMoved
 bool OverlayManager::SliderMoved( const OIS::JoyStickEvent& e, int index )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->SliderMoved( e, index );
     }
     return false;
 }
 //AxisMoved
 bool OverlayManager::AxisMoved( const OIS::JoyStickEvent& e, int axis )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->AxisMoved( e, axis );
     }
     return false;
 }
 //MouseReleased
 bool OverlayManager::MouseReleased( const OIS::MouseEvent& e, OIS::MouseButtonID id )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->MouseReleased( e, id );
     }
     return false;
 }
 //MouseMoved
 bool OverlayManager::MouseMoved( const OIS::MouseEvent& e )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->MouseMoved( e );
     }
     return false;
 }
 //KeyReleased
 bool OverlayManager::KeyReleased( const OIS::KeyEvent& e )
 {
     // Get the active element:
     Overlay* active = GetActiveOverlay();
     if ( active )
     {
         return active->KeyReleased( e );
     }
     return false;
 }
示例#7
0
void LayerSurface::UpdateOverlay( bool bAskRedraw )
{
  vtkPolyDataMapper* mapper = vtkPolyDataMapper::SafeDownCast( m_mainActor->GetMapper() );
  vtkPolyData* polydata = mapper->GetInput();
  vtkPolyData* polydataWireframe = vtkPolyDataMapper::SafeDownCast( m_wireframeActor->GetMapper() )->GetInput();
  if ( m_nActiveOverlay >= 0 )
  {
    if ( mapper )
    {
      int nCount = polydata->GetPoints()->GetNumberOfPoints();
      vtkSmartPointer<vtkUnsignedCharArray> array = vtkUnsignedCharArray::SafeDownCast( polydata->GetPointData()->GetArray( "Overlay" ) );
      if ( array.GetPointer() == NULL )
      {
        array = vtkSmartPointer<vtkUnsignedCharArray>::New();
        array->SetNumberOfComponents( 4 );
        array->SetNumberOfTuples( nCount );
        array->SetName( "Overlay" );
        polydata->GetPointData()->AddArray( array );
        polydataWireframe->GetPointData()->AddArray( array );
      }
      unsigned char* data = new unsigned char[ nCount*4 ];
      GetProperty()->GetCurvatureLUT()->MapScalarsThroughTable( polydata->GetPointData()->GetScalars("Curvature"), data, VTK_RGBA );
      GetActiveOverlay()->MapOverlay( data );
      MapLabels( data, nCount );
      for ( int i = 0; i < nCount; i++ )
      {
        array->SetTupleValue( i, data + i*4 );
      }
      delete[] data;
      polydata->GetPointData()->SetActiveScalars( "Overlay" );
      if ( GetProperty()->GetMeshColorMap() == LayerPropertySurface::MC_Surface )
      {
        polydataWireframe->GetPointData()->SetActiveScalars( "Overlay" );
      }
    }
  }
  else if ( m_nActiveAnnotation >= 0 )
  {
    UpdateAnnotation( false );
  }
  else
  {
    if ( m_labels.size() == 0 || m_nActiveLabel < 0)   // no labels
    {
      polydata->GetPointData()->SetActiveScalars( "Curvature" );
      if ( GetProperty()->GetMeshColorMap() == LayerPropertySurface::MC_Surface )
      {
        polydataWireframe->GetPointData()->SetActiveScalars( "Curvature" );
      }
    }
    else
    {
      if ( mapper )
      {
        int nCount = polydata->GetPoints()->GetNumberOfPoints();
        vtkSmartPointer<vtkUnsignedCharArray> array = vtkUnsignedCharArray::SafeDownCast( polydata->GetPointData()->GetArray( "Overlay" ) );
        if ( array.GetPointer() == NULL )
        {
          array = vtkSmartPointer<vtkUnsignedCharArray>::New();
          array->SetNumberOfComponents( 4 );
          array->SetNumberOfTuples( nCount );
          array->SetName( "Overlay" );
          polydata->GetPointData()->AddArray( array );
          polydataWireframe->GetPointData()->AddArray( array );
        }
        unsigned char* data = new unsigned char[ nCount*4 ];
        GetProperty()->GetCurvatureLUT()->MapScalarsThroughTable( polydata->GetPointData()->GetScalars("Curvature"), data, VTK_RGBA );
        MapLabels( data, nCount );
        for ( int i = 0; i < nCount; i++ )
        {
          array->SetTupleValue( i, data + i*4 );
        }
        delete[] data;
        polydata->GetPointData()->SetActiveScalars( "Overlay" );
        if ( GetProperty()->GetMeshColorMap() == LayerPropertySurface::MC_Surface )
        {
          polydataWireframe->GetPointData()->SetActiveScalars( "Overlay" );
        }
      }
    }
  }
  if ( bAskRedraw )
  {
    emit ActorUpdated();
  }
}