X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FProcessObject.cxx;h=a53476f894a8b30953fadfb84322a211fcebd6bf;hb=1d735deae0ae5e8bff643a59370a03c961ef780c;hp=d1982b0690b42a57f72cc9094d8e14b7cbffa780;hpb=2e68bf3e3a3433d77adbc67cebc17fd5cb0111f6;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/ProcessObject.cxx b/lib/cpPlugins/Interface/ProcessObject.cxx index d1982b0..a53476f 100644 --- a/lib/cpPlugins/Interface/ProcessObject.cxx +++ b/lib/cpPlugins/Interface/ProcessObject.cxx @@ -1,30 +1,12 @@ #include -// ------------------------------------------------------------------------- -cpPlugins::Interface::ProcessObject:: -ProcessObject( ) - : Superclass( ), - m_OutputsDisconnected( false ) -{ -} +#ifdef cpPlugins_Interface_QT4 +#include +#endif // cpPlugins_Interface_QT4 // ------------------------------------------------------------------------- +const cpPlugins::Interface::Parameters& cpPlugins::Interface::ProcessObject:: -~ProcessObject( ) -{ - this->_DeleteOutputs( ); -} - -// ------------------------------------------------------------------------- -std::string cpPlugins::Interface::ProcessObject:: -GetClassName( ) const -{ - return( "cpPlugins::Interface::ProcessObject" ); -} - -// ------------------------------------------------------------------------- -const cpPlugins::Interface::ProcessObject:: -TParameters& cpPlugins::Interface::ProcessObject:: GetDefaultParameters( ) const { return( this->m_DefaultParameters ); @@ -32,9 +14,10 @@ GetDefaultParameters( ) const // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: -SetParameters( const TParameters& params ) +SetParameters( const cpPlugins::Interface::Parameters& params ) { this->m_Parameters = params; + this->Modified( ); } // ------------------------------------------------------------------------- @@ -56,59 +39,49 @@ void cpPlugins::Interface::ProcessObject:: SetNumberOfInputs( unsigned int n ) { this->m_Inputs.clear( ); - this->m_Inputs.resize( n, NULL ); + this->m_Inputs.resize( n ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetNumberOfOutputs( unsigned int n ) { - this->_DeleteOutputs( ); this->m_Outputs.clear( ); - this->m_Outputs.resize( n, NULL ); - this->m_OutputsDisconnected = false; + this->m_Outputs.resize( n ); + this->Modified( ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: -SetInput( - unsigned int idx, const cpPlugins::Interface::DataObject* dobj - ) +SetInput( unsigned int idx, cpPlugins::Interface::DataObject* dobj ) { if( idx < this->m_Inputs.size( ) ) + { this->m_Inputs[ idx ] = dobj; -} + this->Modified( ); -// ------------------------------------------------------------------------- -cpPlugins::Interface::DataObject* cpPlugins::Interface::ProcessObject:: -GetOutput( unsigned int idx ) -{ - if( idx < this->m_Outputs.size( ) ) - return( this->m_Outputs[ idx ] ); - else - return( NULL ); + } // fi } // ------------------------------------------------------------------------- std::string cpPlugins::Interface::ProcessObject:: Update( ) { - // Force upstream updates std::string r = ""; + + // Force upstream updates for( unsigned int i = 0; i < this->m_Inputs.size( ) && r == ""; ++i ) { - if( this->m_Inputs[ i ]->GetSource( ) != NULL ) - r = this->m_Inputs[ i ]->GetSource( )->Update( ); + Self* src = dynamic_cast< Self* >( this->m_Inputs[ i ]->GetSource( ) ); + if( src != NULL ) + r = src->Update( ); } // rof // Current update if( r == "" ) - { r = this->_GenerateData( ); - this->m_OutputsDisconnected = false; - - } // fi // Return error description, if any return( r ); @@ -118,39 +91,46 @@ Update( ) void cpPlugins::Interface::ProcessObject:: DisconnectOutputs( ) { - this->m_OutputsDisconnected = true; for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx ) - if( this->m_Outputs[ idx ] != NULL ) + if( this->m_Outputs[ idx ].IsNotNull( ) ) this->m_Outputs[ idx ]->DisconnectPipeline( ); } // ------------------------------------------------------------------------- -itk::DataObject* cpPlugins::Interface::ProcessObject:: -_GetInput( unsigned int idx ) +bool cpPlugins::Interface::ProcessObject:: +ExecConfigurationDialog( QWidget* parent ) { - if( idx < this->m_Inputs.size( ) ) - return( this->m_Inputs[ idx ]->GetDataObject( ) ); - else - return( NULL ); + bool r = false; + +#ifdef cpPlugins_Interface_QT4 + + Parameters parameters = this->m_DefaultParameters; + r = cpPlugins::Interface::ParametersQtDialog( + parameters, + this->m_ClassName + std::string( " basic configuration" ), + parent + ); + if( r ) + this->m_Parameters = parameters; + +#endif // cpPlugins_Interface_QT4 + + return( r ); } // ------------------------------------------------------------------------- -void cpPlugins::Interface::ProcessObject:: -_SetOutput( unsigned int idx, itk::DataObject* dobj ) +cpPlugins::Interface::ProcessObject:: +ProcessObject( ) + : Superclass( ) { - if( idx < this->m_Outputs.size( ) ) - if( this->m_Outputs[ idx ] != NULL ) - this->m_Outputs[ idx ]->SetDataObject( dobj ); + this->m_ClassName = "cpPlugins::Interface::ProcessObject"; + this->m_ClassCategory = "BasicObject"; } // ------------------------------------------------------------------------- -void cpPlugins::Interface::ProcessObject:: -_DeleteOutputs( ) +cpPlugins::Interface::ProcessObject:: +~ProcessObject( ) { - if( !( this->m_OutputsDisconnected ) ) - for( unsigned int idx = 0; idx < this->m_Outputs.size( ); ++idx ) - if( this->m_Outputs[ idx ] != NULL ) - delete this->m_Outputs[ idx ]; } // eof - $RCSfile$