]> Creatis software - cpPlugins.git/blob - plugins/cpPluginsMeshFilters/AppendMeshesFilter.cxx
...
[cpPlugins.git] / plugins / cpPluginsMeshFilters / AppendMeshesFilter.cxx
1 #include <cpPluginsMeshFilters/AppendMeshesFilter.h>
2 #include <cpPlugins/Mesh.h>
3
4 #include <vtkAppendPolyData.h>
5
6 // -------------------------------------------------------------------------
7 cpPluginsMeshFilters::AppendMeshesFilter::
8 AppendMeshesFilter( )
9   : Superclass( )
10 {
11   this->_AddInput( "Input0" );
12   this->_AddInput( "Input1" );
13   this->_AddInput( "Input2", false );
14   this->_AddInput( "Input3", false );
15   this->_AddInput( "Input4", false );
16   this->_AddInput( "Input5", false );
17   this->_AddOutput< cpPlugins::Mesh >( "Output" );
18 }
19
20 // -------------------------------------------------------------------------
21 cpPluginsMeshFilters::AppendMeshesFilter::
22 ~AppendMeshesFilter( )
23 {
24 }
25
26 // -------------------------------------------------------------------------
27 void cpPluginsMeshFilters::AppendMeshesFilter::
28 _GenerateData( )
29 {
30   auto m0 = this->GetInputData( "Input0" )->GetVTK< vtkPolyData >( );
31   auto m1 = this->GetInputData( "Input1" )->GetVTK< vtkPolyData >( );
32   auto m2 = this->GetInputData( "Input2" );
33   auto m3 = this->GetInputData( "Input3" );
34   auto m4 = this->GetInputData( "Input4" );
35   auto m5 = this->GetInputData( "Input5" );
36
37   if( m0 == NULL || m1 == NULL )
38     this->_Error( "Invalid inputs." );
39
40   auto filter = this->_CreateVTK< vtkAppendPolyData >( );
41   filter->AddInputData( m0 );
42   filter->AddInputData( m1 );
43   if( m2 != NULL ) filter->AddInputData( m2->GetVTK< vtkPolyData >( ) );
44   if( m3 != NULL ) filter->AddInputData( m3->GetVTK< vtkPolyData >( ) );
45   if( m4 != NULL ) filter->AddInputData( m4->GetVTK< vtkPolyData >( ) );
46   if( m5 != NULL ) filter->AddInputData( m5->GetVTK< vtkPolyData >( ) );
47   filter->Update( );
48
49   this->GetOutputData( "Output" )->SetVTK( filter->GetOutput( ) );
50 }
51
52 // eof - $RCSfile$