From 7b0bf7c62fb54f50555f65de0b0154a9ac85d6e4 Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Tue, 27 Sep 2011 16:13:28 +0200 Subject: [PATCH] ENH: add the parents and the children of each parameter --- Code/ApplicationEngine/otbWrapperParameterGroup.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Code/ApplicationEngine/otbWrapperParameterGroup.cxx b/Code/ApplicationEngine/otbWrapperParameterGroup.cxx index 94ba561de7..05092fa436 100644 --- a/Code/ApplicationEngine/otbWrapperParameterGroup.cxx +++ b/Code/ApplicationEngine/otbWrapperParameterGroup.cxx @@ -93,7 +93,7 @@ ParameterGroup::AddChoice(std::string paramKey, std::string paramName) // Split the parameter name std::vector<std::string> splittedKey = pKey.Split(); - if( splittedKey.size() >1 ) + if( splittedKey.size() > 1 ) { // Get the last subkey std::string lastkey = pKey.GetLastElement(); @@ -321,6 +321,16 @@ ParameterGroup::AddParameter(ParameterType type, std::string paramKey, std::stri newParam->SetKey(lastkey); newParam->SetName(paramName); + // If splittedKey is greater than 1, that means that the parameter + // is not a root, and have a parent(s): + // - Add the parent as root of this param + // - Add the param as a child of its parents + if (splittedKey.size() > 1) + { + newParam->SetRoot(parentParam); + parentParam->AddChild(newParam); + } + parentAsGroup->AddParameter(newParam); } else -- GitLab