From 796c0e01c8e1b710fd9a3193c822aa89e32c7496 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Fri, 23 Feb 2018 19:40:30 +0100 Subject: [PATCH] ENH: send Abort for OutputImageParameters (WIP) --- .../src/otbWrapperApplication.cxx | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 7676634a52..dc66786557 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -517,6 +517,7 @@ int Application::ExecuteAndWriteOutput() } } + // TODO: only if no Stop() was called this->AfterExecuteAndWriteOutputs(); m_Chrono.Stop(); @@ -526,9 +527,24 @@ int Application::ExecuteAndWriteOutput() void Application::Stop() { - // TODO : call AbortGenerateData on ProcessObjects (but no mutex) - // TODO : set an internal AbortExecute flag with mutex - std::cout << "Stop !" << std::endl; + std::vector<std::string> paramList = GetParametersKeys(true); + for (std::vector<std::string>::const_iterator it = paramList.begin(); + it != paramList.end(); + ++it) + { + std::string key = *it; + if (GetParameterType(key) == ParameterType_OutputImage + && IsParameterEnabled(key) && HasValue(key) ) + { + Parameter* param = GetParameterByKey(key); + OutputImageParameter* outputParam = dynamic_cast<OutputImageParameter*>(param); + + if(outputParam!=ITK_NULLPTR) + { + outputParam->GetWriter()->SetAbortGenerateData(true); + } + } + } } /* Enable the use of an optional parameter. Returns the previous state */ -- GitLab