1 #include <IO/MeshWriter.h>
2 #include <cpPlugins/DataObjects/Mesh.h>
3 #include <cpPlugins/QT/SaveFileDialog.h>
5 #include <vtkPolyData.h>
6 #include <vtkPolyDataWriter.h>
9 # include <QApplication>
10 #endif // cpPlugins_QT4
12 // -------------------------------------------------------------------------
13 QDialog* cpPluginsIO::MeshWriter::
17 cpPlugins::QT::SaveFileDialog* dlg = NULL;
18 if( QApplication::instance( ) != NULL )
20 dlg = new cpPlugins::QT::SaveFileDialog( );
21 dlg->SetParameters( &( this->m_Parameters ), "FileName" );
25 #else // cpPlugins_QT4
27 #endif // cpPlugins_QT4
30 // -------------------------------------------------------------------------
31 cpPluginsIO::MeshWriter::
35 typedef cpPlugins::DataObjects::Mesh _TMesh;
37 this->_ConfigureInput< _TMesh >( "Input", true, false );
38 this->m_Parameters.Clear( );
39 this->m_Parameters.ConfigureAsSaveFileName( "FileName", "" );
40 this->m_Parameters.SetAcceptedFileExtensions(
46 // -------------------------------------------------------------------------
47 cpPluginsIO::MeshWriter::
52 // -------------------------------------------------------------------------
53 void cpPluginsIO::MeshWriter::
56 auto mesh = this->GetInputData< vtkPolyData >( "Input" );
58 this->_Error( "Invalid input image." );
60 auto f = this->_CreateVTK< vtkPolyDataWriter >( );
61 f->SetFileName( this->m_Parameters.GetSaveFileName( "FileName" ).c_str( ) );
62 f->SetInputData( mesh );
63 f->SetFileTypeToBinary( );