From 2ff0eee15ea6d7173c23d17027a9155177948e47 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Mon, 14 Dec 2009 16:38:25 +0800
Subject: [PATCH] BUG: fix TileMapIO problem

---
 .../ossim/imaging/ossimTileMapTileSource.h    |  28 ----
 .../ossim/projection/ossimTileMapModel.h      |   4 +-
 .../ossim/imaging/ossimTileMapTileSource.cpp  | 142 +-----------------
 3 files changed, 7 insertions(+), 167 deletions(-)

diff --git a/Utilities/otbossim/include/ossim/imaging/ossimTileMapTileSource.h b/Utilities/otbossim/include/ossim/imaging/ossimTileMapTileSource.h
index 2913cf54c0..4ab83b1ca0 100644
--- a/Utilities/otbossim/include/ossim/imaging/ossimTileMapTileSource.h
+++ b/Utilities/otbossim/include/ossim/imaging/ossimTileMapTileSource.h
@@ -40,18 +40,6 @@ public:
 
    virtual bool open();
 
-   virtual double getNullPixelValue(ossim_uint32 band=0)const;
-
-   virtual double getMinPixelValue(ossim_uint32 band=0)const;
-
-   virtual double getMaxPixelValue(ossim_uint32 band=0)const;
-
-   virtual ossimScalarType getOutputScalarType() const;
-
-   bool getAcquisitionDate(ossimDate& date)const;
-   ossimString getSatelliteName()const;
-
-   ossimFilename getBandFilename(ossim_uint32 idx)const;
 
    //! Returns the image geometry object associated with this tile source or NULL if non defined.
    //! The geometry contains full-to-local image transform as well as projection (image-to-world)
@@ -62,28 +50,12 @@ public:
    virtual bool loadState(const ossimKeywordlist& kwl,
                           const char* prefix = NULL);
 
-   /**
-    * @brief Gets a property for matching name.
-    * @param name The name of the property to get.
-    * @return Returns property matching "name".
-    */
-   virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
-
-   /**
-    * @brief Gets a list of property names available.
-    * @param propertyNames The list to push back names to.
-    */
-   virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
 
 protected:
   virtual ~ossimTileMapTileSource();
 
 private:
 
-   void openHeader(const ossimFilename& file);
-
-   ossimRefPtr<ossimFfL7> theFfHdr;
-
    TYPE_DATA
 };
 
diff --git a/Utilities/otbossim/include/ossim/projection/ossimTileMapModel.h b/Utilities/otbossim/include/ossim/projection/ossimTileMapModel.h
index 068bd75709..a0d0b9daa2 100644
--- a/Utilities/otbossim/include/ossim/projection/ossimTileMapModel.h
+++ b/Utilities/otbossim/include/ossim/projection/ossimTileMapModel.h
@@ -46,8 +46,6 @@ public:
    ossimTileMapModel(const ossimKeywordlist& geom_kwl);
    ossimTileMapModel(const ossimTileMapModel& rhs);
 
-   virtual ~ossimTileMapModel();
-
    enum ProjectionType
    {
       UNKNOWN_PROJECTION = 0,
@@ -141,6 +139,8 @@ public:
 
 protected:
 
+   virtual ~ossimTileMapModel();
+
    /*!
     * Initializes the model given a fast format header.
     */
diff --git a/Utilities/otbossim/src/ossim/imaging/ossimTileMapTileSource.cpp b/Utilities/otbossim/src/ossim/imaging/ossimTileMapTileSource.cpp
index 4399131a84..ae938fef67 100644
--- a/Utilities/otbossim/src/ossim/imaging/ossimTileMapTileSource.cpp
+++ b/Utilities/otbossim/src/ossim/imaging/ossimTileMapTileSource.cpp
@@ -16,8 +16,6 @@
 #include <ossim/base/ossimTrace.h>
 #include <ossim/base/ossimNotifyContext.h>
 #include <ossim/base/ossimKeywordNames.h>
-#include <ossim/support_data/ossimFfL7.h>
-#include <ossim/support_data/ossimFfL5.h>
 #include <ossim/projection/ossimTileMapModel.h>
 
 RTTI_DEF1_INST(ossimTileMapTileSource,
@@ -32,8 +30,7 @@ static ossimTrace traceDebug("ossimTileMapTileSource:debug");
 //*******************************************************************
 ossimTileMapTileSource::ossimTileMapTileSource()
    :
-      ossimGeneralRasterTileSource(),
-      theFfHdr(NULL)
+      ossimGeneralRasterTileSource()
 {
 }
 
@@ -43,8 +40,7 @@ ossimTileMapTileSource::ossimTileMapTileSource()
 ossimTileMapTileSource::ossimTileMapTileSource(const ossimKeywordlist& kwl,
                                                const char* prefix)
    :
-      ossimGeneralRasterTileSource(),
-      theFfHdr(NULL)
+      ossimGeneralRasterTileSource()
 {
    if (loadState(kwl, prefix) == false)
    {
@@ -57,7 +53,7 @@ ossimTileMapTileSource::ossimTileMapTileSource(const ossimKeywordlist& kwl,
 //*******************************************************************
 ossimTileMapTileSource::~ossimTileMapTileSource()
 {
-   theFfHdr = NULL;
+//   theFfHdr = NULL;
 }
 
 bool ossimTileMapTileSource::open()
@@ -76,36 +72,6 @@ bool ossimTileMapTileSource::open()
    return false;
 }
 
-void ossimTileMapTileSource::openHeader(const ossimFilename& file)
-{
-   //***
-   // TileMap file name example:  l71024031_03119990929_hpn.fst
-   // Three header header file type substrings:
-   // HPN = Pan
-   // HRF = VNIR/SWIR (visible near infrared/shortwave infrared)
-   // HTM = Thermal
-   //***
-
-   ossimFilename hdr = file.file();
-   hdr.downcase();
-   if ( hdr.contains("hpn") || hdr.contains("hrf") || hdr.contains("htm") )
-   {
-      theFfHdr = new ossimFfL7(file.c_str());
-   } else if (hdr.contains("header.dat"))
-   {
-      theFfHdr = new ossimFfL5(file.c_str());
-   } else {
-      theFfHdr = NULL;
-      return;
-   }
-   if (theFfHdr->getErrorStatus() != ossimErrorCodes::OSSIM_OK)
-   {
-      theFfHdr = 0;
-   }
-   return;
-
-}
-
 ossimImageGeometry* ossimTileMapTileSource::getImageGeometry()
 {
 
@@ -113,10 +79,10 @@ ossimImageGeometry* ossimTileMapTileSource::getImageGeometry()
    if (result->getProjection())
       return theGeometry.get();
 
-   if (!theFfHdr) return result;
+//   if (!theFfHdr) return result;
 
    // Make a model
-   ossimTileMapModel* model = new ossimTileMapModel (*theFfHdr);
+   ossimTileMapModel* model = new ossimTileMapModel ();
 
    if (model->getErrorStatus() != ossimErrorCodes::OSSIM_OK)
       return false;
@@ -134,33 +100,6 @@ bool ossimTileMapTileSource::loadState(const ossimKeywordlist& kwl,
 
 }
 
-ossimRefPtr<ossimProperty> ossimTileMapTileSource::getProperty(
-   const ossimString& name)const
-{
-   ossimRefPtr<ossimProperty> result = 0;
-
-   if (theFfHdr.valid())
-   {
-      result = theFfHdr->getProperty(name);
-   }
-
-   if ( result.valid() == false )
-   {
-      result = ossimGeneralRasterTileSource::getProperty(name);
-   }
-
-   return result;
-}
-
-void ossimTileMapTileSource::getPropertyNames(
-   std::vector<ossimString>& propertyNames)const
-{
-   if (theFfHdr.valid())
-   {
-      theFfHdr->getPropertyNames(propertyNames);
-   }
-   ossimGeneralRasterTileSource::getPropertyNames(propertyNames);
-}
 
 ossimString ossimTileMapTileSource::getShortName() const
 {
@@ -177,76 +116,5 @@ ossimString  ossimTileMapTileSource::className() const
    return ossimString("ossimTileMapTileSource");
 }
 
-double ossimTileMapTileSource::getNullPixelValue(ossim_uint32)const
-{
-   return 0.0;
-}
-
-double ossimTileMapTileSource::getMinPixelValue(ossim_uint32)const
-{
-   return 1.0;
-}
-
-double ossimTileMapTileSource::getMaxPixelValue(ossim_uint32)const
-{
-   return 255.0;
-}
-
-ossimScalarType ossimTileMapTileSource::getOutputScalarType() const
-{
-   return OSSIM_UINT8;
-}
-
-bool ossimTileMapTileSource::getAcquisitionDate(ossimDate& date)const
-{
-   if(!theFfHdr) return false;
-
-   theFfHdr->getAcquisitionDate(date);
-
-   return true;
-}
-
-ossimString ossimTileMapTileSource::getSatelliteName()const
-{
-   if(!theFfHdr) return "";
-
-   return theFfHdr->getSatelliteName();
-}
-
-ossimFilename ossimTileMapTileSource::getBandFilename(ossim_uint32 idx)const
-{
-   ossim_uint32 maxIdx = getNumberOfInputBands();
-
-   if(!theFfHdr||(idx > maxIdx))
-   {
-      return "";
-   }
-
-   ossimFilename path = getFilename().path();
-   ossimString filename = theFfHdr->getBandFilename(idx);
-   filename = filename.trim();
-   ossimFilename file = path.dirCat(filename);
-
-   if (file.exists())
-   {
-      return file;
-   }
-
-   // Try downcased name.
-   file = path.dirCat(filename.downcase());
-   if (file.exists())
-   {
-      return file;
-   }
-
-   // Try upcase name.
-   file = path.dirCat(filename.upcase());
-   if (file.exists())
-   {
-      return file;
-   }
-
-   return ossimFilename();
-}
 
 
-- 
GitLab