From 63fedfa281d647c27873d2debd874d772fc46a17 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Tue, 13 Dec 2011 15:57:34 +0100
Subject: [PATCH] ENH: add average elevation and geoid file accessors in the
 kmz writer

---
 Code/IO/otbKmzProductWriter.h   |  8 ++++++++
 Code/IO/otbKmzProductWriter.txx | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Code/IO/otbKmzProductWriter.h b/Code/IO/otbKmzProductWriter.h
index 8a014cbe34..008eedc27f 100644
--- a/Code/IO/otbKmzProductWriter.h
+++ b/Code/IO/otbKmzProductWriter.h
@@ -161,6 +161,12 @@ public:
   /** Set the DEM Direcotory */
   itkSetStringMacro(DEMDirectory);
 
+  /** Set the geoid file if any */
+  itkSetStringMacro(GeoidFile);
+
+  /** Set the geoid file if any */
+  itkSetMacro(AverageElevation, double);
+
 protected:
   KmzProductWriter();
   virtual ~KmzProductWriter();
@@ -314,6 +320,8 @@ private:
 
   // DEM directory
   std::string            m_DEMDirectory;
+  std::string            m_GeoidFile;
+  double                 m_AverageElevation;
 };
 
 } // end namespace otb
diff --git a/Code/IO/otbKmzProductWriter.txx b/Code/IO/otbKmzProductWriter.txx
index 80984554d1..ff6d319d13 100644
--- a/Code/IO/otbKmzProductWriter.txx
+++ b/Code/IO/otbKmzProductWriter.txx
@@ -32,7 +32,8 @@ template <class TInputImage>
 KmzProductWriter<TInputImage>
 ::KmzProductWriter():
   m_UseExtendMode(true),
-  m_TileSize(512)
+  m_TileSize(512),
+  m_AverageElevation(-32768.0)
 {
   // Modify superclass default values, can be overridden by subclasses
   this->SetNumberOfRequiredInputs(1);
@@ -435,7 +436,14 @@ KmzProductWriter<TInputImage>
         m_Transform->SetInputProjectionRef(m_VectorImage->GetProjectionRef());
         m_Transform->SetOutputProjectionRef(wgsRef);
         if (!m_DEMDirectory.empty())
+          {
           m_Transform->SetDEMDirectory(m_DEMDirectory);
+          m_Transform->SetGeoidFile(m_GeoidFile);
+          }
+        else
+          {
+          m_Transform->SetAverageElevation(m_AverageElevation);
+          }
         m_Transform->InstanciateTransform();
 
         InputPointType  inputPoint;
-- 
GitLab