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 cpPlugins::Interface::ProcessObject::
22 TParameters* cpPlugins::Interface::ProcessObject::
25 return( this->m_Parameters.GetPointer( ) );
28 // -------------------------------------------------------------------------
29 const cpPlugins::Interface::ProcessObject::
30 TParameters* cpPlugins::Interface::ProcessObject::
31 GetParameters( ) const
33 return( this->m_Parameters.GetPointer( ) );
36 // -------------------------------------------------------------------------
37 unsigned int cpPlugins::Interface::ProcessObject::
38 GetNumberOfInputs( ) const
40 return( this->m_Inputs.size( ) );
43 // -------------------------------------------------------------------------
44 unsigned int cpPlugins::Interface::ProcessObject::
45 GetNumberOfOutputs( ) const
47 return( this->m_Outputs.size( ) );
50 // -------------------------------------------------------------------------
51 std::vector< std::string > cpPlugins::Interface::ProcessObject::
52 GetInputsNames( ) const
54 std::vector< std::string > r;
55 auto dIt = this->m_Inputs.begin( );
56 for( ; dIt != this->m_Inputs.end( ); ++dIt )
57 r.push_back( dIt->first );
61 // -------------------------------------------------------------------------
62 std::vector< std::string > cpPlugins::Interface::ProcessObject::
63 GetOutputsNames( ) const
65 std::vector< std::string > r;
66 auto dIt = this->m_Outputs.begin( );
67 for( ; dIt != this->m_Outputs.end( ); ++dIt )
68 r.push_back( dIt->first );
72 // -------------------------------------------------------------------------
73 void cpPlugins::Interface::ProcessObject::
74 SetInput( const std::string& id, cpPlugins::Interface::DataObject* dobj )
76 _TDataContainer::iterator i = this->m_Inputs.find( id );
77 if( i != this->m_Inputs.end( ) )
85 // -------------------------------------------------------------------------
86 std::string cpPlugins::Interface::ProcessObject::
91 // Force upstream updates
92 _TDataContainer::iterator i = this->m_Inputs.begin( );
93 for( ; i != this->m_Inputs.end( ) && r == ""; ++i )
95 Self* src = dynamic_cast< Self* >( i->second->GetSource( ) );
103 r = this->_GenerateData( );
105 // Return error description, if any
109 // -------------------------------------------------------------------------
110 void cpPlugins::Interface::ProcessObject::
113 _TDataContainer::iterator i = this->m_Outputs.begin( );
114 for( ; i != this->m_Outputs.end( ); ++i )
115 if( i->second.IsNotNull( ) )
116 i->second->DisconnectPipeline( );
119 // -------------------------------------------------------------------------
120 void cpPlugins::Interface::ProcessObject::
121 AddInteractor( vtkRenderWindowInteractor* interactor )
123 #ifdef cpPlugins_Interface_QT4
124 this->m_ParametersDialog->addInteractor( interactor );
125 #endif // cpPlugins_Interface_QT4
128 // -------------------------------------------------------------------------
129 cpPlugins::Interface::ProcessObject::
130 DialogResult cpPlugins::Interface::ProcessObject::
131 ExecConfigurationDialog( QWidget* parent )
133 DialogResult r = Self::DialogResult_Cancel;
135 #ifdef cpPlugins_Interface_QT4
137 this->m_ParametersDialog->setParent( NULL );
138 this->m_ParametersDialog->setParameters( this->m_Parameters );
140 if( !( this->m_ParametersDialog->IsModal( ) ) )
142 this->m_ParametersDialog->show( );
143 r = Self::DialogResult_Modal;
147 if( this->m_ParametersDialog->exec( ) == 1 )
148 r = Self::DialogResult_NoModal;
150 r = Self::DialogResult_Cancel;
154 #endif // cpPlugins_Interface_QT4
159 // -------------------------------------------------------------------------
160 cpPlugins::Interface::ProcessObject::
166 this->m_Parameters = TParameters::New( );
168 this->m_ParametersDialog = new ParametersQtDialog( );
169 this->m_ParametersDialog->setTitle(
170 this->GetClassName( ) + std::string( " basic configuration" )
174 // -------------------------------------------------------------------------
175 cpPlugins::Interface::ProcessObject::
178 delete this->m_ParametersDialog;
181 // -------------------------------------------------------------------------
182 void cpPlugins::Interface::ProcessObject::
183 _AddInput( const std::string& name )
185 this->m_Inputs[ name ] = NULL;