From f39260b9f74559d83070a31ff787d57993c0190b Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Tue, 14 Jun 2011 16:17:14 +0200
Subject: [PATCH] ENH: add possibility to set DEM from the configuration file

---
 .../otbConnectedComponentSegmentation.cxx              | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ConnectedComponentSegmentation/otbConnectedComponentSegmentation.cxx b/ConnectedComponentSegmentation/otbConnectedComponentSegmentation.cxx
index f4420cb1df..d0fc1b46cb 100644
--- a/ConnectedComponentSegmentation/otbConnectedComponentSegmentation.cxx
+++ b/ConnectedComponentSegmentation/otbConnectedComponentSegmentation.cxx
@@ -128,10 +128,18 @@ int ConnectedComponentSegmentation::Execute(otb::ApplicationOptionsResult* parse
     vproj->SetInputOrigin(inputImage->GetOrigin());
     vproj->SetInputSpacing(inputImage->GetSpacing());
 
-    if( parseResult->IsOptionPresent("DEMDirectory") )
+    // Configure DEM directory
+    if(parseResult->IsOptionPresent("DEMDirectory"))
       {
       vproj->SetDEMDirectory(parseResult->GetParameterString("DEMDirectory"));
       }
+    else
+      {
+      if ( otb::ConfigurationFile::GetInstance()->IsValid() )
+        {
+        vproj->SetDEMDirectory(otb::ConfigurationFile::GetInstance()->GetDEMDirectory());
+        }
+      }
 
     vproj->Update();
 
-- 
GitLab