]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Interface/ProcessObject.cxx
...
[cpPlugins.git] / lib / cpPlugins / Interface / ProcessObject.cxx
index 7ed9dfc01732f45c1b51c985a416e27334f683ed..5434319fb09c1d9e7a8b47169e15185d83cda862 100644 (file)
@@ -3,6 +3,7 @@
 #ifdef cpPlugins_Interface_QT4
 #include <QApplication>
 #include <cpPlugins/Interface/ParametersQtDialog.h>
+#include <cpPlugins/Interface/SimpleMPRWidget.h>
 #endif // cpPlugins_Interface_QT4
 
 #include <vtkRenderWindowInteractor.h>
@@ -45,7 +46,9 @@ GetNumberOfOutputs( ) const
 
 // -------------------------------------------------------------------------
 bool cpPlugins::Interface::ProcessObject::
-SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
+SetInput(
+  const std::string& id, cpPlugins::Interface::DataObject::Pointer* dobj
+  )
 {
   _TDataContainer::iterator i = this->m_Inputs.find( id );
   if( i != this->m_Inputs.end( ) )
@@ -68,9 +71,9 @@ Update( )
   _TDataContainer::iterator i = this->m_Inputs.begin( );
   for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
   {
-    if( i->second.IsNotNull( ) )
+    if( i->second->IsNotNull( ) )
     {
-      Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
+      Self* src = dynamic_cast< Self* >( ( *( i->second ) )->GetSource( ) );
       if( src != NULL )
         r = src->Update( );
     }
@@ -93,26 +96,52 @@ DisconnectOutputs( )
 {
   _TDataContainer::iterator i = this->m_Outputs.begin( );
   for( ; i != this->m_Outputs.end( ); ++i )
-    if( i->second.IsNotNull( ) )
-      i->second->DisconnectPipeline( );
+    if( i->second->IsNotNull( ) )
+      ( *( i->second ) )->DisconnectPipeline( );
 }
 
 // -------------------------------------------------------------------------
-const cpPlugins::Interface::ProcessObject::
-TInteractors& cpPlugins::Interface::ProcessObject::
-GetInteractors( ) const
+vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject::
+GetSingleInteractor( )
 {
-  return( this->m_Interactors );
+  return( this->m_SingleInteractor );
+}
+
+// -------------------------------------------------------------------------
+const vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject::
+GetSingleInteractor( ) const
+{
+  return( this->m_SingleInteractor );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ProcessObject::
-AddInteractor( vtkRenderWindowInteractor* interactor )
+SetSingleInteractor( vtkRenderWindowInteractor* interactor )
 {
-  this->m_Interactors.insert( interactor );
-#ifdef cpPlugins_Interface_QT4
-  this->m_ParametersDialog->addInteractor( interactor );
-#endif // cpPlugins_Interface_QT4
+  this->m_SingleInteractor = interactor;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::ProcessObject::
+GetMPRViewer( )
+{
+  return( this->m_MPRViewer );
+}
+
+// -------------------------------------------------------------------------
+const cpPlugins::Interface::
+SimpleMPRWidget* cpPlugins::Interface::ProcessObject::
+GetMPRViewer( ) const
+{
+  return( this->m_MPRViewer );
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::ProcessObject::
+SetMPRViewer( cpPlugins::Interface::SimpleMPRWidget* wdg )
+{
+  this->m_MPRViewer = wdg;
 }
 
 // -------------------------------------------------------------------------
@@ -137,7 +166,8 @@ ExecConfigurationDialog( QWidget* parent )
 cpPlugins::Interface::ProcessObject::
 ProcessObject( )
   : Superclass( ),
-    m_ParametersDialog( NULL )
+    m_ParametersDialog( NULL ),
+    m_MPRViewer( NULL )
 {
   this->m_Parameters = TParameters::New( );
   this->m_Parameters->SetProcessObject( this );
@@ -156,17 +186,31 @@ cpPlugins::Interface::ProcessObject::
   if( this->m_ParametersDialog != NULL )
     delete this->m_ParametersDialog;
 #endif // cpPlugins_Interface_QT4
+
+  /*
+    auto iIt = this->m_Inputs.begin( );
+    for( ; iIt != this->m_Inputs.end( ); ++iIt )
+    delete iIt->second;
+    this->m_Inputs.clear( );
+  */
+
+  auto oIt = this->m_Outputs.begin( );
+  for( ; oIt != this->m_Outputs.end( ); ++oIt )
+    delete oIt->second;
+  this->m_Outputs.clear( );
 }
 
 // -------------------------------------------------------------------------
 void cpPlugins::Interface::ProcessObject::
 _AddInput( const std::string& name )
 {
-  this->m_Inputs[ name ] = NULL;
-  this->Modified( );
-}
+  auto i = this->m_Inputs.find( name );
+  if( i == this->m_Inputs.end( ) )
+  {
+    this->m_Inputs[ name ] = NULL;
+    this->Modified( );
 
-// -------------------------------------------------------------------------
-CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 );
+  } // fi
+}
 
 // eof - $RCSfile$