]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
Parameters are now part of the pipeline update process
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / Cutter.cxx
1 #include "Cutter.h"
2 #include <cpPlugins/Interface/ImplicitFunction.h>
3 #include <cpPlugins/Interface/Mesh.h>
4
5 #include <vtkCutter.h>
6 #include <vtkProperty.h>
7
8
9 #include <vtkPlane.h>
10
11 // -------------------------------------------------------------------------
12 cpPlugins::BasicFilters::Cutter::
13 Cutter( )
14   : Superclass( )
15 {
16   this->SetNumberOfInputs( 2 );
17   this->SetNumberOfOutputs( 1 );
18   this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 );
19 }
20
21 // -------------------------------------------------------------------------
22 cpPlugins::BasicFilters::Cutter::
23 ~Cutter( )
24 {
25 }
26
27 // -------------------------------------------------------------------------
28 std::string cpPlugins::BasicFilters::Cutter::
29 _GenerateData( )
30 {
31   // Get inputs
32   cpPlugins::Interface::Mesh* mesh =
33     this->GetInput< cpPlugins::Interface::Mesh >( 0 );
34   cpPlugins::Interface::ImplicitFunction* function =
35     this->GetInput< cpPlugins::Interface::ImplicitFunction >( 1 );
36   if( function == NULL )
37     return( "Cutter: Input data 1 is not a valid implicit function." );
38
39   vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
40   cutter->DebugOn( );
41   cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
42   cutter->SetCutFunction( function->GetVTK< vtkImplicitFunction >( ) );
43   cutter->SetValue( 0, 1 );
44   cutter->GenerateTrianglesOff( );
45   cutter->Update( );
46
47   // Execute filter
48   cpPlugins::Interface::Mesh* out =
49     this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
50   out->SetVTK( cutter->GetOutput( ) );
51
52   return( "" );
53 }
54
55 // eof - $RCSfile$