X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FMeshReader.cxx;h=0528e6cd4b15d35507e630751f5d0350a77be0c3;hb=54e12e973942f6ddfe6c606acf2fd93480ca6165;hp=5338c32b3424ebd1464be2406a7144e682fb4042;hpb=9015cf98c60cf4ab304a639990004ee783a8bec0;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/MeshReader.cxx b/lib/cpPlugins/Plugins/MeshReader.cxx index 5338c32..0528e6c 100644 --- a/lib/cpPlugins/Plugins/MeshReader.cxx +++ b/lib/cpPlugins/Plugins/MeshReader.cxx @@ -7,7 +7,8 @@ // ------------------------------------------------------------------------- cpPlugins::Plugins::MeshReader:: MeshReader( ) - : Superclass( ) + : Superclass( ), + m_Reader( NULL ) { this->m_ClassName = "cpPlugins::MeshReader"; this->m_ClassCategory = "MeshReader"; @@ -28,6 +29,8 @@ MeshReader( ) cpPlugins::Plugins::MeshReader:: ~MeshReader( ) { + if( this->m_Reader != NULL ) + this->m_Reader = NULL; } // ------------------------------------------------------------------------- @@ -37,7 +40,9 @@ _GenerateData( ) using namespace cpPlugins::Interface; Parameters::TUint dim = this->m_Parameters.GetValueAsUint( "Dimension" ); std::string r = "MeshReader: Mesh dimension not supported."; - if( dim == 3 ) + if( dim == 2 ) + r = this->_GD0< 2 >( ); + else if( dim == 3 ) r = this->_GD0< 3 >( ); return( r ); } @@ -72,7 +77,13 @@ _GD1( ) this->m_Reader = pdr; pdr->SetFileName( fname.c_str( ) ); pdr->Update( ); - this->m_Outputs[ 0 ]->SetVTKDataObject( pdr->GetOutput( ) ); + + cpPlugins::Interface::Mesh* out = + this->_Output< cpPlugins::Interface::Mesh >( 0 ); + if( out != NULL ) + out->SetVTKMesh( pdr->GetOutput( ) ); + else + return( "MeshReader: output not correctly created." ); return( "" ); }