#include #ifdef cpPlugins_Interface_QT4 #include #endif // cpPlugins_Interface_QT4 // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: Modified( ) const { if( this->m_ITKObject.IsNotNull( ) ) this->m_ITKObject->Modified( ); if( this->m_VTKObject.GetPointer( ) != NULL ) this->m_VTKObject->Modified( ); this->Superclass::Modified( ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: TParameters* cpPlugins::Interface::ProcessObject:: GetParameters( ) { return( this->m_Parameters.GetPointer( ) ); } // ------------------------------------------------------------------------- const cpPlugins::Interface::ProcessObject:: TParameters* cpPlugins::Interface::ProcessObject:: GetParameters( ) const { return( this->m_Parameters.GetPointer( ) ); } // ------------------------------------------------------------------------- unsigned int cpPlugins::Interface::ProcessObject:: GetNumberOfInputs( ) const { return( this->m_Inputs.size( ) ); } // ------------------------------------------------------------------------- unsigned int cpPlugins::Interface::ProcessObject:: GetNumberOfOutputs( ) const { return( this->m_Outputs.size( ) ); } // ------------------------------------------------------------------------- std::vector< std::string > cpPlugins::Interface::ProcessObject:: GetInputsNames( ) const { std::vector< std::string > r; auto dIt = this->m_Inputs.begin( ); for( ; dIt != this->m_Inputs.end( ); ++dIt ) r.push_back( dIt->first ); return( r ); } // ------------------------------------------------------------------------- std::vector< std::string > cpPlugins::Interface::ProcessObject:: GetOutputsNames( ) const { std::vector< std::string > r; auto dIt = this->m_Outputs.begin( ); for( ; dIt != this->m_Outputs.end( ); ++dIt ) r.push_back( dIt->first ); return( r ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj ) { _TDataContainer::iterator i = this->m_Inputs.find( id ); if( i != this->m_Inputs.end( ) ) { i->second = dobj; this->Modified( ); } // fi } // ------------------------------------------------------------------------- std::string cpPlugins::Interface::ProcessObject:: Update( ) { std::string r = ""; // Force upstream updates _TDataContainer::iterator i = this->m_Inputs.begin( ); for( ; i != this->m_Inputs.end( ) && r == ""; ++i ) { Self* src = dynamic_cast< Self* >( i->second->GetSource( ) ); if( src != NULL ) r = src->Update( ); } // rof // Current update if( r == "" ) r = this->_GenerateData( ); // Return error description, if any return( r ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: DisconnectOutputs( ) { _TDataContainer::iterator i = this->m_Outputs.begin( ); for( ; i != this->m_Outputs.end( ); ++i ) if( i->second.IsNotNull( ) ) i->second->DisconnectPipeline( ); } // ------------------------------------------------------------------------- bool cpPlugins::Interface::ProcessObject:: ExecConfigurationDialog( QWidget* parent ) { bool r = false; #ifdef cpPlugins_Interface_QT4 if( this->m_ParametersDialog == NULL ) { this->m_ParametersDialog = new ParametersQtDialog( parent ); this->m_ParametersDialog->setTitle( this->GetClassName( ) + std::string( " basic configuration" ) ); this->m_ParametersDialog->setParameters( this->m_Parameters ); } // fi if( !( this->m_ParametersDialog->IsModal( ) ) ) { this->m_ParametersDialog->show( ); r = true; } else r = ( this->m_ParametersDialog->exec( ) == 1 ); /* r = cpPlugins::Interface::ParametersQtDialog( this->m_Parameters, this->GetClassName( ) + std::string( " basic configuration" ), parent ); if( r ) */ #endif // cpPlugins_Interface_QT4 return( r ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: ProcessObject( ) : Superclass( ), m_ITKObject( NULL ), m_VTKObject( NULL ), m_ParametersDialog( NULL ) { this->m_Parameters = TParameters::New( ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: ~ProcessObject( ) { if( this->m_ParametersDialog == NULL ) delete this->m_ParametersDialog; } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: _AddInput( const std::string& name ) { this->m_Inputs[ name ] = NULL; this->Modified( ); } // eof - $RCSfile$