]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/Workspace.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / Workspace.cxx
index d1d2c0daa7b412935ce6c4909b1ccdfc4b879c2d..faef957a1aa042ff1285d46b2b099c14e57617de 100644 (file)
@@ -44,6 +44,24 @@ GetFilter( const std::string& name ) const
     return( NULL );
 }
 
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Workspace::
+TWidget* cpPlugins::Interface::Workspace::
+GetWidget( const std::string& name )
+{
+  TProcess* process = this->GetFilter( name );
+  return( dynamic_cast< TWidget* >( process ) );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::Workspace::
+TWidget* cpPlugins::Interface::Workspace::
+GetWidget( const std::string& name ) const
+{
+  const TProcess* process = this->GetFilter( name );
+  return( dynamic_cast< const TWidget* >( process ) );
+}
+
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::Workspace::
 HasFilter( const std::string& name ) const
@@ -51,6 +69,14 @@ HasFilter( const std::string& name ) const
   return( this->m_Filters.find( name ) != this->m_Filters.end( ) );
 }
 
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::Workspace::
+HasWidget( const std::string& name ) const
+{
+  const TWidget* wdg = this->GetWidget( name );
+  return( wdg != NULL );
+}
+
 // -------------------------------------------------------------------------
 cpPlugins::Interface::Workspace::
 TProcess* cpPlugins::Interface::Workspace::
@@ -324,12 +350,17 @@ GetConnections(
     {
       for( auto i = ins.begin( ); i != ins.end( ); ++i )
       {
-        auto od = orig->GetOutput( *o );
-        auto id = dest->GetInput( *i );
-        if( od != NULL && od == id )
-          conns.push_back(
-            std::pair< std::string, std::string >( *o, *i )
-            );
+        unsigned int nInputs = dest->GetInputSize( *i );
+        for( unsigned j = 0; j < nInputs; ++j )
+        {
+          auto od = orig->GetOutput( *o );
+          auto id = dest->GetInput( *i, j );
+          if( od != NULL && od == id )
+            conns.push_back(
+              std::pair< std::string, std::string >( *o, *i )
+              );
+
+        } // rof
 
       } // rof