]> Creatis software - cpPlugins.git/blob - plugins/IO/MeshWriter.cxx
...
[cpPlugins.git] / plugins / IO / MeshWriter.cxx
1 #include <IO/MeshWriter.h>
2 #include <cpPlugins/DataObjects/Mesh.h>
3 #include <vtkPolyDataWriter.h>
4
5 // -------------------------------------------------------------------------
6 cpPluginsIO::MeshWriter::
7 MeshWriter( )
8   : Superclass( )
9 {
10   this->_ConfigureInput< cpPlugins::DataObjects::Mesh >( "Input", true, false );
11   this->m_Parameters.Clear( );
12   this->m_Parameters.ConfigureAsSaveFileName( "FileName" );
13   this->m_Parameters.SetAcceptedFileExtensions(
14     "FileName",
15     "Mesh files (*.vtk)"
16     );
17 }
18
19 // -------------------------------------------------------------------------
20 cpPluginsIO::MeshWriter::
21 ~MeshWriter( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 void cpPluginsIO::MeshWriter::
27 _GenerateData( )
28 {
29   auto mesh = this->GetInputData< vtkPolyData >( "Input" );
30   if( mesh == NULL )
31     this->_Error( "Invalid input image." );
32
33   auto f = this->_CreateVTK< vtkPolyDataWriter >( );
34   f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ).c_str( ) );
35   f->SetInputData( mesh );
36   f->Update( );
37 }
38
39 // eof - $RCSfile$