X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FIO%2FMeshReader.cxx;h=27d8f559e7601e352be172245a76fe2f768c46ca;hb=273699a71c538630c162de031f0c95014319311d;hp=e6bba2bd4045ef4e3d2fb2df571ebf7042ae4e5d;hpb=d1d816d1eaf980d5cd266798b8f7a0bbb089a383;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/IO/MeshReader.cxx b/lib/cpPlugins/Plugins/IO/MeshReader.cxx index e6bba2b..27d8f55 100644 --- a/lib/cpPlugins/Plugins/IO/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/IO/MeshReader.cxx @@ -4,15 +4,17 @@ #include #include +/* TODO #ifdef cpPlugins_Interface_QT4 #include #endif // cpPlugins_Interface_QT4 // ------------------------------------------------------------------------- -bool cpPlugins::IO::MeshReader:: +cpPlugins::IO::MeshReader:: +DialogResult cpPlugins::IO::MeshReader:: ExecConfigurationDialog( QWidget* parent ) { - bool r = false; + DialogResult r = Self::DialogResult_Cancel; #ifdef cpPlugins_Interface_QT4 @@ -23,18 +25,12 @@ ExecConfigurationDialog( QWidget* parent ) 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 ); - */ + this->m_Parameters->SetString( "FileName", names[ 0 ].toStdString( ) ); + this->m_Parameters->SetSelectedChoice( "PixelType", "float" ); + this->m_Parameters->SetUint( "Dimension", 3 ); - r = true; + r = Self::DialogResult_NoModal; } // fi @@ -42,25 +38,23 @@ ExecConfigurationDialog( QWidget* parent ) return( r ); } +*/ // ------------------------------------------------------------------------- cpPlugins::IO::MeshReader:: MeshReader( ) : Superclass( ) { - this->m_ClassName = "cpPlugins::IO::MeshReader"; - this->m_ClassCategory = "MeshReader"; + this->_AddOutput< cpPlugins::Interface::Mesh >( "Output" ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Mesh >( 0 ); + std::vector< TParameters::TString > valid_types; + valid_types.push_back( "float" ); + valid_types.push_back( "double" ); + this->m_Parameters->ConfigureAsOpenFileName( "FileName" ); + this->m_Parameters->ConfigureAsChoices( "PixelType", valid_types ); + this->m_Parameters->ConfigureAsUint( "Dimension" ); - using namespace cpPlugins::Interface; - this->m_DefaultParameters.Configure( Parameters::String, "FileName" ); - this->m_DefaultParameters.Configure( Parameters::String, "PixelType" ); - this->m_DefaultParameters.Configure( Parameters::Uint, "Dimension" ); - this->m_DefaultParameters.SetValueAsString( "PixelType", "float" ); - this->m_DefaultParameters.SetValueAsUint( "Dimension", 3 ); - this->m_Parameters = this->m_DefaultParameters; + this->m_Parameters->SetUint( "Dimension", 3 ); } // ------------------------------------------------------------------------- @@ -74,7 +68,7 @@ std::string cpPlugins::IO::MeshReader:: _GenerateData( ) { using namespace cpPlugins::Interface; - Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" ); + Parameters::TUint dim = this->m_Parameters->GetUint( "Dimension" ); std::string r = "MeshReader: Mesh dimension not supported."; if( dim == 2 ) r = this->_GD0< 2 >( ); @@ -89,7 +83,8 @@ std::string cpPlugins::IO::MeshReader:: _GD0( ) { using namespace cpPlugins::Interface; - Parameters::TString pt = this->m_Parameters.GetValueAsString( "PixelType" ); + Parameters::TString pt = + this->m_Parameters->GetSelectedChoice( "PixelType" ); std::string r = "MeshReader: Mesh pixel type not supported"; if( pt == "float" ) r = this->_GD1< float, D >( ); else if( pt == "double" ) r = this->_GD1< double, D >( ); @@ -102,16 +97,14 @@ std::string cpPlugins::IO::MeshReader:: _GD1( ) { // Get filename - using namespace cpPlugins::Interface; - Parameters::TString fname = - this->m_Parameters.GetValueAsString( "FileName" ); + std::string fname = this->m_Parameters->GetOpenFileName( "FileName" ); vtkPolyDataReader* pdr = this->_CreateVTK< vtkPolyDataReader >( ); pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); cpPlugins::Interface::Mesh* out = - this->GetOutput< cpPlugins::Interface::Mesh >( 0 ); + this->GetOutput< cpPlugins::Interface::Mesh >( "Output" ); if( out != NULL ) out->SetVTK( pdr->GetOutput( ) ); else