From e5269c364dab0e95fb968ec313dc6a94f9301f3f Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Mon, 12 Dec 2011 17:27:09 +0100
Subject: [PATCH] ENH: use the value in the configuration file to initialize
 the dem directory and the geoid file

---
 .../otbWrapperElevationParametersHandler.cxx                 | 5 +++--
 .../ApplicationEngine/otbWrapperElevationParametersHandler.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx b/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx
index ee9f09b621..bca0ac68a3 100644
--- a/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx
+++ b/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx
@@ -37,7 +37,7 @@ void ElevationParametersHandler::AddElevationParameters(Application::Pointer app
   app->AddParameter(ParameterType_Directory, oss.str(), "DEM directory");
   app->SetParameterDescription(oss.str(),
                                "This parameter allows to select a directory containing Digital Elevation Model tiles");
-  app->MandatoryOff(oss.str());
+  app->SetParameterString(oss.str(), otb::ConfigurationFile::GetInstance()->GetDEMDirectory());
 
   // Average elevation
   oss.str("");
@@ -61,6 +61,7 @@ void ElevationParametersHandler::AddElevationParameters(Application::Pointer app
   oss << ".value";
   app->AddParameter(ParameterType_Filename, oss.str(), "Geoid File");
   app->SetParameterDescription(oss.str(),"Use a geoid grid to get the height above the ellipsoid used");
+  app->SetParameterString(oss.str(), otb::ConfigurationFile::GetInstance()->GetGeoidFile());
 
   // Set the default value
   app->SetParameterString(key, "dem");
@@ -106,7 +107,7 @@ ElevationParametersHandler::GetGeoidFile(const Application::Pointer app, const s
  *
  * Get the Elevation mode choosen by the user
  */
-const ElevationType 
+ElevationType 
 ElevationParametersHandler::GetElevationType(const Application::Pointer app, const std::string& key)
 {
   switch(app->GetParameterInt(key))
diff --git a/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h b/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h
index ef52df311c..997361ed81 100644
--- a/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h
+++ b/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h
@@ -52,7 +52,7 @@ public:
     * projection picked up by the user
     *
     */
-  static const ElevationType GetElevationType(const Application::Pointer app, const std::string& key);
+  static ElevationType GetElevationType(const Application::Pointer app, const std::string& key);
 
   /** Method for getting the value of the elevation mode selected */
   static const std::string GetDEMDirectory(const Application::Pointer app, const std::string& key);
-- 
GitLab