From 19e854bdf8a92665d05e8f1f52978552efcf299a Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Wed, 9 Nov 2011 18:13:32 +0100
Subject: [PATCH] ENH: Parameter with Role_Output must not be tested to check
 if the application is ready

---
 .../otbWrapperApplication.cxx                 | 21 ++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx
index d98f824262..5154a779b1 100644
--- a/Code/ApplicationEngine/otbWrapperApplication.cxx
+++ b/Code/ApplicationEngine/otbWrapperApplication.cxx
@@ -1112,15 +1112,22 @@ Application::IsApplicationReady()
 
   std::vector<std::string> paramList = GetParametersKeys(true);
   for (std::vector<std::string>::const_iterator it = paramList.begin();
-      it != paramList.end();
-      ++it)
+       it != paramList.end();
+       ++it)
     {
-
-    // Check all Input Parameters
-    if ( !this->HasValue(*it)  && IsMandatory(*it) )
-      if( GetParameterByKey(*it)->IsRoot() || GetParameterByKey(*it)->GetRoot()->GetActive() )
+    // Check all Input Parameters with Input Role
+    if (GetParameterByKey(*it)->GetRole() == Role_Input)
       {
-      return false;
+      // When a parameter is mandatory : 
+      // return false when does not have value and:
+      //  - The param is root
+      //  - The param is not root and belonging to a Mandatory Group
+      //    wich is activated
+      if ( !this->HasValue(*it)  && IsMandatory(*it) )
+        if( GetParameterByKey(*it)->IsRoot() || GetParameterByKey(*it)->GetRoot()->GetActive() )
+          {
+          return false;
+          }
       }
     }
 
-- 
GitLab