1 #include <cpPlugins/Interface/ProcessObject.h>
3 #ifdef cpPlugins_Interface_QT4
4 #include <cpPlugins/Interface/ParametersQtDialog.h>
5 #endif // cpPlugins_Interface_QT4
7 // -------------------------------------------------------------------------
8 void cpPlugins::Interface::ProcessObject::
11 if( this->m_ITKObject.IsNotNull( ) )
12 this->m_ITKObject->Modified( );
13 if( this->m_VTKObject.GetPointer( ) != NULL )
14 this->m_VTKObject->Modified( );
15 this->Superclass::Modified( );
18 // -------------------------------------------------------------------------
19 cpPlugins::Interface::ProcessObject::
20 TParameters* cpPlugins::Interface::ProcessObject::
23 return( this->m_Parameters.GetPointer( ) );
26 // -------------------------------------------------------------------------
27 const cpPlugins::Interface::ProcessObject::
28 TParameters* cpPlugins::Interface::ProcessObject::
29 GetParameters( ) const
31 return( this->m_Parameters.GetPointer( ) );
34 // -------------------------------------------------------------------------
35 unsigned int cpPlugins::Interface::ProcessObject::
36 GetNumberOfInputs( ) const
38 return( this->m_Inputs.size( ) );
41 // -------------------------------------------------------------------------
42 unsigned int cpPlugins::Interface::ProcessObject::
43 GetNumberOfOutputs( ) const
45 return( this->m_Outputs.size( ) );
48 // -------------------------------------------------------------------------
49 std::vector< std::string > cpPlugins::Interface::ProcessObject::
50 GetInputsNames( ) const
52 std::vector< std::string > r;
53 auto dIt = this->m_Inputs.begin( );
54 for( ; dIt != this->m_Inputs.end( ); ++dIt )
55 r.push_back( dIt->first );
59 // -------------------------------------------------------------------------
60 std::vector< std::string > cpPlugins::Interface::ProcessObject::
61 GetOutputsNames( ) const
63 std::vector< std::string > r;
64 auto dIt = this->m_Outputs.begin( );
65 for( ; dIt != this->m_Outputs.end( ); ++dIt )
66 r.push_back( dIt->first );
70 // -------------------------------------------------------------------------
71 void cpPlugins::Interface::ProcessObject::
72 SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
74 _TDataContainer::iterator i = this->m_Inputs.find( id );
75 if( i != this->m_Inputs.end( ) )
83 // -------------------------------------------------------------------------
84 std::string cpPlugins::Interface::ProcessObject::
89 // Force upstream updates
90 _TDataContainer::iterator i = this->m_Inputs.begin( );
91 for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
93 Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
101 r = this->_GenerateData( );
103 // Return error description, if any
107 // -------------------------------------------------------------------------
108 void cpPlugins::Interface::ProcessObject::
111 _TDataContainer::iterator i = this->m_Outputs.begin( );
112 for( ; i != this->m_Outputs.end( ); ++i )
113 if( i->second.IsNotNull( ) )
114 i->second->DisconnectPipeline( );
117 // -------------------------------------------------------------------------
118 bool cpPlugins::Interface::ProcessObject::
119 ExecConfigurationDialog( QWidget* parent )
123 #ifdef cpPlugins_Interface_QT4
125 if( this->m_ParametersDialog == NULL )
127 this->m_ParametersDialog = new ParametersQtDialog( parent );
128 this->m_ParametersDialog->setTitle(
129 this->GetClassName( ) + std::string( " basic configuration" )
131 this->m_ParametersDialog->setParameters( this->m_Parameters );
135 if( !( this->m_ParametersDialog->IsModal( ) ) )
137 this->m_ParametersDialog->show( );
141 r = ( this->m_ParametersDialog->exec( ) == 1 );
144 r = cpPlugins::Interface::ParametersQtDialog(
146 this->GetClassName( ) + std::string( " basic configuration" ),
152 #endif // cpPlugins_Interface_QT4
157 // -------------------------------------------------------------------------
158 cpPlugins::Interface::ProcessObject::
163 m_ParametersDialog( NULL )
165 this->m_Parameters = TParameters::New( );
168 // -------------------------------------------------------------------------
169 cpPlugins::Interface::ProcessObject::
172 if( this->m_ParametersDialog == NULL )
173 delete this->m_ParametersDialog;
176 // -------------------------------------------------------------------------
177 void cpPlugins::Interface::ProcessObject::
178 _AddInput( const std::string& name )
180 this->m_Inputs[ name ] = NULL;