From b883ae63b68ccdd9c53469182e70e5fcdc2635a0 Mon Sep 17 00:00:00 2001 From: Otmane Lahlou <otmane.lahlou@c-s.fr> Date: Mon, 17 Oct 2011 14:57:08 +0200 Subject: [PATCH] ENH: add method to deal with the AutomaticMode from the application --- .../otbWrapperApplication.cxx | 18 ++++++++++++++++++ Code/ApplicationEngine/otbWrapperApplication.h | 18 +++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx index bb6deb868b..0ad683b33c 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.cxx +++ b/Code/ApplicationEngine/otbWrapperApplication.cxx @@ -175,6 +175,24 @@ void Application::MandatoryOff(std::string paramKey) GetParameterByKey(paramKey)->SetMandatory(false); } +/* Return true if the specified parameter was set automatically in the + * application + */ +bool Application::HasAutomaticValue(std::string paramKey) const +{ + return GetParameterByKey(paramKey)->GetAutomaticValue(); +} + +void Application::AutomaticValueOn(std::string paramKey) +{ + GetParameterByKey(paramKey)->SetAutomaticValue(true); +} + +void Application::AutomaticValueOff(std::string paramKey) +{ + GetParameterByKey(paramKey)->SetAutomaticValue(false); +} + /* Returns true if the parameter has an associated value provided externally * (not automatically computed by the application) */ bool Application::HasUserValue(std::string paramKey) const diff --git a/Code/ApplicationEngine/otbWrapperApplication.h b/Code/ApplicationEngine/otbWrapperApplication.h index 7f8fa5c7ab..6c85fc320e 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.h +++ b/Code/ApplicationEngine/otbWrapperApplication.h @@ -127,6 +127,11 @@ public: /* Return true if the specified parameter is mandatory */ bool IsMandatory(std::string paramKey) const; + /* Return true if the specified parameter was set automtically in + * the applciation + */ + bool HasAutomaticValue(std::string paramKey) const; + /* Returns true if the parameter has an associated value provided externally * (not automatically computed by the application) */ bool HasUserValue(std::string paramKey) const; @@ -277,11 +282,6 @@ public: */ FloatVectorImageType* GetParameterImage(std::string parameter); - /* Get an image value - * - * Can be called for types : - * \li ParameterType_InputImage - */ #define otbGetParameterImageMacro( Image ) \ Image##Type * GetParameter##Image( std::string parameter ) \ { \ @@ -321,8 +321,6 @@ public: otbGetParameterImageMacro(Int32RGBAImage); otbGetParameterImageMacro(FloatRGBAImage); otbGetParameterImageMacro(DoubleRGBAImage); - - /* Get an image list value * * Can be called for types : @@ -433,6 +431,12 @@ protected: //TODO: exception if not found ? return ret; } + + /** Declare a parameter as having an automatic value */ + void AutomaticValueOn(std::string paramKey); + + /** Declare a parameter as NOT having an automatic value */ + void AutomaticValueOff(std::string paramKey); /* Set an output image value * -- GitLab