X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FWidgets%2FSeedWidget.cxx;h=cc589b1509679bbfb868ba70523f9262c080921b;hb=f1747c7248d5eead5ea9d7e57bda0b081bcef065;hp=f0c9094e80e639b3494e1b51c5c7cf5a1155c5c2;hpb=098f94c899285851651a2d457fb104dfca660668;p=cpPlugins.git diff --git a/plugins/Widgets/SeedWidget.cxx b/plugins/Widgets/SeedWidget.cxx index f0c9094..cc589b1 100644 --- a/plugins/Widgets/SeedWidget.cxx +++ b/plugins/Widgets/SeedWidget.cxx @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -36,6 +36,20 @@ SetEnabled( bool v ) } // rof } +// ------------------------------------------------------------------------- +bool cpPluginsWidgets::SeedWidget:: +GetEnabled( ) const +{ + if( this->m_Widgets.size( ) > 0 ) + { + auto i = this->m_Widgets.begin( ); + TWidget* w = const_cast< TWidget* >( i->second.GetPointer( ) ); + return( w->GetEnabled( ) != 0 ); + } + else + return( false ); +} + // ------------------------------------------------------------------------- cpPluginsWidgets::SeedWidget:: SeedWidget( ) @@ -150,34 +164,38 @@ _GD0_Image( vtkImageData* image ) std::string text = this->m_Parameters.GetString( "Text" ); std::vector< std::string > tok1, tok2; cpExtensions::Tokenize( tok1, text, "#" ); - for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 ) + if( tok1.size( ) > seeds->GetPoints( )->GetNumberOfPoints( ) ) { - if( *t1 != "" ) + for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 ) { - cpExtensions::Tokenize( tok2, *t1, " " ); - double x[ 3 ]; - for( unsigned int d = 0; d < 3; ++d ) + if( *t1 != "" ) { - if( d < tok2.size( ) ) + cpExtensions::Tokenize( tok2, *t1, " " ); + double x[ 3 ]; + for( unsigned int d = 0; d < 3; ++d ) { - std::istringstream str( tok2[ d ] ); - str >> x[ d ]; - } - else - x[ d ] = double( 0 ); - - } // rof + if( d < tok2.size( ) ) + { + std::istringstream str( tok2[ d ] ); + str >> x[ d ]; + } + else + x[ d ] = double( 0 ); + + } // rof + + seeds->GetPoints( )->InsertNextPoint( x ); + seeds->GetVerts( )->InsertNextCell( 1 ); + seeds->GetVerts( )->InsertCellPoint( + seeds->GetPoints( )->GetNumberOfPoints( ) - 1 + ); + seeds->Modified( ); - seeds->GetPoints( )->InsertNextPoint( x ); - seeds->GetVerts( )->InsertNextCell( 1 ); - seeds->GetVerts( )->InsertCellPoint( - seeds->GetPoints( )->GetNumberOfPoints( ) - 1 - ); - seeds->Modified( ); + } // fi - } // fi + } // rof - } // rof + } // fi } else {