#include <cpPlugins/Interface/Workspace.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
+#include <vtkRenderWindowInteractor.h>
// -------------------------------------------------------------------------
cpPlugins::Interface::Workspace::
Workspace( )
- : m_Plugins( NULL )
+ : m_Plugins( NULL ),
+ m_MPRViewer( NULL )
{
this->m_Graph = TGraph::New( );
}
}
// -------------------------------------------------------------------------
-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 ) ) )
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 ) );
}
// -------------------------------------------------------------------------
{
}
+// -------------------------------------------------------------------------
+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(
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 )
// -------------------------------------------------------------------------
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( ) )
return( false );
}
-// -------------------------------------------------------------------------
-/* TODO
-cpPlugins::Interface::Workspace::
-TData* cpPlugins::Interface::Workspace::
-GetOutput( const std::string& name )
-{
- auto port = this->m_ExposedOutputPorts.find( name );
- if( port != this->m_ExposedOutputPorts.end( ) )
- {
- TFilter* f = this->GetFilter( port->second.first );
- if( f != NULL )
- return( f->GetOutput< TData >( port->second.second ) );
- else
- return( NULL );
- }
- else
- return( NULL );
-}
-
// -------------------------------------------------------------------------
const cpPlugins::Interface::Workspace::
-TData* cpPlugins::Interface::Workspace::
-GetOutput( const std::string& name ) const
+TExposedPorts& cpPlugins::Interface::Workspace::
+GetExposedInputPorts( ) const
{
- auto port = this->m_ExposedOutputPorts.find( name );
- if( port != this->m_ExposedOutputPorts.end( ) )
- {
- const TFilter* f = this->GetFilter( port->second.first );
- if( f != NULL )
- return( f->GetOutput< TData >( port->second.second ) );
- else
- return( NULL );
- }
- else
- return( NULL );
+ return( this->m_ExposedInputPorts );
}
// -------------------------------------------------------------------------
-void cpPlugins::Interface::Workspace::
-ClearInputPorts( )
-{
- this->m_ExposedInputPorts.clear( );
-}
-
-// -------------------------------------------------------------------------
-void cpPlugins::Interface::Workspace::
-ClearOutputPorts( )
+const cpPlugins::Interface::Workspace::
+TExposedPorts& cpPlugins::Interface::Workspace::
+GetExposedOutputPorts( ) const
{
- this->m_ExposedOutputPorts.clear( );
+ return( this->m_ExposedOutputPorts );
}
-*/
// -------------------------------------------------------------------------
std::string cpPlugins::Interface::Workspace::
-Execute( QWidget* p )
+Execute( )
{
// Find sinks
std::set< std::string > sinks = this->m_Graph->GetSinks( );
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" );
// -------------------------------------------------------------------------
std::string cpPlugins::Interface::Workspace::
-Execute( const std::string& name, QWidget* p )
+Execute( const std::string& name )
{
// Get filter
TFilter* f = this->GetFilter( name );
);
// 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$