]> Creatis software - cpPlugins.git/blobdiff - appli/PipelineEditor/PipelineEditor.cxx
MVC integration at 50%
[cpPlugins.git] / appli / PipelineEditor / PipelineEditor.cxx
index a4cd75e79a82be20ef74ed1d545da061eda89417..f646520e93159e9af103afc8ee7c2ce8d9dccfbd 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <QMessageBox>
 
+#include <cpPlugins/Image.h>
 #include <cpPipelineEditor/Editor.h>
-#include <cpExtensions/QT/PropertyWidget.h>
 
 #include <vtkImageData.h>
 #include <vtkPolyData.h>
@@ -84,55 +84,22 @@ _ShowFilterOutput(
   this->_ExecFilter( filter_name );
 
   // Get output
-  auto filter = this->m_Workspace.GetFilter( filter_name );
-  if( filter != NULL )
+  auto output = this->m_Workspace.GetOutput( filter_name, output_name );
+  if( output == NULL )
   {
-    auto out = filter->GetOutput( output_name );
-    if( out != NULL )
-    {
-      auto id = out->GetVTK< vtkImageData >( );
-      auto md = out->GetVTK< vtkPolyData >( );
-      if( id != NULL )
-      {
-        this->_Block( );
-        this->m_UI->Viewer->Clear( );
-        this->m_UI->Viewer->SetMainImage( id );
-        auto actors = this->m_UI->Viewer->GetMainImageActors( );
-        out->ClearVTKActors( );
-        for( auto aIt = actors.begin( ); aIt != actors.end( ); ++aIt )
-          out->AddVTKActor( aIt->first, aIt->second );
-        this->_UnBlock( );
-      }
-      else if( md != NULL )
-      {
-        this->_Block( );
-        this->m_UI->Viewer->AddMesh( md );
-        out->AddVTKActor(
-          this->m_UI->Viewer->GetActor( md ),
-          this->m_UI->Viewer->GetRenderer( 3 )
-          );
-        this->_UnBlock( );
-      }
-      else
-        QMessageBox::critical(
-          this,
-          QMessageBox::tr( "Error showing data" ),
-          QMessageBox::tr( "No known VTK conversion!" )
-          );
-    }
-    else
-      QMessageBox::critical(
-        this,
-        QMessageBox::tr( "Error showing data" ),
-        QMessageBox::tr( "Unknown port name." )
-        );
-  }
-  else
     QMessageBox::critical(
       this,
       QMessageBox::tr( "Error showing data" ),
-      QMessageBox::tr( "Unknown filter." )
+      QMessageBox::tr( "Unknown port name." )
       );
+    return;
+
+  } // fi
+
+  // Create and associate actor
+  this->_Block( );
+  this->m_UI->Viewer->AddActor( output->CreateVTKActor( ) );
+  this->_UnBlock( );
 }
 
 // -------------------------------------------------------------------------
@@ -164,34 +131,35 @@ _PropertiesFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
-  // Get output
-  auto filter = this->m_Workspace.GetFilter( filter_name );
-  if( filter != NULL )
-  {
-    auto output = filter->GetOutputData< vtkPolyData >( output_name );
-    if( output != NULL )
-    {
-      auto actor = this->m_UI->Viewer->GetActor( output );
-      if( actor != NULL )
-      {
-        cpExtensions::QT::PropertyWidget* wdg =
-          new cpExtensions::QT::PropertyWidget( NULL );
-        wdg->SetProp( actor );
-        wdg->SetRenderWindow(
-          this->m_UI->Viewer->GetInteractor( 3 )->GetRenderWindow( )
-          );
-        wdg->show( );
-
-      } // fi
-    }
-    else
-      QMessageBox::critical(
-        this,
-        QMessageBox::tr( "Error showing data" ),
-        QMessageBox::tr( "No known VTK conversion!" )
-        );
+  /* TODO
+     auto filter = this->m_Workspace.GetFilter( filter_name );
+     if( filter != NULL )
+     {
+     auto output = filter->GetOutputData< vtkPolyData >( output_name );
+     if( output != NULL )
+     {
+     auto actor = this->m_UI->Viewer->GetActor( output );
+     if( actor != NULL )
+     {
+     cpExtensions::QT::PropertyWidget* wdg =
+     new cpExtensions::QT::PropertyWidget( NULL );
+     wdg->SetProp( actor );
+     wdg->SetRenderWindow(
+     this->m_UI->Viewer->GetInteractor( 3 )->GetRenderWindow( )
+     );
+     wdg->show( );
 
-  } // fi
+     } // fi
+     }
+     else
+     QMessageBox::critical(
+     this,
+     QMessageBox::tr( "Error showing data" ),
+     QMessageBox::tr( "No known VTK conversion!" )
+     );
+
+     } // fi
+  */
 }
 
 // eof - $RCSfile$