diff --git a/Code/Core/otbWrapperApplication.cxx b/Code/Core/otbWrapperApplication.cxx index e25b772e2277ac12b6af0ec394626402a67b1e18..28e198cbb019c7da55fc3412429939d46bd5fc35 100644 --- a/Code/Core/otbWrapperApplication.cxx +++ b/Code/Core/otbWrapperApplication.cxx @@ -49,10 +49,10 @@ Application::~Application() } -std::list<std::string> -Application::GetParametersKeys() +std::vector<std::string> +Application::GetParametersKeys(bool recursive) { - return GetParameterList()->GetParametersKeys(); + return GetParameterList()->GetParametersKeys(recursive); } ParameterGroup* Application::GetParameterList() @@ -97,7 +97,18 @@ void Application::ExecuteAndWriteOutput() { this->Execute(); - + std::vector<std::string> paramList = GetParametersKeys(true); + for (std::vector<std::string>::const_iterator it = paramList.begin(); + it != paramList.end(); + ++it) + { + if (GetParameterType(*it) == ParameterType_OutputImage) + { + Parameter* param = GetParameterByKey(*it); + OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*>(param); + outputParam->Write(); + } + } } /* Enable the use of an optional parameter. Returns the previous state */ @@ -162,7 +173,16 @@ ParameterType Application::GetParameterType(std::string paramKey) const { type = ParameterType_Choice; } - else if (dynamic_cast<const IntParameter*>(param)) + else if (dynamic_cast<const RadiusParameter*>(param)) + { + type = ParameterType_Radius; + } + else if (dynamic_cast<const EmptyParameter*>(param)) + { + std::cout << "GetParameterType Empty" << std::endl; + type = ParameterType_Empty; + } + else if (dynamic_cast<const IntParameter*>(param)) { type = ParameterType_Int; } @@ -170,10 +190,6 @@ ParameterType Application::GetParameterType(std::string paramKey) const { type = ParameterType_Float; } - else if (dynamic_cast<const RadiusParameter*>(param)) - { - type = ParameterType_String; - } else if (dynamic_cast<const FilenameParameter*>(param)) { type = ParameterType_Filename; @@ -202,9 +218,9 @@ ParameterType Application::GetParameterType(std::string paramKey) const { type = ParameterType_OutputVectorData; } - else if (dynamic_cast<const RadiusParameter*>(param)) + else if (dynamic_cast<const StringParameter*>(param)) { - type = ParameterType_Radius; + type = ParameterType_String; } else if (dynamic_cast<const ParameterGroup*>(param)) { diff --git a/Code/Core/otbWrapperApplication.h b/Code/Core/otbWrapperApplication.h index e23bff45b270df99b7416eec0da75ff2b02b3e2e..1ccc04bd84e92d195a538270d2d913e9ad7dcc7e 100644 --- a/Code/Core/otbWrapperApplication.h +++ b/Code/Core/otbWrapperApplication.h @@ -237,7 +237,7 @@ public: /* Get the list of all parameters */ - std::list<std::string> GetParametersKeys(); + std::vector<std::string> GetParametersKeys(bool recursive = true); protected: /** Constructor */