X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FcpPluginsIO%2FMeshReader.cxx;h=3a40e4277acc32be20c875ee97ad6df1c7efc36c;hb=b2bb173d0feca93ca889a80280a1f5d2a87de402;hp=49b76a2406840e98f5a5c62ec323b2a3ad110cd4;hpb=eccc88f770fd53f8ef8d578127a8788315573c52;p=cpPlugins.git diff --git a/plugins/cpPluginsIO/MeshReader.cxx b/plugins/cpPluginsIO/MeshReader.cxx index 49b76a2..3a40e42 100644 --- a/plugins/cpPluginsIO/MeshReader.cxx +++ b/plugins/cpPluginsIO/MeshReader.cxx @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -37,29 +38,29 @@ cpPluginsIO::MeshReader:: } // ------------------------------------------------------------------------- -std::string cpPluginsIO::MeshReader:: +void cpPluginsIO::MeshReader:: _GenerateData( ) { - auto dim = this->m_Parameters.GetUint( "Dimension" ); - if ( dim == 2 ) return( this->_GD0< 2 >( ) ); - else if( dim == 3 ) return( this->_GD0< 3 >( ) ); - else return( "MeshReader: Mesh dimension not supported." ); + auto d = this->m_Parameters.GetUint( "Dimension" ); + if ( d == 2 ) this->_GD0< 2 >( ); + else if( d == 3 ) this->_GD0< 3 >( ); + else this->_Error( "Mesh dimension not supported." ); } // ------------------------------------------------------------------------- template< unsigned int _Dim > -std::string cpPluginsIO::MeshReader:: +void cpPluginsIO::MeshReader:: _GD0( ) { - auto st = this->m_Parameters.GetSelectedChoice( "ScalarType" ); - if ( st == "float" ) return( this->_GD1< float, _Dim >( ) ); - else if( st == "double" ) return( this->_GD1< double, _Dim >( ) ); - else return( "MeshReader: Mesh type not supported." ); + auto s = this->m_Parameters.GetSelectedChoice( "ScalarType" ); + if ( s == "float" ) this->_GD1< float, _Dim >( ); + else if( s == "double" ) this->_GD1< double, _Dim >( ); + else this->_Error( "Mesh type not supported." ); } // ------------------------------------------------------------------------- template< class _TScalar, unsigned int _Dim > -std::string cpPluginsIO::MeshReader:: +void cpPluginsIO::MeshReader:: _GD1( ) { auto fname = this->m_Parameters.GetOpenFileName( "FileName" ); @@ -78,8 +79,7 @@ _GD1( ) stlr->SetFileName( fname.c_str( ) ); stlr->Update( ); - this->GetOutputData( "Output" )->SetVTK( stlr->GetOutput( ) ); - return( "" ); + this->GetOutput( "Output" )->SetVTK( stlr->GetOutput( ) ); } else if( ext == "obj" ) { @@ -87,8 +87,7 @@ _GD1( ) objr->SetFileName( fname.c_str( ) ); objr->Update( ); - this->GetOutputData( "Output" )->SetVTK( objr->GetOutput( ) ); - return( "" ); + this->GetOutput( "Output" )->SetVTK( objr->GetOutput( ) ); } else if( ext == "vtk" ) { @@ -96,11 +95,10 @@ _GD1( ) pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); - this->GetOutputData( "Output" )->SetVTK( pdr->GetOutput( ) ); - return( "" ); + this->GetOutput( "Output" )->SetVTK( pdr->GetOutput( ) ); } else - return( "MeshReader: Input file format not recognized." ); + this->_Error( "Input file format not recognized." ); } // eof - $RCSfile$