1 #include <cpPlugins/Interface/ProcessObject.h>
3 #ifdef cpPlugins_Interface_QT4
4 #include <cpPlugins/Interface/ParametersQtDialog.h>
5 #endif // cpPlugins_Interface_QT4
7 #include <vtkRenderWindowInteractor.h>
9 // -------------------------------------------------------------------------
10 void cpPlugins::Interface::ProcessObject::
13 if( this->m_ITKObject.IsNotNull( ) )
14 this->m_ITKObject->Modified( );
15 if( this->m_VTKObject.GetPointer( ) != NULL )
16 this->m_VTKObject->Modified( );
17 this->Superclass::Modified( );
20 // -------------------------------------------------------------------------
21 std::vector< std::string > cpPlugins::Interface::ProcessObject::
22 GetInputsNames( ) const
24 std::vector< std::string > r;
25 auto dIt = this->m_Inputs.begin( );
26 for( ; dIt != this->m_Inputs.end( ); ++dIt )
27 r.push_back( dIt->first );
31 // -------------------------------------------------------------------------
32 std::vector< std::string > cpPlugins::Interface::ProcessObject::
33 GetOutputsNames( ) const
35 std::vector< std::string > r;
36 auto dIt = this->m_Outputs.begin( );
37 for( ; dIt != this->m_Outputs.end( ); ++dIt )
38 r.push_back( dIt->first );
42 // -------------------------------------------------------------------------
43 void cpPlugins::Interface::ProcessObject::
44 SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
46 _TDataContainer::iterator i = this->m_Inputs.find( id );
47 if( i != this->m_Inputs.end( ) )
55 // -------------------------------------------------------------------------
56 std::string cpPlugins::Interface::ProcessObject::
61 // Force upstream updates
62 _TDataContainer::iterator i = this->m_Inputs.begin( );
63 for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
65 Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
73 r = this->_GenerateData( );
75 // Return error description, if any
79 // -------------------------------------------------------------------------
80 void cpPlugins::Interface::ProcessObject::
83 _TDataContainer::iterator i = this->m_Outputs.begin( );
84 for( ; i != this->m_Outputs.end( ); ++i )
85 if( i->second.IsNotNull( ) )
86 i->second->DisconnectPipeline( );
89 // -------------------------------------------------------------------------
90 void cpPlugins::Interface::ProcessObject::
91 AddInteractor( vtkRenderWindowInteractor* interactor )
93 #ifdef cpPlugins_Interface_QT4
94 this->m_ParametersDialog->addInteractor( interactor );
95 #endif // cpPlugins_Interface_QT4
98 // -------------------------------------------------------------------------
99 cpPlugins::Interface::ProcessObject::
100 DialogResult cpPlugins::Interface::ProcessObject::
101 ExecConfigurationDialog( QWidget* parent )
103 DialogResult r = Self::DialogResult_Cancel;
105 #ifdef cpPlugins_Interface_QT4
107 this->m_ParametersDialog->setParent( NULL );
108 this->m_ParametersDialog->setParameters( this->m_Parameters );
110 if( !( this->m_ParametersDialog->IsModal( ) ) )
112 this->m_ParametersDialog->show( );
113 r = Self::DialogResult_Modal;
117 if( this->m_ParametersDialog->exec( ) == 1 )
118 r = Self::DialogResult_NoModal;
120 r = Self::DialogResult_Cancel;
124 #endif // cpPlugins_Interface_QT4
129 // -------------------------------------------------------------------------
130 cpPlugins::Interface::ProcessObject::
137 this->m_Parameters = TParameters::New( );
138 this->m_Parameters->SetProcessObject( this );
140 this->m_ParametersDialog = new ParametersQtDialog( );
141 this->m_ParametersDialog->setTitle(
142 this->GetClassName( ) + std::string( " basic configuration" )
146 // -------------------------------------------------------------------------
147 cpPlugins::Interface::ProcessObject::
150 delete this->m_ParametersDialog;
153 // -------------------------------------------------------------------------
154 void cpPlugins::Interface::ProcessObject::
155 _AddInput( const std::string& name )
157 this->m_Inputs[ name ] = NULL;
161 // -------------------------------------------------------------------------
162 CPPLUGINS_PROVIDER_SOURCE( cpPlugins::Interface::ProcessObject, 1, 1 );