X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FMeshReader.cxx;h=e6bba2bd4045ef4e3d2fb2df571ebf7042ae4e5d;hb=d1d816d1eaf980d5cd266798b8f7a0bbb089a383;hp=67069046163d768395fc55d2e23c5b8a871f6497;hpb=b23970017af98ef6617ddf40f225d4d15fa65854;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.cxx b/lib/cpPlugins/Plugins/IO/MeshReader.cxx index 6706904..e6bba2b 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshReader.cxx @@ -4,11 +4,49 @@ #include #include +#ifdef cpPlugins_Interface_QT4 +#include +#endif // cpPlugins_Interface_QT4 + +// ------------------------------------------------------------------------- +bool cpPlugins::IO::MeshReader:: +ExecConfigurationDialog( QWidget* parent ) +{ + bool r = false; + +#ifdef cpPlugins_Interface_QT4 + + // Show dialog and check if it was accepted + QFileDialog dialog( parent ); + dialog.setFileMode( QFileDialog::ExistingFile ); + dialog.setDirectory( QFileDialog::tr( "." ) ); + dialog.setNameFilter( QFileDialog::tr( "All files (*)" ) ); + if( dialog.exec( ) ) + { + this->m_Parameters = this->m_DefaultParameters; + QStringList names = dialog.selectedFiles( ); + this->m_Parameters.AddValueToStringList( + "FileNames", names[ 0 ].toStdString( ) + ); + + /* TODO + this->m_Parameters.SetValueAsString( "PixelType", "float" ); + this->m_Parameters.SetValueAsUint( "Dimension", 3 ); + */ + + r = true; + + } // fi + +#endif // cpPlugins_Interface_QT4 + + return( r ); +} + // ------------------------------------------------------------------------- cpPlugins::IO::MeshReader:: MeshReader( ) - : Superclass( ), - m_Reader( NULL ) + : Superclass( ) { this->m_ClassName = "cpPlugins::IO::MeshReader"; this->m_ClassCategory = "MeshReader"; @@ -29,8 +67,6 @@ MeshReader( ) cpPlugins::IO::MeshReader:: ~MeshReader( ) { - if( this->m_Reader != NULL ) - this->m_Reader = NULL; } // ------------------------------------------------------------------------- @@ -70,18 +106,14 @@ _GD1( ) Parameters::TString fname = this->m_Parameters.GetValueAsString( "FileName" ); - if( this->m_Reader != NULL ) - this->m_Reader->Delete( ); - - vtkPolyDataReader* pdr = vtkPolyDataReader::New( ); - this->m_Reader = pdr; + vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( ); pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); cpPlugins::Interface::Mesh* out = this->GetOutput< cpPlugins::Interface::Mesh >( 0 ); if( out != NULL ) - out->SetVTKMesh( pdr->GetOutput( ) ); + out->SetVTK( pdr->GetOutput( ) ); else return( "MeshReader: output not correctly created." ); return( "" );