]> Creatis software - cpPlugins.git/blobdiff - appli/PipelineEditor/PipelineEditor.cxx
...
[cpPlugins.git] / appli / PipelineEditor / PipelineEditor.cxx
index 7c06aac5af584e0432a6264c967e55e090fab3bc..0f2d3fde2d6d5cf1efc60b1010b0f7ce59f01a2e 100644 (file)
@@ -1,9 +1,13 @@
 #include "PipelineEditor.h"
 #include "ui_PipelineEditor.h"
 
+#include <QMessageBox>
+
 #include <cpPipelineEditor/Editor.h>
 #include <cpExtensions/QT/PropertyWidget.h>
-#include <QMessageBox>
+
+#include <vtkImageData.h>
+#include <vtkPolyData.h>
 #include <vtkRenderWindowInteractor.h>
 
 // -------------------------------------------------------------------------
@@ -76,8 +80,6 @@ _ShowFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
-  typedef cpPlugins::DataObject _TDataObject;
-
   // Update filter, if needed
   this->_ExecFilter( filter_name );
 
@@ -85,47 +87,34 @@ _ShowFilterOutput(
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
   {
-    auto output = filter->GetOutputData( output_name );
-    if( output != NULL )
+    auto id = filter->GetOutputData< vtkImageData >( output_name );
+    auto md = filter->GetOutputData< vtkPolyData >( output_name );
+    if( id != 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
-
-  } // fi
+      this->_Block( );
+      this->m_UI->Viewer->Clear( );
+      this->m_UI->Viewer->SetMainImage( id );
+      this->_UnBlock( );
+    }
+    else if( md != NULL )
+    {
+      this->_Block( );
+      this->m_UI->Viewer->AddMesh( md );
+      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 filter." )
+      );
 }
 
 // -------------------------------------------------------------------------
@@ -134,6 +123,7 @@ _HideFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
+  /*
   // Get output
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
@@ -147,6 +137,7 @@ _HideFilterOutput(
     } // fi
 
   } // fi
+  */
 }
 
 // -------------------------------------------------------------------------
@@ -155,6 +146,7 @@ _PropertiesFilterOutput(
   const std::string& filter_name, const std::string& output_name
   )
 {
+  /*
   // Get output
   auto filter = this->m_Workspace.GetFilter( filter_name );
   if( filter != NULL )
@@ -179,6 +171,7 @@ _PropertiesFilterOutput(
         );
 
   } // fi
+  */
 }
 
 // eof - $RCSfile$