X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FCutter.cxx;h=a6a916cbd48f129f92bb30ef916236473c3d161e;hb=6ffc11d77924d6ab7e94db95d41105982ac73e00;hp=0ae95d51673527840f7336efe16563744cb247ad;hpb=4f6c47b5d9994cd1bbb601bfe8bc087a0a619e72;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx b/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx index 0ae95d5..a6a916c 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx @@ -5,42 +5,23 @@ #include #include -// ------------------------------------------------------------------------- -vtkAlgorithm* cpPlugins::BasicFilters::Cutter:: -GetVTKAlgorithm( ) -{ - return( this->m_Algorithm ); -} -// ------------------------------------------------------------------------- -const vtkAlgorithm* cpPlugins::BasicFilters::Cutter:: -GetVTKAlgorithm( ) const -{ - return( this->m_Algorithm ); -} +#include // ------------------------------------------------------------------------- cpPlugins::BasicFilters::Cutter:: Cutter( ) - : Superclass( ), - m_Algorithm( NULL ) + : Superclass( ) { - this->m_ClassName = "cpPlugins::BasicFilters::Cutter"; - this->m_ClassCategory = "MeshToMeshFilter"; - - this->SetNumberOfInputs( 2 ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 ); - - this->m_Parameters = this->m_DefaultParameters; + this->_AddInput( "InputMesh" ); + this->_AddInput( "InputFunction" ); + this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" ); } // ------------------------------------------------------------------------- cpPlugins::BasicFilters::Cutter:: ~Cutter( ) { - if( this->m_Algorithm != NULL ) - this->m_Algorithm->Delete( ); } // ------------------------------------------------------------------------- @@ -48,27 +29,22 @@ std::string cpPlugins::BasicFilters::Cutter:: _GenerateData( ) { // Get inputs - cpPlugins::Interface::Mesh* mesh = - this->GetInput< cpPlugins::Interface::Mesh >( 0 ); - cpPlugins::Interface::ImplicitFunction* function = - this->GetInput< cpPlugins::Interface::ImplicitFunction >( 1 ); - if( function == NULL ) - return( "Cutter: Input data 1 is not a valid implicit function." ); - - if( this->m_Algorithm != NULL ) - this->m_Algorithm->Delete( ); - - vtkCutter* cutter = vtkCutter::New( ); - cutter->SetInputData( mesh->GetVTKMesh( ) ); - cutter->SetCutFunction( function->GetVTKImplicitFunction( ) ); + auto mesh = this->GetInputData< cpPlugins::Interface::Mesh >( "InputMesh" ); + auto function = + this->GetInputData< cpPlugins::Interface::ImplicitFunction >( + "InputFunction" + ); + vtkCutter* cutter = this->_CreateVTK< vtkCutter >( ); + cutter->DebugOn( ); + cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) ); + cutter->SetCutFunction( function->GetVTK< vtkImplicitFunction >( ) ); + cutter->SetValue( 0, 1 ); cutter->GenerateTrianglesOff( ); - this->m_Algorithm = cutter; + cutter->Update( ); // Execute filter - this->m_Algorithm->Update( ); - cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( 0 ); - out->SetVTKMesh( this->m_Algorithm->GetOutput( ) ); + auto out = this->GetOutputData< cpPlugins::Interface::Mesh >( "Output" ); + out->SetVTK( cutter->GetOutput( ) ); return( "" ); }