]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Workspace.cxx
More on graph editor
[cpPlugins.git] / lib / cpPlugins / Interface / Workspace.cxx
index 4e5f51a515fa1227eff9660a2987573e3148bd69..849e7cc132cba8d8b83a57d60b772734d94f1b17 100644 (file)
@@ -105,6 +105,14 @@ GetLoadedPluginFilters( const std::string& category ) const
     return( EMPTY );
 }
 
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Workspace::
+Clear( )
+{
+  if( this->m_Graph.IsNotNull( ) )
+    this->m_Graph->Clear( );
+}
+
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Workspace::
 TGraph* cpPlugins::Interface::Workspace::
@@ -201,6 +209,30 @@ GetParameters( const std::string& name ) const
     return( NULL );
 }
 
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Workspace::
+TFilter* cpPlugins::Interface::Workspace::
+GetFilter( const std::string& name )
+{
+  TFilter* f =
+    dynamic_cast< TFilter* >(
+      this->m_Graph->GetVertex( name ).GetPointer( )
+      );
+  return( f );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::Workspace::
+TFilter* cpPlugins::Interface::Workspace::
+GetFilter( const std::string& name ) const
+{
+  const TFilter* f =
+    dynamic_cast< const TFilter* >(
+      this->m_Graph->GetVertex( name ).GetPointer( )
+      );
+  return( f );
+}
+
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Workspace::
 Reduce( const std::string& name )
@@ -219,7 +251,7 @@ Execute( )
   std::string err = "";
   for( auto sIt = sinks.begin( ); sIt != sinks.end( ); ++sIt )
   {
-    std::string lerr = this->Execute( *sIt );
+    std::string lerr = this->Execute( *sIt, NULL );
     if( lerr != "" )
       err += lerr + std::string( "\n" );
 
@@ -229,7 +261,7 @@ Execute( )
 
 // -------------------------------------------------------------------------
 std::string cpPlugins::Interface::Workspace::
-Execute( const std::string& name )
+Execute( const std::string& name, QWidget* p )
 {
   // Get filter
   TFilter* f =
@@ -243,7 +275,16 @@ Execute( const std::string& name )
       );
 
   // Execute and return
-  return( f->Update( ) );
+  if( p != NULL )
+  {
+    auto diag_res = f->ExecConfigurationDialog( p );
+    if( diag_res == TFilter::DialogResult_NoModal )
+      return( f->Update( ) );
+    else
+      return( "" );
+  }
+  else
+    return( f->Update( ) );
 }
 
 // -------------------------------------------------------------------------