From: Leonardo Florez-Valencia Date: Thu, 16 Jun 2016 19:52:09 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~142 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e9f2b7e99e640987da99456a10a5b797225442fb;p=cpPlugins.git ... --- diff --git a/lib/cpPlugins/ParametersQtDialog.cxx b/lib/cpPlugins/ParametersQtDialog.cxx index 7febd59..9650765 100644 --- a/lib/cpPlugins/ParametersQtDialog.cxx +++ b/lib/cpPlugins/ParametersQtDialog.cxx @@ -92,6 +92,16 @@ updateParameters( ) if( this->m_Manual ) return; + // Check if an explicit re-execution button is needed + if( this->m_ProcessObject->GetCouldHaveExplicitReExecution( ) ) + { + QCheckBox* v_bool = + this->findChild< QCheckBox* >( "___ExplicitReExecution___" ); + if( v_bool != NULL ) + this->m_ProcessObject->SetExplicitReExecution( v_bool->isChecked( ) ); + + } // fi + // Put values auto parameters = this->m_ProcessObject->GetParameters( ); auto& raw_params = parameters->GetRawParameters( ); @@ -186,6 +196,16 @@ updateView( ) if( this->m_Manual ) return; + // Check if an explicit re-execution button is needed + if( this->m_ProcessObject->GetCouldHaveExplicitReExecution( ) ) + { + QCheckBox* v_bool = + this->findChild< QCheckBox* >( "___ExplicitReExecution___" ); + if( v_bool != NULL ) + v_bool->setChecked( this->m_ProcessObject->GetExplicitReExecution( ) ); + + } // fi + // Put values auto parameters = this->m_ProcessObject->GetParameters( ); auto& raw_params = parameters->GetRawParameters( ); @@ -323,6 +343,20 @@ _updateWidgets( ) << "\""; this->m_Title->setText( title.str( ).c_str( ) ); + // Check if an explicit re-execution button is needed + if( this->m_ProcessObject->GetCouldHaveExplicitReExecution( ) ) + { + QCheckBox* v_bool = new QCheckBox( this ); + v_bool->setObjectName( "___ExplicitReExecution___" ); + v_bool->setText( "Explicit re-execution" ); + v_bool->setChecked( this->m_ProcessObject->GetExplicitReExecution( ) ); + + QHBoxLayout* new_layout = new QHBoxLayout( ); + new_layout->addWidget( v_bool ); + this->m_ToolsLayout->addLayout( new_layout ); + + } // fi + // Put values auto parameters = this->m_ProcessObject->GetParameters( ); auto& raw_params = parameters->GetRawParameters( ); diff --git a/lib/cpPlugins/ProcessObject.cxx b/lib/cpPlugins/ProcessObject.cxx index 1355ff9..a30ef52 100644 --- a/lib/cpPlugins/ProcessObject.cxx +++ b/lib/cpPlugins/ProcessObject.cxx @@ -165,7 +165,8 @@ Update( ) { // Force upstream updates auto i = this->m_Inputs.begin( ); - bool need_to_update = false; + bool need_to_update = this->m_CouldHaveExplicitReExecution; + need_to_update &= this->m_ExplicitReExecution; for( ; i != this->m_Inputs.end( ); ++i ) { bool iv = i->second.IsValid( ); @@ -256,6 +257,8 @@ SetInteractionObjects( const std::vector< void* >& objs ) cpPlugins::ProcessObject:: ProcessObject( ) : Superclass( ), + m_CouldHaveExplicitReExecution( false ), + m_ExplicitReExecution( false ), m_LastExecutionTime( 0 ), m_LastExecutionSpan( -1 ), m_PrintExecution( false ), diff --git a/lib/cpPlugins/ProcessObject.h b/lib/cpPlugins/ProcessObject.h index 07817ee..2dbd6e4 100644 --- a/lib/cpPlugins/ProcessObject.h +++ b/lib/cpPlugins/ProcessObject.h @@ -24,9 +24,15 @@ namespace cpPlugins itkTypeMacro( ProcessObject, Object ); cpPlugins_Id_Macro( ProcessObject, Object ); + itkBooleanMacro( ExplicitReExecution ); itkBooleanMacro( PrintExecution ); + + itkGetConstMacro( ExplicitReExecution, bool ); + itkGetConstMacro( CouldHaveExplicitReExecution, bool ); itkGetConstMacro( LastExecutionSpan, long ); itkGetConstMacro( PrintExecution, bool ); + + itkSetMacro( ExplicitReExecution, bool ); itkSetMacro( PrintExecution, bool ); itkSetObjectMacro( PrintExecutionStream, std::ofstream ); @@ -104,6 +110,8 @@ namespace cpPlugins protected: Parameters m_Parameters; + bool m_CouldHaveExplicitReExecution; + bool m_ExplicitReExecution; typedef std::map< std::string, InputPort > _TInputs; typedef std::map< std::string, OutputPort > _TOutputs; diff --git a/lib/cpPlugins/WorkspaceIO.cxx b/lib/cpPlugins/WorkspaceIO.cxx index f7b25ca..0b48fc9 100644 --- a/lib/cpPlugins/WorkspaceIO.cxx +++ b/lib/cpPlugins/WorkspaceIO.cxx @@ -58,12 +58,17 @@ LoadWorkspace( const std::string& fname ) float viewX = float( 0 ), viewY = float( 0 ); filter->QueryFloatAttribute( "ViewX", &viewX ); filter->QueryFloatAttribute( "ViewY", &viewY ); + int explicit_re_execution = 0; + filter->QueryIntAttribute( + "ExplicitReExecution", &explicit_re_execution + ); if( class_value != NULL && name_value != NULL ) { if( this->CreateFilter( category_value, class_value, name_value ) ) { auto new_filter = this->GetFilter( name_value ); new_filter->SetViewCoords( viewX, viewY ); + new_filter->SetExplicitReExecution( explicit_re_execution == 1 ); // Read parameters auto parameters = new_filter->GetParameters( ); @@ -159,6 +164,9 @@ SaveWorkspace( const std::string& fname ) const e->SetAttribute( "name", vIt->first.c_str( ) ); e->SetAttribute( "ViewX", filter->GetViewX( ) ); e->SetAttribute( "ViewY", filter->GetViewY( ) ); + e->SetAttribute( + "ExplicitReExecution", ( filter->GetExplicitReExecution( ) )? 1: 0 + ); auto params = filter->GetParameters( ); params->ToXML( doc, e );