#include #ifdef cpPlugins_Interface_QT4 #include #include #include #endif // cpPlugins_Interface_QT4 #include // ------------------------------------------------------------------------- std::set< std::string > cpPlugins::Interface::ProcessObject:: GetInputsNames( ) const { std::set< std::string > names; auto dIt = this->m_Inputs.begin( ); for( ; dIt != this->m_Inputs.end( ); ++dIt ) names.insert( dIt->first ); return( names ); } // ------------------------------------------------------------------------- std::set< std::string > cpPlugins::Interface::ProcessObject:: GetOutputsNames( ) const { std::set< std::string > names; auto dIt = this->m_Outputs.begin( ); for( ; dIt != this->m_Outputs.end( ); ++dIt ) names.insert( dIt->first ); return( names ); } // ------------------------------------------------------------------------- unsigned int cpPlugins::Interface::ProcessObject:: GetNumberOfInputs( ) const { return( this->m_Inputs.size( ) ); } // ------------------------------------------------------------------------- unsigned int cpPlugins::Interface::ProcessObject:: GetNumberOfOutputs( ) const { return( this->m_Outputs.size( ) ); } // ------------------------------------------------------------------------- bool 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( ); return( true ); } else return( false ); } // ------------------------------------------------------------------------- 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 ) { if( i->second.IsNotNull( ) ) { Self* src = dynamic_cast< Self* >( i->second->GetSource( ) ); if( src != NULL ) r = src->Update( ); } else r = "cpPlugins::Interface::ProcessObject: No input connected."; } // 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( ); } // ------------------------------------------------------------------------- vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject:: GetSingleInteractor( ) { return( this->m_SingleInteractor ); } // ------------------------------------------------------------------------- const vtkRenderWindowInteractor* cpPlugins::Interface::ProcessObject:: GetSingleInteractor( ) const { return( this->m_SingleInteractor ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetSingleInteractor( vtkRenderWindowInteractor* interactor ) { this->m_SingleInteractor = interactor; } // ------------------------------------------------------------------------- cpPlugins::Interface:: SimpleMPRWidget* cpPlugins::Interface::ProcessObject:: GetMPRViewer( ) { return( this->m_MPRViewer ); } // ------------------------------------------------------------------------- const cpPlugins::Interface:: SimpleMPRWidget* cpPlugins::Interface::ProcessObject:: GetMPRViewer( ) const { return( this->m_MPRViewer ); } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: SetMPRViewer( cpPlugins::Interface::SimpleMPRWidget* wdg ) { this->m_MPRViewer = wdg; } // ------------------------------------------------------------------------- bool cpPlugins::Interface::ProcessObject:: ExecConfigurationDialog( QWidget* parent ) { bool r = false; #ifdef cpPlugins_Interface_QT4 if( this->m_ParametersDialog != NULL ) { this->m_ParametersDialog->setParent( NULL ); this->m_ParametersDialog->setParameters( this->m_Parameters ); r = ( this->m_ParametersDialog->exec( ) == 1 ); } else r = false; #endif // cpPlugins_Interface_QT4 return( r ); } // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: ProcessObject( ) : Superclass( ), m_ParametersDialog( NULL ), m_MPRViewer( NULL ) { this->m_Parameters = TParameters::New( ); this->m_Parameters->SetProcessObject( this ); #ifdef cpPlugins_Interface_QT4 if( QApplication::instance( ) != NULL ) this->m_ParametersDialog = new ParametersQtDialog( ); #endif // cpPlugins_Interface_QT4 } // ------------------------------------------------------------------------- cpPlugins::Interface::ProcessObject:: ~ProcessObject( ) { #ifdef cpPlugins_Interface_QT4 if( this->m_ParametersDialog != NULL ) delete this->m_ParametersDialog; #endif // cpPlugins_Interface_QT4 } // ------------------------------------------------------------------------- void cpPlugins::Interface::ProcessObject:: _AddInput( const std::string& name ) { this->m_Inputs[ name ] = NULL; this->Modified( ); } // eof - $RCSfile$