X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FParameters.cxx;h=e584b5e5d36cbd5d7f2719fe46f9ffb481f77302;hb=f4aeff15ebb41183d4b89f41b29ec26043848722;hp=b02168b43c60ad92be24bbdc6e03831a975a3474;hpb=8db7a40f2ef8530457959a51a4d2a7f012d0b7a3;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Parameters.cxx b/lib/cpPlugins/Interface/Parameters.cxx index b02168b..e584b5e 100644 --- a/lib/cpPlugins/Interface/Parameters.cxx +++ b/lib/cpPlugins/Interface/Parameters.cxx @@ -1,7 +1,40 @@ #include +#include #include +// ------------------------------------------------------------------------- +cpPlugins::Interface:: +ProcessObject* cpPlugins::Interface::Parameters:: +GetProcessObject( ) +{ + return( this->m_Process ); +} + +// ------------------------------------------------------------------------- +const cpPlugins::Interface:: +ProcessObject* cpPlugins::Interface::Parameters:: +GetProcessObject( ) const +{ + return( this->m_Process ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Parameters:: +SetProcessObject( ProcessObject* v ) +{ + this->m_Process = v; +} + +// ------------------------------------------------------------------------- +void cpPlugins::Interface::Parameters:: +Modified( ) const +{ + this->Superclass::Modified( ); + if( this->m_Process != NULL ) + this->m_Process->Modified( ); +} + // ------------------------------------------------------------------------- void cpPlugins::Interface::Parameters:: Clear( ) @@ -14,7 +47,8 @@ Clear( ) void cpPlugins::Interface::Parameters:: ConfigureAsString( const TString& name, const TString& v ) { - this->m_Parameters[ name ] = TParameter( Self::String, TValues( v, v ) ); + this->m_Parameters[ name ] = + TParameter( Self::String, TValues( v, v ) ); this->Modified( ); } @@ -53,6 +87,7 @@ cpPlugins_Parameters_List_Configure( Uint ); cpPlugins_Parameters_List_Configure( Real ); cpPlugins_Parameters_List_Configure( Index ); cpPlugins_Parameters_List_Configure( Point ); +cpPlugins_Parameters_List_Configure( Vector ); // ------------------------------------------------------------------------- void cpPlugins::Interface::Parameters:: @@ -114,6 +149,7 @@ cpPlugins_Parameters_Has( Uint ); cpPlugins_Parameters_Has( Real ); cpPlugins_Parameters_Has( Index ); cpPlugins_Parameters_Has( Point ); +cpPlugins_Parameters_Has( Vector ); cpPlugins_Parameters_Has( StringList ); cpPlugins_Parameters_Has( BoolList ); cpPlugins_Parameters_Has( IntList ); @@ -121,17 +157,18 @@ cpPlugins_Parameters_Has( UintList ); cpPlugins_Parameters_Has( RealList ); cpPlugins_Parameters_Has( IndexList ); cpPlugins_Parameters_Has( PointList ); +cpPlugins_Parameters_Has( VectorList ); cpPlugins_Parameters_Has( Choices ); // ------------------------------------------------------------------------- cpPlugins::Interface::Parameters:: TString cpPlugins::Interface::Parameters:: -GetString( const TString& name ) const +GetString( const TString& name, bool force ) const { TParameters::const_iterator i = this->m_Parameters.find( name ); if( i != this->m_Parameters.end( ) ) { - if( i->second.first == Self::String ) + if( i->second.first == Self::String || !force ) return( i->second.second.second ); } // fi @@ -192,7 +229,13 @@ GetReal( const TString& name ) const if( i != this->m_Parameters.end( ) ) { if( i->second.first == Self::Real ) - return( TReal( std::atof( i->second.second.second.c_str( ) ) ) ); + { + std::istringstream tok_str( i->second.second.second ); + float v; + tok_str >> v; + return( TReal( v ) ); + + } // fi } // fi return( TReal( 0 ) ); @@ -280,7 +323,13 @@ GetRealList( std::vector< TReal >& lst, const TString& name ) const std::istringstream str( i->second.second.second ); std::string token; while( std::getline( str, token, '#' ) ) - lst.push_back( TReal( std::atof( token.c_str( ) ) ) ); + { + std::istringstream tok_str( token ); + float v; + tok_str >> v; + lst.push_back( TReal( v ) ); + + } // elihw } // ------------------------------------------------------------------------- @@ -315,12 +364,12 @@ GetSelectedChoice( const TString& name ) const // ------------------------------------------------------------------------- void cpPlugins::Interface::Parameters:: -SetString( const TString& name, const TString& v ) +SetString( const TString& name, const TString& v, bool force ) { TParameters::iterator i = this->m_Parameters.find( name ); if( i == this->m_Parameters.end( ) ) return; - if( i->second.first != Self::String ) + if( i->second.first != Self::String && force ) return; i->second.second.second = v; this->Modified( ); @@ -393,6 +442,7 @@ cpPlugins_Parameters_Clear( Uint ); cpPlugins_Parameters_Clear( Real ); cpPlugins_Parameters_Clear( Index ); cpPlugins_Parameters_Clear( Point ); +cpPlugins_Parameters_Clear( Vector ); // ------------------------------------------------------------------------- bool cpPlugins::Interface::Parameters:: @@ -416,7 +466,8 @@ SetSelectedChoice( const TString& name, const TString& choice ) // ------------------------------------------------------------------------- cpPlugins::Interface::Parameters:: Parameters( ) - : Superclass( ) + : Superclass( ), + m_Process( NULL ) { this->Clear( ); }