From 1e5c160f85b5bbf1074d829c04f31600f0450831 Mon Sep 17 00:00:00 2001 From: Julien Malik <julien.malik@c-s.fr> Date: Sun, 12 Jun 2011 14:35:33 +0200 Subject: [PATCH] ENH: add GetParameterName and GetParameterDescription --- Code/Core/otbWrapperApplication.cxx | 18 +++++++++++++++++- Code/Core/otbWrapperApplication.h | 6 ++++++ Code/Wrappers/SWIG/otbApplication.i | 2 ++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Code/Core/otbWrapperApplication.cxx b/Code/Core/otbWrapperApplication.cxx index bdd9348ff1..e25b772e22 100644 --- a/Code/Core/otbWrapperApplication.cxx +++ b/Code/Core/otbWrapperApplication.cxx @@ -158,7 +158,11 @@ ParameterType Application::GetParameterType(std::string paramKey) const const Parameter* param = GetParameterByKey(paramKey); ParameterType type; - if (dynamic_cast<const IntParameter*>(param)) + if (dynamic_cast<const ChoiceParameter*>(param)) + { + type = ParameterType_Choice; + } + else if (dynamic_cast<const IntParameter*>(param)) { type = ParameterType_Int; } @@ -325,6 +329,18 @@ void Application::SetParameterOutputVectorData(std::string parameter, VectorData } } +std::string Application::GetParameterName(std::string parameter) +{ + Parameter* param = GetParameterByKey(parameter); + return param->GetName(); +} + +std::string Application::GetParameterDescription(std::string parameter) +{ + Parameter* param = GetParameterByKey(parameter); + return param->GetDescription(); +} + int Application::GetParameterInt(std::string parameter) { int ret = 0; diff --git a/Code/Core/otbWrapperApplication.h b/Code/Core/otbWrapperApplication.h index 6e469079df..e23bff45b2 100644 --- a/Code/Core/otbWrapperApplication.h +++ b/Code/Core/otbWrapperApplication.h @@ -101,6 +101,12 @@ public: * WARNING: this method may disappear from the API */ const Parameter* GetParameterByKey(std::string parameter) const; + /* Returns the description of a parameter */ + std::string GetParameterName(std::string paramKey); + + /* Returns the description of a parameter */ + std::string GetParameterDescription(std::string paramKey); + /* Enable the use of an optional parameter. Returns the previous state */ void EnableParameter(std::string paramKey); diff --git a/Code/Wrappers/SWIG/otbApplication.i b/Code/Wrappers/SWIG/otbApplication.i index dde9e6f7e8..4f61f03b12 100644 --- a/Code/Wrappers/SWIG/otbApplication.i +++ b/Code/Wrappers/SWIG/otbApplication.i @@ -124,6 +124,8 @@ public: // Parameter* GetParameterByKey(std::string parameter); // const Parameter* GetParameterByKey(std::string parameter) const; std::list<std::string> GetParametersKeys(); + std::string GetParameterName(std::string); + std::string GetParameterDescription(std::string); void EnableParameter(std::string paramKey); void DisableParameter(std::string paramKey); -- GitLab