]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 16 Jun 2016 19:52:09 +0000 (14:52 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Thu, 16 Jun 2016 19:52:09 +0000 (14:52 -0500)
lib/cpPlugins/ParametersQtDialog.cxx
lib/cpPlugins/ProcessObject.cxx
lib/cpPlugins/ProcessObject.h
lib/cpPlugins/WorkspaceIO.cxx

index 7febd59e69a582f0de187a9fa2fac10bdd1fcd45..9650765676feeaf2e2b8dd9f234d9921dfe565c3 100644 (file)
@@ -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( );
index 1355ff9ccc68aa96ccc1c1755a7e877509175ebf..a30ef5212c7a35dbefc883f17fd15bdd4fdfc421 100644 (file)
@@ -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 ),
index 07817ee2a914829677382bad2f66707e9530ebde..2dbd6e44a31ed5f0cad6a20cd0f5e0b1d4af8ac7 100644 (file)
@@ -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;
index f7b25ca9f129ed26721bb7661b4ffdcf73728d66..0b48fc9ea6b0a74a577ab7b8e0d276f71cba38ad 100644 (file)
@@ -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 );