X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FWorkspace.cxx;h=b37c2caa8b5c92d2418c6450515389847350f3a3;hb=1b600247da314fe62d007ca8a0ce24d0006931f4;hp=67eaf0a677b3937809c3f5431fc9023a68aea909;hpb=e992c2468610352a34187d9180e2e8f3fd3a6e68;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Workspace.cxx b/lib/cpPlugins/Interface/Workspace.cxx index 67eaf0a..b37c2ca 100644 --- a/lib/cpPlugins/Interface/Workspace.cxx +++ b/lib/cpPlugins/Interface/Workspace.cxx @@ -1,9 +1,12 @@ #include +#include +#include // ------------------------------------------------------------------------- cpPlugins::Interface::Workspace:: Workspace( ) - : m_Plugins( NULL ) + : m_Plugins( NULL ), + m_MPRViewer( NULL ) { this->m_Graph = TGraph::New( ); } @@ -103,11 +106,12 @@ HasFilter( const std::string& name ) const } // ------------------------------------------------------------------------- -bool cpPlugins::Interface::Workspace:: +cpPlugins::Interface::Workspace:: +TFilter* cpPlugins::Interface::Workspace:: CreateFilter( const std::string& filter, const std::string& name ) { if( this->m_Plugins == NULL ) - return( false ); + return( NULL ); // Get or create new filter from name if( !( this->m_Graph->HasVertexIndex( name ) ) ) @@ -116,15 +120,17 @@ CreateFilter( const std::string& filter, const std::string& name ) if( f.IsNotNull( ) ) { f->SetName( name ); + f->SetSingleInteractor( this->m_SingleInteractor ); + f->SetMPRViewer( this->m_MPRViewer ); + TObject::Pointer o = f.GetPointer( ); this->m_Graph->SetVertex( name, o ); - return( true ); - } - else - return( false ); + + } // fi + return( f.GetPointer( ) ); } else - return( true ); + return( this->GetFilter( name ) ); } // ------------------------------------------------------------------------- @@ -147,6 +153,50 @@ RemoveFilter( const std::string& name ) { } +// ------------------------------------------------------------------------- +vtkRenderWindowInteractor* cpPlugins::Interface::Workspace:: +GetSingleInteractor( ) +{ + return( this->m_SingleInteractor ); +} + +// ------------------------------------------------------------------------- +const vtkRenderWindowInteractor* cpPlugins::Interface::Workspace:: +GetSingleInteractor( ) const +{ + return( this->m_SingleInteractor ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Workspace:: +SetSingleInteractor( vtkRenderWindowInteractor* interactor ) +{ + this->m_SingleInteractor = interactor; +} + +// ------------------------------------------------------------------------- +cpPlugins::Interface:: +SimpleMPRWidget* cpPlugins::Interface::Workspace:: +GetMPRViewer( ) +{ + return( this->m_MPRViewer ); +} + +// ------------------------------------------------------------------------- +const cpPlugins::Interface:: +SimpleMPRWidget* cpPlugins::Interface::Workspace:: +GetMPRViewer( ) const +{ + return( this->m_MPRViewer ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Workspace:: +SetMPRViewer( cpPlugins::Interface::SimpleMPRWidget* wdg ) +{ + this->m_MPRViewer = wdg; +} + // ------------------------------------------------------------------------- bool cpPlugins::Interface::Workspace:: Connect( @@ -161,7 +211,7 @@ Connect( return( false ); // Real connection - dest->SetInput( input_name, orig->GetOutput< TData >( output_name ) ); + dest->SetInput( input_name, orig->GetOutputPort( output_name ) ); this->m_Graph->AddEdge( orig_filter, dest_filter, TConnection( output_name, input_name ) @@ -171,7 +221,7 @@ Connect( // ------------------------------------------------------------------------- bool cpPlugins::Interface::Workspace:: -Connect( TData* input_object, const std::string& input_name ) +Connect( TData::Pointer* input_object, const std::string& input_name ) { auto port = this->m_ExposedInputPorts.find( input_name ); if( port != this->m_ExposedInputPorts.end( ) ) @@ -294,7 +344,7 @@ GetExposedOutputPorts( ) const // ------------------------------------------------------------------------- std::string cpPlugins::Interface::Workspace:: -Execute( QWidget* p ) +Execute( ) { // Find sinks std::set< std::string > sinks = this->m_Graph->GetSinks( ); @@ -303,7 +353,7 @@ Execute( QWidget* p ) std::string err = ""; for( auto sIt = sinks.begin( ); sIt != sinks.end( ); ++sIt ) { - std::string lerr = this->Execute( *sIt, p ); + std::string lerr = this->Execute( *sIt ); if( lerr != "" ) err += lerr + std::string( "\n" ); @@ -313,7 +363,7 @@ Execute( QWidget* p ) // ------------------------------------------------------------------------- std::string cpPlugins::Interface::Workspace:: -Execute( const std::string& name, QWidget* p ) +Execute( const std::string& name ) { // Get filter TFilter* f = this->GetFilter( name ); @@ -324,16 +374,7 @@ Execute( const std::string& name, QWidget* p ) ); // Execute and return - if( p != NULL ) - { - auto diag_res = f->ExecConfigurationDialog( p ); - if( diag_res == TFilter::DialogResult_NoModal ) - return( f->Update( ) ); - else - return( "" ); - } - else - return( f->Update( ) ); + return( f->Update( ) ); } // eof - $RCSfile$