]> Creatis software - cpPlugins.git/blobdiff - plugins/MeshFilters/AppendMeshesFilter.cxx
...
[cpPlugins.git] / plugins / MeshFilters / AppendMeshesFilter.cxx
index 453c474a791cd850a1b592f70c711a9674be7f9d..16f1f8032b7ce8830deff0354c87b3f278bdbec4 100644 (file)
@@ -1,5 +1,5 @@
-#include <plugins/MeshFilters/AppendMeshesFilter.h>
-#include <cpPlugins/Mesh.h>
+#include <MeshFilters/AppendMeshesFilter.h>
+#include <cpPlugins/DataObjects/Mesh.h>
 
 #include <vtkAppendPolyData.h>
 
@@ -8,13 +8,10 @@ cpPluginsMeshFilters::AppendMeshesFilter::
 AppendMeshesFilter( )
   : Superclass( )
 {
-  this->_AddInput( "Input0" );
-  this->_AddInput( "Input1" );
-  this->_AddInput( "Input2", false );
-  this->_AddInput( "Input3", false );
-  this->_AddInput( "Input4", false );
-  this->_AddInput( "Input5", false );
-  this->_AddOutput< cpPlugins::Mesh >( "Output" );
+  typedef cpPlugins::DataObjects::Mesh _TMesh;
+
+  this->_ConfigureInput< _TMesh >( "Inputs", true, true );
+  this->_ConfigureOutput< _TMesh >( "Output" );
 }
 
 // -------------------------------------------------------------------------
@@ -27,25 +24,11 @@ cpPluginsMeshFilters::AppendMeshesFilter::
 void cpPluginsMeshFilters::AppendMeshesFilter::
 _GenerateData( )
 {
-  auto m0 = this->GetInputData< vtkPolyData >( "Input0" );
-  auto m1 = this->GetInputData< vtkPolyData >( "Input1" );
-  auto m2 = this->GetInput( "Input2" );
-  auto m3 = this->GetInput( "Input3" );
-  auto m4 = this->GetInput( "Input4" );
-  auto m5 = this->GetInput( "Input5" );
-
-  if( m0 == NULL || m1 == NULL )
-    this->_Error( "Invalid inputs." );
-
   auto filter = this->_CreateVTK< vtkAppendPolyData >( );
-  filter->AddInputData( m0 );
-  filter->AddInputData( m1 );
-  if( m2 != NULL ) filter->AddInputData( m2->GetVTK< vtkPolyData >( ) );
-  if( m3 != NULL ) filter->AddInputData( m3->GetVTK< vtkPolyData >( ) );
-  if( m4 != NULL ) filter->AddInputData( m4->GetVTK< vtkPolyData >( ) );
-  if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
+  unsigned int nInputs = this->GetInputSize( "Inputs" );
+  for( unsigned int i = 0; i < nInputs; ++i )
+    filter->AddInputData( this->GetInputData< vtkPolyData >( "Inputs", i ) );
   filter->Update( );
-
   this->GetOutput( "Output" )->SetVTK( filter->GetOutput( ) );
 }