]> Creatis software - cpPlugins.git/blobdiff - appli/PipelineEditor/PipelineEditor.cxx
Actors updated
[cpPlugins.git] / appli / PipelineEditor / PipelineEditor.cxx
index 7c06aac5af584e0432a6264c967e55e090fab3bc..65fb82b7f816cd9c8403844a6c5e05b4bae47b7d 100644 (file)
@@ -1,9 +1,13 @@
 #include "PipelineEditor.h"
 #include "ui_PipelineEditor.h"
 
-#include <cpPipelineEditor/Editor.h>
-#include <cpExtensions/QT/PropertyWidget.h>
 #include <QMessageBox>
+
+#include <cpPlugins/Image.h>
+#include <cpPipelineEditor/Editor.h>
+
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
@@ -76,56 +80,26 @@ _ShowFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
-  typedef cpPlugins::DataObject _TDataObject;
-
   // Update filter, if needed
   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 output = filter->GetOutputData( output_name );
-    if( output != NULL )
-    {
-      std::string data_name = output_name + "@" + filter_name;
-      auto idata = output->GetVTK< vtkImageData >( );
-      auto mdata = output->GetVTK< vtkPolyData >( );
-      if( idata != NULL )
-      {
-        if( this->m_UI->Viewer->AddData( idata, data_name, "" ) )
-        {
-          if( this->m_UI->Viewer->GetNumberOfData( ) > 1 )
-            this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
-          else
-            this->m_UI->Viewer->SetMainImage( data_name );
-          this->_Block( );
-          this->m_UI->Viewer->ShowData( data_name );
-          this->_UnBlock( );
-
-        } // fi
-      }
-      else if( mdata != NULL )
-      {
-        if( this->m_UI->Viewer->AddData( mdata, data_name ) )
-        {
-          this->m_UI->Viewer->SetDataColor( data_name, 1, 0, 0 );
-          this->_Block( );
-          this->m_UI->Viewer->ShowData( data_name );
-          this->_UnBlock( );
-
-        } // fi
-      }
-      else
-        QMessageBox::critical(
-          this,
-          QMessageBox::tr( "Error showing data" ),
-          QMessageBox::tr( "No known VTK conversion!" )
-          );
-
-    } // fi
+    QMessageBox::critical(
+      this,
+      QMessageBox::tr( "Error showing data" ),
+      QMessageBox::tr( "Unknown port name." )
+      );
+    return;
 
   } // fi
+
+  // Create and associate actor
+  this->_Block( );
+  this->m_UI->Viewer->AddActor( output->GetVTKActor( ) );
+  this->_UnBlock( );
 }
 
 // -------------------------------------------------------------------------
@@ -135,18 +109,20 @@ _HideFilterOutput(
   )
 {
   // Get output
-  auto filter = this->m_Workspace.GetFilter( filter_name );
-  if( filter != NULL )
-  {
-    auto output = filter->GetOutputData( output_name );
-    if( output != NULL )
-    {
-      std::string data_name = output_name + "@" + filter_name;
-      this->m_UI->Viewer->HideData( data_name );
-
-    } // fi
-
-  } // fi
+  /* TODO
+     auto filter = this->m_Workspace.GetFilter( filter_name );
+     if( filter != NULL )
+     {
+     auto output = filter->GetOutputData( output_name );
+     if( output != NULL )
+     {
+     std::string data_name = output_name + "@" + filter_name;
+     this->m_UI->Viewer->HideData( data_name );
+
+     } // fi
+
+     } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -155,30 +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( output_name );
-    if( output != NULL )
-    {
-      std::string data_name = output_name + "@" + filter_name;
-      auto prop = this->m_UI->Viewer->GetProp( data_name );
-
-      cpExtensions::QT::PropertyWidget* wdg =
-        new cpExtensions::QT::PropertyWidget( NULL );
-      wdg->SetProp( prop );
-      wdg->SetRenderWindow( this->m_UI->Viewer->GetInteractor( 3 )->GetRenderWindow( ) );
-      wdg->show( );
-    }
-    else
-      QMessageBox::critical(
-        this,
-        QMessageBox::tr( "Error showing data" ),
-        QMessageBox::tr( "No known VTK conversion!" )
-        );
-
-  } // fi
+  /* 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
+     }
+     else
+     QMessageBox::critical(
+     this,
+     QMessageBox::tr( "Error showing data" ),
+     QMessageBox::tr( "No known VTK conversion!" )
+     );
+
+     } // fi
+  */
 }
 
 // eof - $RCSfile$