]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/Cutter.cxx
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / Cutter.cxx
index 32a7c5a3b1e3ad1af7c1a1cdb69d52df5ba279ca..d0907b41e6429badcc34a3c3cffeb474bc9afb46 100644 (file)
@@ -5,19 +5,17 @@
 #include <vtkCutter.h>
 #include <vtkProperty.h>
 
+
+#include <vtkPlane.h>
+
 // -------------------------------------------------------------------------
 cpPlugins::BasicFilters::Cutter::
 Cutter( )
   : 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->_MakeOutput< cpPlugins::Interface::Mesh >( "Output" );
 }
 
 // -------------------------------------------------------------------------
@@ -32,21 +30,25 @@ _GenerateData( )
 {
   // Get inputs
   cpPlugins::Interface::Mesh* mesh =
-    this->GetInput< cpPlugins::Interface::Mesh >( 0 );
+    this->GetInput< cpPlugins::Interface::Mesh >( "InputMesh" );
   cpPlugins::Interface::ImplicitFunction* function =
-    this->GetInput< cpPlugins::Interface::ImplicitFunction >( 1 );
+    this->GetInput< cpPlugins::Interface::ImplicitFunction >(
+      "InputFunction"
+      );
   if( function == NULL )
     return( "Cutter: Input data 1 is not a valid implicit function." );
 
   vtkCutter* cutter = this->_CreateVTK< vtkCutter >( );
+  cutter->DebugOn( );
   cutter->SetInputData( mesh->GetVTK< vtkPolyData >( ) );
   cutter->SetCutFunction( function->GetVTK< vtkImplicitFunction >( ) );
+  cutter->SetValue( 0, 1 );
   cutter->GenerateTrianglesOff( );
   cutter->Update( );
 
   // Execute filter
   cpPlugins::Interface::Mesh* out =
-    this->GetOutput< cpPlugins::Interface::Mesh >( 0 );
+    this->GetOutput< cpPlugins::Interface::Mesh >( "Output" );
   out->SetVTK( cutter->GetOutput( ) );
 
   return( "" );