[Git][debian-gis-team/ossim][master] 5 commits: New upstream version 2.5.2

Bas Couwenberg gitlab at salsa.debian.org
Wed Oct 17 06:41:53 BST 2018


Bas Couwenberg pushed to branch master at Debian GIS Project / ossim


Commits:
f3c33767 by Bas Couwenberg at 2018-10-17T05:09:33Z
New upstream version 2.5.2
- - - - -
9b4c57ef by Bas Couwenberg at 2018-10-17T05:09:56Z
Merge tag 'upstream/2.5.2'

Upstream version 2.5.2

- - - - -
824f4797 by Bas Couwenberg at 2018-10-17T05:14:10Z
New upstream release.

- - - - -
7ba7d4e0 by Bas Couwenberg at 2018-10-17T05:17:08Z
Refresh patches.

- - - - -
302cf18a by Bas Couwenberg at 2018-10-17T05:17:21Z
Set distribution to unstable.

- - - - -


21 changed files:

- README.md
- debian/changelog
- debian/patches/spelling-errors.patch
- include/ossim/base/ossimString.h
- include/ossim/base/ossimXmlNode.h
- include/ossim/imaging/ossimTiffTileSource.h
- include/ossim/support_data/TiffHandlerState.h
- + include/ossim/support_data/ossimNitfSicdXmlDes.h
- include/ossim/support_data/ossimQuickbirdMetaData.h
- include/ossim/support_data/ossimTiffInfo.h
- src/base/ossimString.cpp
- src/base/ossimXmlNode.cpp
- src/imaging/ossimSICDToDetectedImage.cpp
- src/imaging/ossimTiffTileSource.cpp
- src/support_data/TiffHandlerState.cpp
- src/support_data/ossimGeoTiff.cpp
- src/support_data/ossimNitfRegisteredDesFactory.cpp
- + src/support_data/ossimNitfSicdXmlDes.cpp
- src/support_data/ossimNitfXmlDataContentDes.cpp
- src/support_data/ossimQuickbirdMetaData.cpp
- src/support_data/ossimTiffInfo.cpp


Changes:

=====================================
README.md
=====================================
@@ -1,10 +1,10 @@
 ### Jenkins Build Status 
 Resource | *master* | *dev* | 
 ------------ | ------------- | -------------
-OSSIM Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-dev&style=plastic)
-Batch Test| ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=ossim-test-dev&style=plastic)
-RPMS Build Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-dev&style=plastic)
-RPMS Publish Centos7 | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-master&style=plastic) | ![centos7 Status](https://jenkins.radiantbluecloud.com/buildStatus/icon/?job=rpm-publish-dev&style=plastic)
+OSSIM Build Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-dev&style=plastic)
+Batch Test| ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-test-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=ossim-test-dev&style=plastic)
+RPMS Build Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-dev&style=plastic)
+RPMS Publish Centos7 | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-publish-master&style=plastic) | ![centos7 Status](https://jenkins.ossim.io/buildStatus/icon/?job=rpm-publish-dev&style=plastic)
 
  
 <a href="https://scan.coverity.com/projects/ossimlabs">


=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+ossim (2.5.2-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+  * Refresh patches.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 17 Oct 2018 07:17:12 +0200
+
 ossim (2.5.1-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/spelling-errors.patch
=====================================
@@ -81,22 +81,22 @@ Author: Bas Couwenberg <sebastic at debian.org>
                 << std::endl;
 --- a/src/support_data/ossimTiffInfo.cpp
 +++ b/src/support_data/ossimTiffInfo.cpp
-@@ -334,7 +334,7 @@ std::ostream& ossimTiffInfo::print(std::
-          if(traceDebug())
+@@ -334,7 +334,7 @@ std::ostream &ossimTiffInfo::print(std::
+          if (traceDebug())
           {
              ossimNotify(ossimNotifyLevel_WARN)
--               << MODULE << " FATAL error reading number of direcories."
-+               << MODULE << " FATAL error reading number of directories."
-                << std::endl;
+-                << MODULE << " FATAL error reading number of direcories."
++                << MODULE << " FATAL error reading number of directories."
+                 << std::endl;
           }
           m_inputStream.reset();
-@@ -764,7 +764,7 @@ std::ostream& ossimTiffInfo::print(std::
-          if(traceDebug())
+@@ -767,7 +767,7 @@ std::ostream &ossimTiffInfo::print(std::
+          if (traceDebug())
           {
              ossimNotify(ossimNotifyLevel_WARN)
--               << MODULE << " FATAL error reading number of direcories."
-+               << MODULE << " FATAL error reading number of directories."
-                << std::endl;
+-                << MODULE << " FATAL error reading number of direcories."
++                << MODULE << " FATAL error reading number of directories."
+                 << std::endl;
           }
           return outStr;
 --- a/src/util/ossimChipperUtil.cpp


=====================================
include/ossim/base/ossimString.h
=====================================
@@ -389,6 +389,16 @@ public:
    ossimString& downcase();
    ossimString downcase()const;
 
+   /**
+    * @return true if the string ends in the pattern specified
+    */
+   bool endsWith(const ossimString &pattern) const;
+
+   /**
+    * @return true if the string starts with the pattern specified
+    */
+   bool startsWith(const ossimString &pattern) const;
+
    /**
     * @brief Returns a pointer to a null-terminated array of characters
     * representing the string's contents.


=====================================
include/ossim/base/ossimXmlNode.h
=====================================
@@ -102,7 +102,8 @@ public:
    void clearAttributes();
    
    void toKwl(ossimKeywordlist& kwl,
-              const ossimString& prefix="")const;
+              const ossimString& prefix="",
+              bool includeTag=true)const;
    void fromKwl(const ossimKeywordlist& kwlToConvert);
   
 protected:


=====================================
include/ossim/imaging/ossimTiffTileSource.h
=====================================
@@ -266,7 +266,17 @@ private:
     *  directory + 1.
     */
    ossim_uint32 getCurrentTiffRLevel() const;
-   
+
+   /**
+    * @brief Convenience method to get the zero based rgb output band list.
+    *
+    * 
+    * @param bandList Initialized by this.
+    * @return true on success, false if number of bands is less than 3 or if
+    * rgb bands could not be derived.
+    */
+   virtual bool getRgbBandList(std::vector<ossim_uint32> &bandList) const;
+
    ossimString getReadMethod(ossim_uint32 directory) const;
    
    bool loadTile(const ossimIrect& tile_rect,


=====================================
include/ossim/support_data/TiffHandlerState.h
=====================================
@@ -264,13 +264,6 @@ namespace ossim
     */
     ossim_float64 getDoubleValue(const ossimString& key, ossim_int32 directory=0)const;
 
-    /**
-    * Convenience method to get a raster type.  
-    *
-    * This does not supply a way to check if a value existed or not.
-    */
-    ossim_int32 getRasterType(ossim_int32 directory=0)const;
-
     /**
     * Convenience method to get a pcs code.  
     *
@@ -390,6 +383,12 @@ namespace ossim
     */
     ossim_float64 getScaleFactor(ossim_int32 directory=0)const;
 
+    /**
+    * Convenience method to get a raster type.  
+    *
+    * This does not supply a way to check if a value existed or not.
+    */
+    ossim_int32 getRasterType(ossim_int32 directory = 0) const;
     ossim_int32 getPlanarConfig(ossim_int32 directory = 0) const;
     ossim_int32 getPhotoInterpretation(ossim_int32 directory = 0) const;
     ossim_int32 getCompressionType(ossim_int32 directory = 0) const;
@@ -405,6 +404,7 @@ namespace ossim
     bool isReduced(ossim_int32 directory = 0) const;
     bool isPage(ossim_int32 directory = 0) const;
     bool isMask(ossim_int32 directory = 0) const;
+    bool isDigitalGlobe()const;
     ossim_int32 getSubFileType(ossim_int32 directory = 0) const;
     ossim_uint32 getNumberOfDirectories()const;
     bool getColorMap(std::vector<ossim_uint16> &red,
@@ -430,7 +430,7 @@ namespace ossim
     * @param directory to use
     */
     bool getGeoDoubleParams(std::vector<ossim_float64>& result,
-                            ossim_int32 directory)const;
+                            ossim_int32 directory=0)const;
 
     /**
     * Convenience method to get a Geo double params array.  
@@ -448,9 +448,10 @@ namespace ossim
     * @param directory to use
     */
     bool getGeoTiePoints(std::vector<ossim_float64>& result,
-                         ossim_int32 directory)const;
+                         ossim_int32 directory=0)const;
 
-    bool getCitation(ossimString& citation, ossim_int32 directory)const;
+    bool getCitation(ossimString& citation, ossim_int32 directory=0)const;
+    bool getCopyright(ossimString &copyright, ossim_int32 directory = 0) const;
     /**
     * Convenience method to get a Geo trans matrix array.  
     *


=====================================
include/ossim/support_data/ossimNitfSicdXmlDes.h
=====================================
@@ -0,0 +1,27 @@
+#ifndef ossimNitfSicdXmlDes_HEADER
+#define ossimNitfSicdXmlDes_HEADER
+
+#include <ossim/support_data/ossimNitfRegisteredDes.h>
+#include <ossim/base/ossimXmlDocument.h>
+#include <ossim/base/ossimXmlNode.h>
+
+class OSSIM_DLL ossimNitfSicdXmlDes : public ossimNitfRegisteredDes
+{
+public:
+   ossimNitfSicdXmlDes();
+   virtual void parseStream(std::istream& in);
+   virtual void writeStream(std::ostream& out);
+
+   virtual std::ostream& print(std::ostream& out,
+                               const std::string& prefix=std::string()) const;
+   virtual void clearFields();
+   bool loadState(const ossimKeywordlist& kwl, const char* prefix);
+   bool loadValueFromXml(const ossimRefPtr<ossimXmlDocument>, const ossimString& xpath, ossimString& target) const;
+
+protected:
+   ossimString m_xmlString;
+   ossimRefPtr<ossimXmlDocument> m_xmlDocument;
+
+};
+
+#endif
\ No newline at end of file


=====================================
include/ossim/support_data/ossimQuickbirdMetaData.h
=====================================
@@ -18,8 +18,9 @@
 #include <ossim/base/ossimIpt.h>
 #include <ossim/base/ossimObject.h>
 #include <ossim/base/ossimString.h>
-
+#include <ossim/base/ossimKeywordlist.h>
 #include <iosfwd>
+#include <memory>
 
 class ossimFilename;
 class ossimKeywordlist;
@@ -27,46 +28,64 @@ class ossimKeywordlist;
 class OSSIMDLLEXPORT ossimQuickbirdMetaData : public ossimObject
 {
 public:
-
-   /** @brief default constructor */
-   ossimQuickbirdMetaData();
-
-   /** virtual destructor */
-   virtual ~ossimQuickbirdMetaData();
-
-   /**
-    * @brief Open method that takes the image file, derives the metadata,
-    * header and rpc files, then calls parse methods parseMetaData,
-    * parseHdrData, and parseRpcData.
+  enum QbParseTypes
+  {
+     QB_PARSE_TYPE_NONE = 0,
+     QB_PARSE_TYPE_IMD = 1,
+     QB_PARSE_TYPE_GEO = 2,
+     QB_PARSE_TYPE_RPB = 4,
+     QB_PARSE_TYPE_ATT = 8,
+     QB_PARSE_TYPE_STE = 16,
+     QB_PARSE_TYPE_EPH = 32,
+     QB_PARSE_TYPE_TIL = 64,
+     QB_PARSE_TYPE_ALL = QB_PARSE_TYPE_IMD | QB_PARSE_TYPE_GEO |
+                         QB_PARSE_TYPE_RPB | QB_PARSE_TYPE_ATT |
+                         QB_PARSE_TYPE_STE | QB_PARSE_TYPE_EPH |
+                         QB_PARSE_TYPE_TIL
+
+  };
+  /** @brief default constructor */
+  ossimQuickbirdMetaData();
+
+  /** virtual destructor */
+  virtual ~ossimQuickbirdMetaData();
+
+  /**
+    * @brief Open method that takes the image file.  By default we just 
+    *        parse the imd, for this the most common.  
     *
     * @param imageFile Usually in the form of "po_2619900_pan_0000000.tif".
-    *
+    * @param qbParseTypes The types of data to parse.  These are bitwise or 
+    *                     together.   By default we will only do QB_PARSE_TYPE_IMD.
+    *                     if you want more just QB_PARSE_TYPE_IMD | QB_PARSE_TYPE_GEO.
+    * 
     * @return true on success, false on error.
     */
-   bool open(const ossimFilename& imageFile);
+  bool open(const ossimFilename &imageFile,
+            ossim_int32 qbParseTypes = QB_PARSE_TYPE_IMD);
 
-   void clearFields();
+  void clearFields();
 
-   //---
-   // Convenient method to print important image info:
-   //---
-   virtual std::ostream& print(std::ostream& out) const;
+  //---
+  // Convenient method to print important image info:
+  //---
+  virtual std::ostream &print(std::ostream &out) const;
 
-   /**
+  /**
     * Method to save the state of the object to a keyword list.
     * Return true if ok or false on error.
     */
-   virtual bool saveState(ossimKeywordlist& kwl,
-                          const char* prefix = 0) const;
-   
-   /**
+  virtual bool saveState(ossimKeywordlist &kwl,
+                         const char *prefix = 0) const;
+
+  /**
     * Method to the load (recreate) the state of the object from a keyword
     * list.  Return true if ok or false on error.
     */
-   virtual bool loadState(const ossimKeywordlist& kwl,
-                          const char* prefix = 0);
+  virtual bool loadState(const ossimKeywordlist &kwl,
+                         const char *prefix = 0);
 
-   /**
+  /**
     * @brief Method to parse Quickbird metadata file.
     *
     * @param metadata File name usually in the form of
@@ -74,9 +93,9 @@ public:
     *
     * @return true on success, false on error.
     */
-   bool parseMetaData(const ossimFilename& metadata);
+  bool parseMetaData(const ossimFilename &metadata);
 
-   /**
+  /**
     * @brief Method to parse Quickbird rpc file.
     *
     * @param metadata File name usually in the form of
@@ -86,47 +105,68 @@ public:
     *
     * @note Currently NOT implemented.
     */
-   bool parseGEOData(const ossimFilename& data_file);
+  bool parseGEOData(const ossimFilename &data_file);
 
-   bool parseATTData(const ossimFilename& data_file);
+  bool parseATTData(const ossimFilename &data_file);
 
-   bool parseEPHData(const ossimFilename& data_file);
+  bool parseEPHData(const ossimFilename &data_file);
+  bool parseRPBData(const ossimFilename &data_file);
+  bool parseSTEData(const ossimFilename &data_file);
 
-   /** @return theSatID */
-   ossimString getSatID() const;
+  /** @return theSatID */
+  ossimString getSatID() const;
 
-   bool getEndOfLine( char * fileBuf,
-                      ossimString lineBeginning,
-                      const char * format,
-                      ossimString & name );
+  bool getEndOfLine(char *fileBuf,
+                    ossimString lineBeginning,
+                    const char *format,
+                    ossimString &name);
 
-   const ossimIpt& getImageSize() const;
+  const ossimIpt &getImageSize() const;
 
-   bool getMapProjectionKwl( const ossimFilename& imd_file,
-                             ossimKeywordlist& kwl );
+  bool getMapProjectionKwl(const ossimFilename &imd_file,
+                           ossimKeywordlist &kwl);
 
-/*****************************************
+  const std::shared_ptr<ossimKeywordlist> getImdKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getAttKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getGeoKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getEphKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getRpbKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getSteKwl() const;
+  const std::shared_ptr<ossimKeywordlist> getTilKwl() const;
+  /*****************************************
 *parseATTData EPH GEO IMD RPB TIL
 *
 ****************************************/
-   
-private:
 
-   ossimString         theGenerationDate;
-   ossimString         theBandId;
-   int                 theBitsPerPixel;	
-   ossimString         theSatID;
-   ossimString         theTLCDate;
-   ossim_float64       theSunAzimuth;
-   ossim_float64       theSunElevation;
-   ossim_float64       theSatAzimuth;
-   ossim_float64       theSatElevation;
-   int                 theTDILevel;
-   std::vector<double> theAbsCalFactors;
-   ossimString         theBandNameList;
-   ossimIpt            theImageSize;
-
-TYPE_DATA
+private:
+  ossimString theGenerationDate;
+  ossimString theBandId;
+  int theBitsPerPixel;
+  ossimString theSatID;
+  ossimString theTLCDate;
+  ossim_float64 theSunAzimuth;
+  ossim_float64 theSunElevation;
+  ossim_float64 theSatAzimuth;
+  ossim_float64 theSatElevation;
+  int theTDILevel;
+  std::vector<double> theAbsCalFactors;
+  ossimString theBandNameList;
+  ossimIpt theImageSize;
+  ossim_float64 thePNiirs;
+  ossim_float64 theCloudCoverage;
+
+  std::shared_ptr<ossimKeywordlist> m_imdKwl;
+  std::shared_ptr<ossimKeywordlist> m_attKwl;
+  std::shared_ptr<ossimKeywordlist> m_geoKwl;
+  std::shared_ptr<ossimKeywordlist> m_ephKwl;
+  std::shared_ptr<ossimKeywordlist> m_rpbKwl;
+  std::shared_ptr<ossimKeywordlist> m_steKwl;
+  std::shared_ptr<ossimKeywordlist> m_tilKwl;
+
+  bool parse(std::shared_ptr<ossimKeywordlist> &kwl,
+             const ossimFilename &file);
+
+  TYPE_DATA
 };
 
 #endif /* #ifndef ossimQuickbirdMetaData_HEADER */


=====================================
include/ossim/support_data/ossimTiffInfo.h
=====================================
@@ -628,6 +628,9 @@ private:
    bool hasOneBasedTiePoints(const std::vector<ossim_float64>& ties,
                              ossim_uint32 width,
                              ossim_uint32 height) const;
+   std::ostream& printDigitalGlobe(std::ostream& out,
+                                    const std::string& prefix)const;
+
    
    std::string m_connectionString;
    mutable std::shared_ptr<ossim::istream> m_inputStream;


=====================================
src/base/ossimString.cpp
=====================================
@@ -97,6 +97,20 @@ ossimString ossimString::downcase()const
    return result;
 }
 
+bool ossimString::endsWith(const ossimString &pattern) const
+{
+   ossimString endsPattern = pattern + "$";
+   ossimRegExp regex(endsPattern.c_str());
+   return regex.find(c_str());
+}
+
+bool ossimString::startsWith(const ossimString &pattern) const
+{
+   ossimString startsPattern = "^"+pattern;
+   ossimRegExp regex(startsPattern.c_str());
+   return regex.find(c_str());
+}
+
 char* ossimString::stringDup()const
 {
    char *result = 0;


=====================================
src/base/ossimXmlNode.cpp
=====================================
@@ -1,13 +1,13 @@
 //*******************************************************************
 //
 // License:  See top level LICENSE.txt file.
-// 
+//
 // Author:  Oscar Kramer <okramer at imagelinks.com> (ossim port by D. Burken)
 //
-// Description:  
+// Description:
 //
 // Contains definition of class ossimXmlNode.
-// 
+//
 //*****************************************************************************
 // $Id: ossimXmlNode.cpp 20747 2012-04-18 15:24:12Z gpotts $
 
@@ -17,1071 +17,1135 @@
 #include <ossim/base/ossimKeywordlist.h>
 #include <ossim/base/ossimNotifyContext.h>
 #include <ossim/base/ossimTrace.h>
+#include <memory>
+namespace
+{ // Anonymous namespace
+// Constants
+const char XPATH_DELIM('/');
+ossimRefPtr<ossimXmlNode> const nullNode(0);
 
-namespace {// Anonymous namespace
-   // Constants
-   const char XPATH_DELIM ('/');
-   ossimRefPtr<ossimXmlNode> const nullNode(0);
-
-   // Globals
-   ossimTrace traceDebug("ossimXmlNode:debug");
-}// Anonymous namespace
+// Globals
+ossimTrace traceDebug("ossimXmlNode:debug");
+} // Anonymous namespace
 
 RTTI_DEF2(ossimXmlNode, "ossimXmlNode", ossimObject, ossimErrorStatusInterface);
 
-static std::istream& xmlskipws(std::istream& in)
+static std::istream &xmlskipws(std::istream &in)
 {
-   int c = in.peek();
-   while( !in.fail() &&
-         (( (c== ' ') || (c == '\t') || (c == '\n')|| (c == '\r') || (c<0x20) || (c>=0x7f) ))
-         )
-   {
-      in.ignore(1);
-      c = in.peek();
-   }
-   
-   return in;
+	int c = in.peek();
+	while (!in.fail() &&
+			 (((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r') || (c < 0x20) || (c >= 0x7f))))
+	{
+		in.ignore(1);
+		c = in.peek();
+	}
+
+	return in;
 }
 
-ossimXmlNode::ossimXmlNode(istream& xml_stream, ossimXmlNode* parent)
-:
-theParentNode (parent),
-theCDataFlag(false)
+ossimXmlNode::ossimXmlNode(istream &xml_stream, ossimXmlNode *parent)
+	 : theParentNode(parent),
+		theCDataFlag(false)
 {
-   read(xml_stream);
+	read(xml_stream);
 }
 
 ossimXmlNode::ossimXmlNode()
-:theParentNode(0),
-theCDataFlag(false)
+	 : theParentNode(0),
+		theCDataFlag(false)
 {
 }
 
-ossimXmlNode::ossimXmlNode(const ossimXmlNode& src)
-:theTag(src.theTag),
-theParentNode(0),
-theText(src.theText),
-theCDataFlag(src.theCDataFlag)
+ossimXmlNode::ossimXmlNode(const ossimXmlNode &src)
+	 : theTag(src.theTag),
+		theParentNode(0),
+		theText(src.theText),
+		theCDataFlag(src.theCDataFlag)
 {
-   ossim_uint32 idx = 0;
-   for(idx = 0; idx < src.theChildNodes.size();++idx)
-   {
-      theChildNodes.push_back((ossimXmlNode*)(src.theChildNodes[idx]->dup()));
-   }
-   for(idx = 0; idx < src.theAttributes.size();++idx)
-   {
-      theAttributes.push_back((ossimXmlAttribute*)(src.theAttributes[idx]->dup()));
-   }
+	ossim_uint32 idx = 0;
+	for (idx = 0; idx < src.theChildNodes.size(); ++idx)
+	{
+		theChildNodes.push_back((ossimXmlNode *)(src.theChildNodes[idx]->dup()));
+	}
+	for (idx = 0; idx < src.theAttributes.size(); ++idx)
+	{
+		theAttributes.push_back((ossimXmlAttribute *)(src.theAttributes[idx]->dup()));
+	}
 }
 
 ossimXmlNode::~ossimXmlNode()
 {
 }
 
-void ossimXmlNode::duplicateAttributes(ossimXmlNode::AttributeListType result)const
+void ossimXmlNode::duplicateAttributes(ossimXmlNode::AttributeListType result) const
 {
-   ossim_uint32 idx = 0;
-   for(idx = 0; idx<theAttributes.size();++idx)
-   {
-      result.push_back((ossimXmlAttribute*)theAttributes[idx]->dup());
-   }
-	
+	ossim_uint32 idx = 0;
+	for (idx = 0; idx < theAttributes.size(); ++idx)
+	{
+		result.push_back((ossimXmlAttribute *)theAttributes[idx]->dup());
+	}
 }
 
-void ossimXmlNode::duplicateChildren(ossimXmlNode::ChildListType& result)const
+void ossimXmlNode::duplicateChildren(ossimXmlNode::ChildListType &result) const
 {
-   ossim_uint32 idx = 0;
-   for(idx = 0; idx<theChildNodes.size();++idx)
-   {
-      result.push_back((ossimXmlNode*)theChildNodes[idx]->dup());
-   }
+	ossim_uint32 idx = 0;
+	for (idx = 0; idx < theChildNodes.size(); ++idx)
+	{
+		result.push_back((ossimXmlNode *)theChildNodes[idx]->dup());
+	}
 }
 
-void ossimXmlNode::setParent(ossimXmlNode* parent)
+void ossimXmlNode::setParent(ossimXmlNode *parent)
 {
-   theParentNode = parent;
+	theParentNode = parent;
 }
 
-void ossimXmlNode::skipCommentTag(std::istream& in)
+void ossimXmlNode::skipCommentTag(std::istream &in)
 {
-   char c;
-   while(!in.fail())
-   {
-      c = in.get();
-      if(c == '-')
-      {
-         if(in.peek() == '-')
-         {
-            in.ignore();
-            if(in.peek() == '>')
-            {
-               in.ignore();
-               return;
-            }
-         }
-      }
-   }
+	char c;
+	while (!in.fail())
+	{
+		c = in.get();
+		if (c == '-')
+		{
+			if (in.peek() == '-')
+			{
+				in.ignore();
+				if (in.peek() == '>')
+				{
+					in.ignore();
+					return;
+				}
+			}
+		}
+	}
 }
 
-bool ossimXmlNode::read(std::istream& in)
+bool ossimXmlNode::read(std::istream &in)
 {
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::read: entered ......\n";
-   }
-   char c;
-   xmlskipws(in);
-   if(in.fail())
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-   if(in.peek() == '<')
-   {
-      in.ignore(1);
-   }
-   if(in.fail())
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-
-   ossimString endTag;
-   
-   if(!readTag(in, theTag))
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG) << "theTag = " << theTag << "\n";
-   }
-   
-   if((!in.fail())&&readEndTag(in, endTag))
-   {
-      if((endTag == "")||
-         (endTag == theTag))
-      {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return true;
-      }
-      else
-      {
-         setErrorStatus();
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return false;
-      }
-   }
-   // now parse attributes
-   ossimRefPtr<ossimXmlAttribute> attribute = new ossimXmlAttribute;
-   while(attribute->read(in))
-   {
-      theAttributes.push_back(new ossimXmlAttribute(*attribute));
-   }
-   // skip white space characters
-   //
-   xmlskipws(in);
-   
-   if(!in.fail()&&readEndTag(in, endTag))
-   {
-      if((endTag == "")||
-         (endTag == theTag))
-      {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return true;
-      }
-      else
-      {
-         setErrorStatus();
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return false;
-      }
-   }
-   c = in.peek();
-   // make sure the attribute is closed
-   //
-   if(c != '>')
-   {
-      setErrorStatus();
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-   
-   in.ignore(1);
-   c = in.peek();
-   
-   // now do the text portion
-   if(!readTextContent(in))
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-   xmlskipws(in);
-   c = in.peek();
-   
-   if(c != '<')
-   {
-      setErrorStatus();
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-            << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-      }
-      return false;
-   }
-   in.ignore(1);
-   if(readEndTag(in, endTag))
-   {
-      if((endTag == "")||
-         (endTag == theTag))
-      {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return true;
-      }
-      else
-      {
-         setErrorStatus();
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return false;
-      }
-   }
-   c = in.peek();
-
-   //---
-   // now if it's not an endtag then it must be a tag starting the new child
-   // node
-   //---
-   ossimRefPtr<ossimXmlNode> childNode;
-   do
-   {
-      childNode = new ossimXmlNode;
-      childNode->setParent(this);
-      if(childNode->read(in))
-      {
-         theChildNodes.push_back(childNode);
-      }
-      else
-      {
-         setErrorStatus();
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return false;
-      }
-      xmlskipws(in);
-      
-      c = in.peek();
-      if(c != '<')
-      {
-         setErrorStatus();
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_DEBUG)
-               << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-         }
-         return false;
-      }
-      in.ignore(1);
-      if(readEndTag(in, endTag))
-      {
-         if((endTag == "")||
-            (endTag == theTag))
-         {
-            if(traceDebug())
-            {
-               ossimNotify(ossimNotifyLevel_DEBUG)
-                  << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-            }
-            return true;
-         }
-         else
-         {
-            setErrorStatus();
-            if(traceDebug())
-            {
-               ossimNotify(ossimNotifyLevel_DEBUG)
-                  << "ossimXmlNode::read: leaving ......\n"<<__LINE__ << "\n";
-            }
-            return false;
-         }
-      }
-   }while( !in.fail() );
-   
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::read: leaving ......\n";
-   }
-   return true;
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::read: entered ......\n";
+	}
+	char c;
+	xmlskipws(in);
+	if (in.fail())
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+	if (in.peek() == '<')
+	{
+		in.ignore(1);
+	}
+	if (in.fail())
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+
+	ossimString endTag;
+
+	if (!readTag(in, theTag))
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG) << "theTag = " << theTag << "\n";
+	}
+
+	if ((!in.fail()) && readEndTag(in, endTag))
+	{
+		if ((endTag == "") ||
+			 (endTag == theTag))
+		{
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return true;
+		}
+		else
+		{
+			setErrorStatus();
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return false;
+		}
+	}
+	// now parse attributes
+	ossimRefPtr<ossimXmlAttribute> attribute = new ossimXmlAttribute;
+	while (attribute->read(in))
+	{
+		theAttributes.push_back(new ossimXmlAttribute(*attribute));
+	}
+	// skip white space characters
+	//
+	xmlskipws(in);
+
+	if (!in.fail() && readEndTag(in, endTag))
+	{
+		if ((endTag == "") ||
+			 (endTag == theTag))
+		{
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return true;
+		}
+		else
+		{
+			setErrorStatus();
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return false;
+		}
+	}
+	c = in.peek();
+	// make sure the attribute is closed
+	//
+	if (c != '>')
+	{
+		setErrorStatus();
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+
+	in.ignore(1);
+	c = in.peek();
+
+	// now do the text portion
+	if (!readTextContent(in))
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+	xmlskipws(in);
+	c = in.peek();
+
+	if (c != '<')
+	{
+		setErrorStatus();
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_DEBUG)
+				 << "ossimXmlNode::read: leaving ......\n"
+				 << __LINE__ << "\n";
+		}
+		return false;
+	}
+	in.ignore(1);
+	if (readEndTag(in, endTag))
+	{
+		if ((endTag == "") ||
+			 (endTag == theTag))
+		{
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return true;
+		}
+		else
+		{
+			setErrorStatus();
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return false;
+		}
+	}
+	c = in.peek();
+
+	//---
+	// now if it's not an endtag then it must be a tag starting the new child
+	// node
+	//---
+	ossimRefPtr<ossimXmlNode> childNode;
+	do
+	{
+		childNode = new ossimXmlNode;
+		childNode->setParent(this);
+		if (childNode->read(in))
+		{
+			theChildNodes.push_back(childNode);
+		}
+		else
+		{
+			setErrorStatus();
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return false;
+		}
+		xmlskipws(in);
+
+		c = in.peek();
+		if (c != '<')
+		{
+			setErrorStatus();
+			if (traceDebug())
+			{
+				ossimNotify(ossimNotifyLevel_DEBUG)
+					 << "ossimXmlNode::read: leaving ......\n"
+					 << __LINE__ << "\n";
+			}
+			return false;
+		}
+		in.ignore(1);
+		if (readEndTag(in, endTag))
+		{
+			if ((endTag == "") ||
+				 (endTag == theTag))
+			{
+				if (traceDebug())
+				{
+					ossimNotify(ossimNotifyLevel_DEBUG)
+						 << "ossimXmlNode::read: leaving ......\n"
+						 << __LINE__ << "\n";
+				}
+				return true;
+			}
+			else
+			{
+				setErrorStatus();
+				if (traceDebug())
+				{
+					ossimNotify(ossimNotifyLevel_DEBUG)
+						 << "ossimXmlNode::read: leaving ......\n"
+						 << __LINE__ << "\n";
+				}
+				return false;
+			}
+		}
+	} while (!in.fail());
+
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::read: leaving ......\n";
+	}
+	return true;
 }
 
-
-void ossimXmlNode::findChildNodes(const ossimString& xpath,
-                                  ossimXmlNode::ChildListType& result)const
+void ossimXmlNode::findChildNodes(const ossimString &xpath,
+											 ossimXmlNode::ChildListType &result) const
 {
-   //***
-   // Scan for trivial result (no children owned):
-   //***
-   if (theChildNodes.empty())
-      return;
-   
-   if (xpath.empty())
-      return;
-   
-   //---
-   // First verify that this is not an absolute path:
-   //---
-   if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_WARN)
-            << "WARNING: ossimXmlNode::findChildNodes\n"
-            << "Only relative XPaths can be searched from a node. "
-            << "Returning null list...\n";
-         }
-      return;
-   }
-   
-   //***
-   // Read the desired tag from the relative xpath
-   //***
-   const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
-   // TODO: need string_view
-   const ossimString desired_tag = xpath.substr(0,delim_pos);
-   
-   //***
-   // Loop over all child nodes for match:
-   //***
-   ossimXmlNode::ChildListType::const_iterator child_iter = theChildNodes.begin();
-   ossimXmlNode::ChildListType::const_iterator child_end  = theChildNodes.end();
-
-
-   // No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
-   if (delim_pos==std::string::npos || delim_pos == xpath.size()-1) 
-   {
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-            //***
-            // This was the final target node, simply append to the result:
-            //***
-            result.push_back(*child_iter);
-      }
-   }
-   else
-   {
-      const ossimString sub_xpath   = xpath.substr(delim_pos+1, std::string::npos);
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-            //***
-            // This match identifies a possible tree to search given the
-            // remaining xpath (sub_xpath). Query this child node to search
-            // its tree for the remaining xpath:
-            //***
-            (*child_iter)->findChildNodes(sub_xpath, result);
-      }
-   }
+	//***
+	// Scan for trivial result (no children owned):
+	//***
+	if (theChildNodes.empty())
+		return;
+
+	if (xpath.empty())
+		return;
+
+	//---
+	// First verify that this is not an absolute path:
+	//---
+	if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_WARN)
+				 << "WARNING: ossimXmlNode::findChildNodes\n"
+				 << "Only relative XPaths can be searched from a node. "
+				 << "Returning null list...\n";
+		}
+		return;
+	}
+
+	//***
+	// Read the desired tag from the relative xpath
+	//***
+	const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
+	// TODO: need string_view
+	const ossimString desired_tag = xpath.substr(0, delim_pos);
+
+	//***
+	// Loop over all child nodes for match:
+	//***
+	ossimXmlNode::ChildListType::const_iterator child_iter = theChildNodes.begin();
+	ossimXmlNode::ChildListType::const_iterator child_end = theChildNodes.end();
+
+	// No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
+	if (delim_pos == std::string::npos || delim_pos == xpath.size() - 1)
+	{
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+				//***
+				// This was the final target node, simply append to the result:
+				//***
+				result.push_back(*child_iter);
+		}
+	}
+	else
+	{
+		const ossimString sub_xpath = xpath.substr(delim_pos + 1, std::string::npos);
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+				//***
+				// This match identifies a possible tree to search given the
+				// remaining xpath (sub_xpath). Query this child node to search
+				// its tree for the remaining xpath:
+				//***
+				(*child_iter)->findChildNodes(sub_xpath, result);
+		}
+	}
 }
 
-const ossimRefPtr<ossimXmlNode>& ossimXmlNode::findFirstNode(const ossimString& xpath)const
+const ossimRefPtr<ossimXmlNode> &ossimXmlNode::findFirstNode(const ossimString &xpath) const
 {
-   if(theChildNodes.size() < 1) return nullNode;
-   if (xpath.empty())
-      return nullNode;
-
-   //
-   // First verify that this is not an absolute path:
-   //
-   if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_WARN)
-            << "WARNING: ossimXmlNode::findFirstNode\n"
-            << "Only relative XPaths can be searched from a node. "
-            << "Returning null list...\n";
-      }
-      return nullNode;
-   }
-
-   //
-   // Read the desired tag from the relative xpath
-   //
-   const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
-   // TODO: need string_view
-   const ossimString desired_tag = xpath.substr(0,delim_pos);
-
-   //
-   // Loop over all child nodes for match:
-   //
-   ossimXmlNode::ChildListType::const_iterator child_iter = theChildNodes.begin();
-   ossimXmlNode::ChildListType::const_iterator child_end  = theChildNodes.end();
-
-   // No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
-   if (delim_pos==std::string::npos || delim_pos == xpath.size()-1) 
-   {
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-            return *child_iter;
-      }
-   }
-   else
-   {
-      const ossimString sub_xpath   = xpath.substr(delim_pos+1, std::string::npos);
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-         {
-            //
-            // This match identifies a possible tree to search given the
-            // remaining xpath (sub_xpath). Query this child node to search
-            // its tree for the remaining xpath:
-            //
-            const ossimRefPtr<ossimXmlNode>& result = (*child_iter)->findFirstNode(sub_xpath);
-            if (result.get())
-            {
-               return result;
-            }
-         }
-      }
-   }
+	if (theChildNodes.size() < 1)
+		return nullNode;
+	if (xpath.empty())
+		return nullNode;
+
+	//
+	// First verify that this is not an absolute path:
+	//
+	if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_WARN)
+				 << "WARNING: ossimXmlNode::findFirstNode\n"
+				 << "Only relative XPaths can be searched from a node. "
+				 << "Returning null list...\n";
+		}
+		return nullNode;
+	}
+
+	//
+	// Read the desired tag from the relative xpath
+	//
+	const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
+	// TODO: need string_view
+	const ossimString desired_tag = xpath.substr(0, delim_pos);
+
+	//
+	// Loop over all child nodes for match:
+	//
+	ossimXmlNode::ChildListType::const_iterator child_iter = theChildNodes.begin();
+	ossimXmlNode::ChildListType::const_iterator child_end = theChildNodes.end();
+
+	// No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
+	if (delim_pos == std::string::npos || delim_pos == xpath.size() - 1)
+	{
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+				return *child_iter;
+		}
+	}
+	else
+	{
+		const ossimString sub_xpath = xpath.substr(delim_pos + 1, std::string::npos);
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+			{
+				//
+				// This match identifies a possible tree to search given the
+				// remaining xpath (sub_xpath). Query this child node to search
+				// its tree for the remaining xpath:
+				//
+				const ossimRefPtr<ossimXmlNode> &result = (*child_iter)->findFirstNode(sub_xpath);
+				if (result.get())
+				{
+					return result;
+				}
+			}
+		}
+	}
+
+	return nullNode;
+}
 
-   return nullNode;
+ossimRefPtr<ossimXmlNode> ossimXmlNode::findFirstNode(const ossimString &xpath)
+{
+	if (theChildNodes.size() < 1)
+		return 0;
+	if (xpath.empty())
+		return 0;
+
+	//
+	// First verify that this is not an absolute path:
+	//
+	if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_WARN)
+				 << "WARNING: ossimXmlNode::findFirstNode\n"
+				 << "Only relative XPaths can be searched from a node. "
+				 << "Returning null list...\n";
+		}
+		return 0;
+	}
+
+	//
+	// Read the desired tag from the relative xpath
+	//
+	const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
+	// TODO: need string_view
+	const ossimString desired_tag = xpath.substr(0, delim_pos);
+
+	ossimRefPtr<ossimXmlNode> result = 0;
+
+	//
+	// Loop over all child nodes for match:
+	//
+	ossimXmlNode::ChildListType::iterator child_iter = theChildNodes.begin();
+	ossimXmlNode::ChildListType::iterator child_end = theChildNodes.end();
+
+	// No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
+	if (delim_pos == std::string::npos || delim_pos == xpath.size() - 1)
+	{
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+				return *child_iter;
+		}
+	}
+	else
+	{
+		const ossimString sub_xpath = xpath.substr(delim_pos + 1, std::string::npos);
+		for (; child_iter != child_end; ++child_iter)
+		{
+			if ((*child_iter)->getTag() == desired_tag)
+			{
+				//
+				// This match identifies a possible tree to search given the
+				// remaining xpath (sub_xpath). Query this child node to search
+				// its tree for the remaining xpath:
+				//
+				ossimRefPtr<ossimXmlNode> result = (*child_iter)->findFirstNode(sub_xpath);
+				if (result.get())
+				{
+					return result;
+				}
+			}
+		}
+	}
+
+	return 0;
 }
 
-ossimRefPtr<ossimXmlNode> ossimXmlNode::findFirstNode(const ossimString& xpath)
+ossimRefPtr<ossimXmlAttribute> ossimXmlNode::findAttribute(const ossimString &name)
 {
-   if(theChildNodes.size() < 1) return 0;
-   if (xpath.empty())
-      return 0;
-
-   //
-   // First verify that this is not an absolute path:
-   //
-   if (xpath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_WARN)
-            << "WARNING: ossimXmlNode::findFirstNode\n"
-            << "Only relative XPaths can be searched from a node. "
-            << "Returning null list...\n";
-      }
-      return 0;
-   }
+	ossim_uint32 idx = 0;
 
-   //
-   // Read the desired tag from the relative xpath
-   //
-   const std::string::size_type delim_pos = xpath.find(XPATH_DELIM);
-   // TODO: need string_view
-   const ossimString desired_tag = xpath.substr(0,delim_pos);
+	for (idx = 0; idx < theAttributes.size(); ++idx)
+	{
+		if (theAttributes[idx]->getName() == name)
+		{
+			return theAttributes[idx];
+		}
+	}
 
-   ossimRefPtr<ossimXmlNode> result = 0;
+	return 0;
+}
 
-   //
-   // Loop over all child nodes for match:
-   //
-   ossimXmlNode::ChildListType::iterator child_iter = theChildNodes.begin();
-   ossimXmlNode::ChildListType::iterator child_end  = theChildNodes.end();
+const ossimRefPtr<ossimXmlAttribute> ossimXmlNode::findAttribute(const ossimString &name) const
+{
+	ossim_uint32 idx = 0;
 
-   // No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
-   if (delim_pos==std::string::npos || delim_pos == xpath.size()-1) 
-   {
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-            return *child_iter;
-      }
-   }
-   else
-   {
-      const ossimString sub_xpath   = xpath.substr(delim_pos+1, std::string::npos);
-      for ( ; child_iter != child_end ; ++ child_iter)
-      {
-         if ((*child_iter)->getTag() == desired_tag)
-         {
-            //
-            // This match identifies a possible tree to search given the
-            // remaining xpath (sub_xpath). Query this child node to search
-            // its tree for the remaining xpath:
-            //
-            ossimRefPtr<ossimXmlNode> result = (*child_iter)->findFirstNode(sub_xpath);
-            if (result.get())
-            {
-               return result;
-            }
-         }
-      }
-   }
+	for (idx = 0; idx < theAttributes.size(); ++idx)
+	{
+		if (theAttributes[idx]->getName() == name)
+		{
+			return theAttributes[idx];
+		}
+	}
 
-   return 0;
+	return 0;
 }
 
-ossimRefPtr<ossimXmlAttribute> ossimXmlNode::findAttribute(const ossimString& name)
+void ossimXmlNode::setTag(const ossimString &tag)
 {
-   ossim_uint32 idx = 0;
-   
-   for(idx = 0; idx < theAttributes.size();++idx)
-   {
-      if(theAttributes[idx]->getName() == name)
-      {
-         return theAttributes[idx];
-      }
-   }
-   
-   return 0;
+	theTag = tag;
 }
 
-const ossimRefPtr<ossimXmlAttribute> ossimXmlNode::findAttribute(const ossimString& name)const
+const ossimXmlNode *ossimXmlNode::getParentNode() const
 {
-   ossim_uint32 idx = 0;
-   
-   for(idx = 0; idx < theAttributes.size();++idx)
-   {
-      if(theAttributes[idx]->getName() == name)
-      {
-         return theAttributes[idx];
-      }
-   }
-   
-   return 0;
+	return theParentNode;
 }
 
-void ossimXmlNode::setTag(const ossimString& tag)
+ossimXmlNode *ossimXmlNode::getParentNode()
 {
-   theTag = tag;
+	return theParentNode;
 }
 
-const ossimXmlNode* ossimXmlNode::getParentNode() const
+const ossimXmlNode::ChildListType &ossimXmlNode::getChildNodes() const
 {
-   return theParentNode;
+	return theChildNodes;
 }
 
-ossimXmlNode* ossimXmlNode::getParentNode()
+ossimXmlNode::ChildListType &ossimXmlNode::getChildNodes()
 {
-   return theParentNode;
+	return theChildNodes;
 }
 
-const ossimXmlNode::ChildListType& ossimXmlNode::getChildNodes() const
+const ossimXmlNode::AttributeListType &ossimXmlNode::getAttributes() const
 {
-   return theChildNodes;
+	return theAttributes;
 }
 
-ossimXmlNode::ChildListType& ossimXmlNode::getChildNodes()
+bool ossimXmlNode::getAttributeValue(ossimString &value, const ossimString &name) const
 {
-   return theChildNodes;
-}
+	ossimRefPtr<ossimXmlAttribute> attribute = findAttribute(name);
 
-const ossimXmlNode::AttributeListType& ossimXmlNode::getAttributes() const
-{
-   return theAttributes;
-}
+	if (attribute.valid())
+	{
+		value = attribute->getValue();
+	}
 
-bool ossimXmlNode::getAttributeValue(ossimString& value, const ossimString& name)const
-{
-   ossimRefPtr<ossimXmlAttribute> attribute = findAttribute(name);
-   
-   if(attribute.valid())
-   {
-      value = attribute->getValue();
-   }
-   
-   return attribute.valid();
+	return attribute.valid();
 }
 
-bool ossimXmlNode::getChildTextValue(ossimString& value,
-                                     const ossimString& relPath)const
+bool ossimXmlNode::getChildTextValue(ossimString &value,
+												 const ossimString &relPath) const
 {
-   ossimRefPtr<ossimXmlNode> node = findFirstNode(relPath);
-   if(node.valid())
-   {
-      value = node->getText();
-   }
-   
-   return node.valid();
-}
+	ossimRefPtr<ossimXmlNode> node = findFirstNode(relPath);
+	if (node.valid())
+	{
+		value = node->getText();
+	}
 
+	return node.valid();
+}
 
-void ossimXmlNode::setText(const ossimString& text)
+void ossimXmlNode::setText(const ossimString &text)
 {
-   theText = text;
+	theText = text;
 }
 
-bool ossimXmlNode::cdataFlag()const
+bool ossimXmlNode::cdataFlag() const
 {
-   return theCDataFlag;
+	return theCDataFlag;
 }
 
 void ossimXmlNode::setCDataFlag(bool value)
 {
-   theCDataFlag = value;
+	theCDataFlag = value;
 }
 
-ostream& operator << (ostream& os, const ossimXmlNode& xml_node)
+ostream &operator<<(ostream &os, const ossimXmlNode &xml_node)
 {
-   return operator <<(os, &xml_node);
+	return operator<<(os, &xml_node);
 }
 
 //**************************************************************************
 //  FRIEND OPERATOR
 //**************************************************************************
-ostream& operator << (ostream& os, const ossimXmlNode* xml_node) 
+ostream &operator<<(ostream &os, const ossimXmlNode *xml_node)
 {
-   //
-   // Determine the indentation level:
-   //
-   ossimString indent ("");
-   const ossimXmlNode* parent = xml_node->theParentNode;
-   while (parent)
-   {
-      indent += "   ";
-      parent = parent->theParentNode;
-   }
-   
-   //
-   // Dump the tag opening:
-   //
-   os << "\n" << indent << "<" << xml_node->theTag;
-   
-   //
-   // Dump any attributes:
-   //
-   if (xml_node->theAttributes.size())
-   {
-      ossimXmlNode::AttributeListType::const_iterator attr =
-      xml_node->theAttributes.begin();
-      while (attr != xml_node->theAttributes.end())
-      {
-         os << attr->get();
-         attr++;
-      }
-   }
-   
-   if((xml_node->theChildNodes.size() == 0)&&
-      (xml_node->theText == ""))
-   {
-      os << "/>";
-   }
-   else
-   {
-      os << ">";
-      
-      if(xml_node->cdataFlag())
-      {
-         os << "<![CDATA[" <<xml_node->theText <<  "]]>";
-      }
-      else
-      {
-         //
-         // Dump any text:
-         //
-         os << xml_node->theText;
-      }
-      //
-      // Dump any child nodes:
-      //
-      if (xml_node->theChildNodes.size())
-      {
-         ossimXmlNode::ChildListType::const_iterator nodes = xml_node->theChildNodes.begin();
-         while (nodes != xml_node->theChildNodes.end())
-         {
-            os << (*nodes).get();
-            nodes++;
-         }
-         os << "\n" << indent;
-      }
-      
-      //
-      // Dump the tag closing:
-      // 
-      os << "</" << xml_node->theTag << ">";
-   }
-   
-   return os;
+	//
+	// Determine the indentation level:
+	//
+	ossimString indent("");
+	const ossimXmlNode *parent = xml_node->theParentNode;
+	while (parent)
+	{
+		indent += "   ";
+		parent = parent->theParentNode;
+	}
+
+	//
+	// Dump the tag opening:
+	//
+	os << "\n"
+		<< indent << "<" << xml_node->theTag;
+
+	//
+	// Dump any attributes:
+	//
+	if (xml_node->theAttributes.size())
+	{
+		ossimXmlNode::AttributeListType::const_iterator attr =
+			 xml_node->theAttributes.begin();
+		while (attr != xml_node->theAttributes.end())
+		{
+			os << attr->get();
+			attr++;
+		}
+	}
+
+	if ((xml_node->theChildNodes.size() == 0) &&
+		 (xml_node->theText == ""))
+	{
+		os << "/>";
+	}
+	else
+	{
+		os << ">";
+
+		if (xml_node->cdataFlag())
+		{
+			os << "<![CDATA[" << xml_node->theText << "]]>";
+		}
+		else
+		{
+			//
+			// Dump any text:
+			//
+			os << xml_node->theText;
+		}
+		//
+		// Dump any child nodes:
+		//
+		if (xml_node->theChildNodes.size())
+		{
+			ossimXmlNode::ChildListType::const_iterator nodes = xml_node->theChildNodes.begin();
+			while (nodes != xml_node->theChildNodes.end())
+			{
+				os << (*nodes).get();
+				nodes++;
+			}
+			os << "\n"
+				<< indent;
+		}
+
+		//
+		// Dump the tag closing:
+		//
+		os << "</" << xml_node->theTag << ">";
+	}
+
+	return os;
 }
 
 void ossimXmlNode::addAttribute(ossimRefPtr<ossimXmlAttribute> attribute)
 {
-   theAttributes.push_back(attribute.get());
+	theAttributes.push_back(attribute.get());
 }
 
-void ossimXmlNode::addAttribute(const ossimString& name,
-                                const ossimString& value)
+void ossimXmlNode::addAttribute(const ossimString &name,
+										  const ossimString &value)
 {
-   theAttributes.push_back(new ossimXmlAttribute(name, value));
+	theAttributes.push_back(new ossimXmlAttribute(name, value));
 }
 
-bool  ossimXmlNode::setAttribute(const ossimString& name,
-                                 const ossimString& value,
-                                 bool addIfNotPresentFlag)
+bool ossimXmlNode::setAttribute(const ossimString &name,
+										  const ossimString &value,
+										  bool addIfNotPresentFlag)
 {
-   bool result = false;
-   ossimRefPtr<ossimXmlAttribute> attribute = findAttribute(name);
-   if(attribute.valid())
-   {
-      attribute->setValue(value);
-      result = true;
-   }
-   else
-   {
-      if(addIfNotPresentFlag)
-      {
-         addAttribute(name, value);
-         result = true;
-      }
-   }
-   
-   return result;
+	bool result = false;
+	ossimRefPtr<ossimXmlAttribute> attribute = findAttribute(name);
+	if (attribute.valid())
+	{
+		attribute->setValue(value);
+		result = true;
+	}
+	else
+	{
+		if (addIfNotPresentFlag)
+		{
+			addAttribute(name, value);
+			result = true;
+		}
+	}
+
+	return result;
 }
 
-ossimRefPtr<ossimXmlNode> ossimXmlNode::addNode(const ossimString& relPath,
-                                                const ossimString& text)
+ossimRefPtr<ossimXmlNode> ossimXmlNode::addNode(const ossimString &relPath,
+																const ossimString &text)
 {
-   if (relPath.empty())
-      return 0;
-   
-   //
-   // First verify that this is not an absolute path:
-   //
-   if (relPath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_WARN) << "WARNING: ossimXmlNode::addNode\n"
-         << "Only relative XPaths can be searched from a node. "
-         << "Returning null list...\n";
-      }
-      return 0;
-   }
-   
-   //
-   // Read the desired tag from the relative xpath
-   //
-   const std::string::size_type delim_pos = relPath.find(XPATH_DELIM);
-   const ossimString desiredTag = relPath.substr(0,delim_pos);
-   
-   ossimRefPtr<ossimXmlNode> node = findFirstNode(desiredTag);
-   
-   if(!node.valid())
-   {
-      // No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
-      if (delim_pos==std::string::npos || delim_pos == relPath.size()-1) 
-      {
-         node = addChildNode(desiredTag, text);
-      }
-      else
-      {
-         node = addChildNode(desiredTag, "");
-      }
-   }
-   if (delim_pos != std::string::npos && delim_pos != relPath.size()-1) // XPATH_DELIM character found!
-   {
-      const ossimString subPath   = relPath.substr(delim_pos+1, std::string::npos);
-      return node->addNode(subPath, text);
-   }
-   
-   return node;
+	if (relPath.empty())
+		return 0;
+
+	//
+	// First verify that this is not an absolute path:
+	//
+	if (relPath[static_cast<std::string::size_type>(0)] == XPATH_DELIM)
+	{
+		if (traceDebug())
+		{
+			ossimNotify(ossimNotifyLevel_WARN) << "WARNING: ossimXmlNode::addNode\n"
+														  << "Only relative XPaths can be searched from a node. "
+														  << "Returning null list...\n";
+		}
+		return 0;
+	}
+
+	//
+	// Read the desired tag from the relative xpath
+	//
+	const std::string::size_type delim_pos = relPath.find(XPATH_DELIM);
+	const ossimString desiredTag = relPath.substr(0, delim_pos);
+
+	ossimRefPtr<ossimXmlNode> node = findFirstNode(desiredTag);
+
+	if (!node.valid())
+	{
+		// No XPATH_DELIM character found, or XPATH_DELIM at the end of xpath
+		if (delim_pos == std::string::npos || delim_pos == relPath.size() - 1)
+		{
+			node = addChildNode(desiredTag, text);
+		}
+		else
+		{
+			node = addChildNode(desiredTag, "");
+		}
+	}
+	if (delim_pos != std::string::npos && delim_pos != relPath.size() - 1) // XPATH_DELIM character found!
+	{
+		const ossimString subPath = relPath.substr(delim_pos + 1, std::string::npos);
+		return node->addNode(subPath, text);
+	}
+
+	return node;
 }
 
-ossimRefPtr<ossimXmlNode> ossimXmlNode::addOrSetNode(const ossimString& relPath,
-                                                     const ossimString& text)
+ossimRefPtr<ossimXmlNode> ossimXmlNode::addOrSetNode(const ossimString &relPath,
+																	  const ossimString &text)
 {
-   ossimRefPtr<ossimXmlNode> result = addNode(relPath, text);
-   
-   result->setText(text);
-   
-   return result;
+	ossimRefPtr<ossimXmlNode> result = addNode(relPath, text);
+
+	result->setText(text);
+
+	return result;
 }
 
 void ossimXmlNode::addChildNode(ossimRefPtr<ossimXmlNode> node)
 {
-   if(node->theParentNode)
-   {
-      node->theParentNode->removeChild(node);
-   }
-   node->theParentNode = this;
-   theChildNodes.push_back(node.get());
+	if (node->theParentNode)
+	{
+		node->theParentNode->removeChild(node);
+	}
+	node->theParentNode = this;
+	theChildNodes.push_back(node.get());
 }
 
-ossimRefPtr<ossimXmlNode> ossimXmlNode::addChildNode(const ossimString& tagName,
-                                                     const ossimString& text)
+ossimRefPtr<ossimXmlNode> ossimXmlNode::addChildNode(const ossimString &tagName,
+																	  const ossimString &text)
 {
-   ossimRefPtr<ossimXmlNode> node = new ossimXmlNode();
-   node->setParent(this);
-   node->theTag = tagName;
-   node->theText = text;
-   theChildNodes.push_back(node);
-   
-   return node;
+	ossimRefPtr<ossimXmlNode> node = new ossimXmlNode();
+	node->setParent(this);
+	node->theTag = tagName;
+	node->theText = text;
+	theChildNodes.push_back(node);
+
+	return node;
 }
 
 ossimRefPtr<ossimXmlNode> ossimXmlNode::removeChild(ossimRefPtr<ossimXmlNode> node)
 {
-   ossimXmlNode::ChildListType::iterator iter = theChildNodes.begin();
-   while(iter != theChildNodes.end())
-   {
-      
-      if(node == iter->get())
-      {
-         ossimRefPtr<ossimXmlNode> temp = *iter;
-         
-         theChildNodes.erase(iter);
-         
-         return temp;
-      }
-      ++iter;
-   }
-   
-   return 0;
+	ossimXmlNode::ChildListType::iterator iter = theChildNodes.begin();
+	while (iter != theChildNodes.end())
+	{
+
+		if (node == iter->get())
+		{
+			ossimRefPtr<ossimXmlNode> temp = *iter;
+
+			theChildNodes.erase(iter);
+
+			return temp;
+		}
+		++iter;
+	}
+
+	return 0;
 }
 
-ossimRefPtr<ossimXmlNode> ossimXmlNode::removeChild(const ossimString& tag)
+ossimRefPtr<ossimXmlNode> ossimXmlNode::removeChild(const ossimString &tag)
 {
-   ossimXmlNode::ChildListType::iterator iter = theChildNodes.begin();
-   while(iter != theChildNodes.end())
-   {
-      if(tag == iter->get()->theTag)
-      {
-         ossimRefPtr<ossimXmlNode> temp = *iter;
-         
-         theChildNodes.erase(iter);
-         
-         return temp;
-      }
-      ++iter;
-   }
-   
-   return 0;
+	ossimXmlNode::ChildListType::iterator iter = theChildNodes.begin();
+	while (iter != theChildNodes.end())
+	{
+		if (tag == iter->get()->theTag)
+		{
+			ossimRefPtr<ossimXmlNode> temp = *iter;
+
+			theChildNodes.erase(iter);
+
+			return temp;
+		}
+		++iter;
+	}
+
+	return 0;
 }
-void ossimXmlNode::addChildren(ossimXmlNode::ChildListType& children)
+void ossimXmlNode::addChildren(ossimXmlNode::ChildListType &children)
 {
-   ossim_uint32 idx;
-   for(idx = 0; idx < children.size(); ++idx)
-   {
-      addChildNode(children[idx].get());
-   }
+	ossim_uint32 idx;
+	for (idx = 0; idx < children.size(); ++idx)
+	{
+		addChildNode(children[idx].get());
+	}
 }
 
-void ossimXmlNode::setChildren(ossimXmlNode::ChildListType& children)
+void ossimXmlNode::setChildren(ossimXmlNode::ChildListType &children)
 {
-   clearChildren();
-   addChildren(children);
+	clearChildren();
+	addChildren(children);
 }
 
-void ossimXmlNode::addAttributes(ossimXmlNode::AttributeListType& children)
+void ossimXmlNode::addAttributes(ossimXmlNode::AttributeListType &children)
 {
-   ossim_uint32 idx;
-   
-   for(idx = 0; idx < children.size(); ++idx)
-   {
-      addAttribute(children[idx].get());
-   }
+	ossim_uint32 idx;
+
+	for (idx = 0; idx < children.size(); ++idx)
+	{
+		addAttribute(children[idx].get());
+	}
 }
 
-void ossimXmlNode::setAttributes(ossimXmlNode::AttributeListType& children)
+void ossimXmlNode::setAttributes(ossimXmlNode::AttributeListType &children)
 {
-   clearAttributes();
-   addAttributes(children);
+	clearAttributes();
+	addAttributes(children);
 }
 
 void ossimXmlNode::clear()
 {
-   theChildNodes.clear();
-   theAttributes.clear();
-   theTag="";
-   theText="";
-   theCDataFlag=false;
+	theChildNodes.clear();
+	theAttributes.clear();
+	theTag = "";
+	theText = "";
+	theCDataFlag = false;
 }
 
 void ossimXmlNode::clearChildren()
 {
-   theChildNodes.clear();
+	theChildNodes.clear();
 }
 
 void ossimXmlNode::clearAttributes()
 {
-   theAttributes.clear();
+	theAttributes.clear();
 }
 
-void ossimXmlNode::toKwl(ossimKeywordlist& kwl,
-                         const ossimString& prefix)const
+void ossimXmlNode::toKwl(ossimKeywordlist &kwl,
+								 const ossimString &prefix,
+								 bool includeTag) const
 {
-   ossimString name = getTag();
-   ossimString value = getText();
-   
-   ossimString copyPrefix = prefix;
-   
-   if(name != "")
-   {
-      copyPrefix += (name+".");
-   }
-   if(theChildNodes.size() < 1)
-   {
-      kwl.add(prefix+name,
-              value,
-              true);
-   }
-
-   ossimString attributePrefix = copyPrefix + "@";
-   ossim_uint32 attributeIdx = 0;
-   for(attributeIdx = 0; attributeIdx < theAttributes.size(); ++attributeIdx)
-   {
-      kwl.add(attributePrefix+theAttributes[attributeIdx]->getName(),
-              theAttributes[attributeIdx]->getValue(), 
-              true);
-   }
-
-   ossim_uint32 idx = 0;
-   for(idx = 0; idx < theChildNodes.size();++idx)
-   {
-      theChildNodes[idx]->toKwl(kwl,
-                                copyPrefix);
-   }
+	class ChildNodeMapInfo
+	{
+	 public:
+		ChildNodeMapInfo(ossim_int32 count = 1, 
+		               	ossim_int32 idx = 0) : 
+								m_count(count),
+								m_idx(idx) {}
+		ossim_int32 m_count;
+		ossim_int32 m_idx;
+	};
+	ossimString name = getTag();
+	ossimString value = getText();
+
+	ossimString copyPrefix = prefix;
+
+	if (name != "")
+	{
+		if (includeTag)
+		{
+			copyPrefix += (name + ".");
+		}
+	}
+	if (theChildNodes.size() < 1)
+	{
+		if (includeTag)
+		{
+			kwl.add(prefix + name,
+					  value,
+					  true);
+	   }
+		else
+		{
+			kwl.add(prefix,
+					  value,
+					  true);
+		}
+	}
+
+	ossimString attributePrefix = copyPrefix + "@";
+	ossim_uint32 attributeIdx = 0;
+	for (attributeIdx = 0; attributeIdx < theAttributes.size(); ++attributeIdx)
+	{
+		kwl.add(attributePrefix + theAttributes[attributeIdx]->getName(),
+				  theAttributes[attributeIdx]->getValue(),
+				  true);
+	}
+	std::map<ossimString, std::shared_ptr<ChildNodeMapInfo> > mapInfo;
+	for (auto childNode : theChildNodes)
+	{
+		ossimString tagName = childNode->getTag();
+		if (mapInfo.find(childNode->getTag()) == mapInfo.end())
+		{
+			mapInfo[childNode->getTag()] = std::make_shared<ChildNodeMapInfo>();
+		}
+		else
+		{
+			mapInfo[childNode->getTag()]->m_count++;
+		}
+	}
+	ossim_uint32 idx = 0;
+	for (idx = 0; idx < theChildNodes.size(); ++idx)
+	{
+		ossimString tagName = theChildNodes[idx]->getTag();
+		std::shared_ptr<ChildNodeMapInfo> mapInfoChild = mapInfo[tagName];
+		if (mapInfoChild->m_count > 1)
+		{
+			ossimString newPrefix = (name + "." + tagName + ossimString::toString(mapInfoChild->m_idx));
+			mapInfoChild->m_idx++;
+			theChildNodes[idx]->toKwl(kwl,
+											  newPrefix,
+											  false);
+		}
+		else
+		{
+			theChildNodes[idx]->toKwl(kwl,
+											  copyPrefix,
+											  true);
+		}
+	}
 }
 
-bool ossimXmlNode::readTag(std::istream& in,
-                           ossimString& tag)
+bool ossimXmlNode::readTag(std::istream &in,
+									ossimString &tag)
 {
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::readTag: entered ......\n";
-   }
-   xmlskipws(in);
-   
-   tag.clear();
-   int c = in.peek();
-   
-   // bool validTag = false;
-   //    while(!validTag)
-   {
-      while( (c != ' ')&&
-            (c != '\n')&&
-            (c != '\t')&&
-            (c != '\r')&&
-            (c != '<')&&
-            (c != '>')&&
-            (c != '/')&&
-            (!in.fail()))
-      {
-         tag += (char)c;
-         in.ignore(1);
-         c = in.peek();
-         if(tag == "!--") // ignore comment tags
-         {
-            tag = "--";
-            break;
-         }
-      }
-   }
-   
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::readTag: leaving ......\n";
-   }
-  
-   return (!tag.empty())&&(!in.fail());
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::readTag: entered ......\n";
+	}
+	xmlskipws(in);
+
+	tag.clear();
+	int c = in.peek();
+
+	// bool validTag = false;
+	//    while(!validTag)
+	{
+		while ((c != ' ') &&
+				 (c != '\n') &&
+				 (c != '\t') &&
+				 (c != '\r') &&
+				 (c != '<') &&
+				 (c != '>') &&
+				 (c != '/') &&
+				 (!in.fail()))
+		{
+			tag += (char)c;
+			in.ignore(1);
+			c = in.peek();
+			if (tag == "!--") // ignore comment tags
+			{
+				tag = "--";
+				break;
+			}
+		}
+	}
+
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::readTag: leaving ......\n";
+	}
+
+	return (!tag.empty()) && (!in.fail());
 }
 
-bool ossimXmlNode::readCDataContent(std::istream& in)
+bool ossimXmlNode::readCDataContent(std::istream &in)
 {
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::readCDataContent: entered ...\n";
-   }   
-   
-   // Ignore up to "]]>"
-   
-   bool result = false;
-
-   char c;
-
-   while(!in.fail())
-   {
-      c = in.get();
-      if ( c != ']' )
-      {
-         theText += c;
-      }
-      else // at "]"
-      {
-         c = in.get();
-         if( c == ']' ) // at "]]"
-         {
-            c = in.get();
-            if( c == '>' )
-            {
-               //in >> xmlskipws;
-               result = true;
-               break;
-            }
-         }
-      }
-   }
-
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "theText: " << theText
-         << "\nexit status: " << (result?"true":"false")
-         << "\nossimXmlNode::readCDataContent: leaving ...\n";
-   }
-   
-   return result;
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::readCDataContent: entered ...\n";
+	}
+
+	// Ignore up to "]]>"
+
+	bool result = false;
+
+	char c;
+
+	while (!in.fail())
+	{
+		c = in.get();
+		if (c != ']')
+		{
+			theText += c;
+		}
+		else // at "]"
+		{
+			c = in.get();
+			if (c == ']') // at "]]"
+			{
+				c = in.get();
+				if (c == '>')
+				{
+					//in >> xmlskipws;
+					result = true;
+					break;
+				}
+			}
+		}
+	}
+
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "theText: " << theText
+			 << "\nexit status: " << (result ? "true" : "false")
+			 << "\nossimXmlNode::readCDataContent: leaving ...\n";
+	}
+
+	return result;
 }
 
 #if 0
@@ -1236,167 +1300,169 @@ bool ossimXmlNode::readTextContent(std::istream& in)
 }
 #endif
 
-bool ossimXmlNode::readTextContent(std::istream& in)
+bool ossimXmlNode::readTextContent(std::istream &in)
 {
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimXmlNode::readTextContent: entered ...\n";
-   }
-   
-   //---
-   // Parse the text string.  Do it with no peeks, ignores, or putbacks as
-   // those seem to have issues on Windows (vs9).
-   //---
-   bool result = false;
-
-   theText = "";
-   theCDataFlag = false;
-   
-   xmlskipws(in);
-
-   if ( !in.fail() )
-   {
-      std::streampos initialPos = in.tellg();
-
-      char c = in.get();
-      
-      if ( c != '<' )
-      {
-         do // Get the text up to the next '<'.
-         {
-            theText += c;
-            c = in.get();
-         } while ( (c != '<') && !in.fail() );
-         
-         in.unget(); // Put '<' back.
-         result = !in.fail();
-      }
-      else // At "<" see if comment
-      {
-         c = in.get();
-
-         if ( c != '!' )
-         {
-            in.seekg(initialPos);
-            result = !in.fail();
-         }
-         else // at "<!"
-         {
-            c = in.get();
-            if ( c == '-' )
-            {
-               // Comment section: <!-- some comment -->
-               c = in.get();
-               if ( c == '-' ) // at "<!--"
-               {
-                  // Strip comment
-                  while( !in.fail() ) // continue until we see a --> pattern
-                  {
-                     c = in.get();
-                     if(c == '-')
-                     {
-                        c = in.get();
-                        if(c == '-')
-                        {
-                           c = in.get();
-                           if(c == '>')
-                           {
-                              result = !in.fail();
-                              break;
-                           }
-                        }
-                     }
-                  }
-               }
-            }
-            else if ( c == '[' ) // at "<!["
-            {
-               // CDATA section: <![CDATA[something-here]]>
-               c = in.get();
-               if ( c == 'C') // at "<![C:"
-               {
-                  c = in.get();
-                  if ( c == 'D' )// at "<![CD"
-                  {
-                     c = in.get();
-                     if ( c == 'A' ) // at "<![CDA"
-                     {
-                        c = in.get();
-                        if ( c == 'T' ) // at "<![CDAT"
-                        {
-                           c = in.get();
-                           if ( c == 'A' ) // at "<![CDATA"
-                           {
-                              c = in.get();
-                              if ( c == '[' ) // at "<!CDATA["
-                              {
-                                 if (readCDataContent(in))
-                                 {
-                                    theCDataFlag = true;
-                                    result = true;
-                                 }
-                              }
-                           }
-                        }
-                     }
-                  }
-               }
-            }
-         }
-      }
-   }
-
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "theText: " << theText
-         << "\ntheCDataFlag: " << (theCDataFlag?"true":"false")
-         << "\nexit status: " << (result?"true":"false")
-         << "\nossimXmlNode::readTextContent: leaving ...\n";
-   }
-   
-   return result;
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "ossimXmlNode::readTextContent: entered ...\n";
+	}
+
+	//---
+	// Parse the text string.  Do it with no peeks, ignores, or putbacks as
+	// those seem to have issues on Windows (vs9).
+	//---
+	bool result = false;
+
+	theText = "";
+	theCDataFlag = false;
+
+	xmlskipws(in);
+
+	if (!in.fail())
+	{
+		std::streampos initialPos = in.tellg();
+
+		char c = in.get();
+
+		if (c != '<')
+		{
+			do // Get the text up to the next '<'.
+			{
+				theText += c;
+				c = in.get();
+			} while ((c != '<') && !in.fail());
+
+			in.unget(); // Put '<' back.
+			result = !in.fail();
+		}
+		else // At "<" see if comment
+		{
+			c = in.get();
+
+			if (c != '!')
+			{
+				in.seekg(initialPos);
+				result = !in.fail();
+			}
+			else // at "<!"
+			{
+				c = in.get();
+				if (c == '-')
+				{
+					// Comment section: <!-- some comment -->
+					c = in.get();
+					if (c == '-') // at "<!--"
+					{
+						// Strip comment
+						while (!in.fail()) // continue until we see a --> pattern
+						{
+							c = in.get();
+							if (c == '-')
+							{
+								c = in.get();
+								if (c == '-')
+								{
+									c = in.get();
+									if (c == '>')
+									{
+										result = !in.fail();
+										break;
+									}
+								}
+							}
+						}
+					}
+				}
+				else if (c == '[') // at "<!["
+				{
+					// CDATA section: <![CDATA[something-here]]>
+					c = in.get();
+					if (c == 'C') // at "<![C:"
+					{
+						c = in.get();
+						if (c == 'D') // at "<![CD"
+						{
+							c = in.get();
+							if (c == 'A') // at "<![CDA"
+							{
+								c = in.get();
+								if (c == 'T') // at "<![CDAT"
+								{
+									c = in.get();
+									if (c == 'A') // at "<![CDATA"
+									{
+										c = in.get();
+										if (c == '[') // at "<!CDATA["
+										{
+											if (readCDataContent(in))
+											{
+												theCDataFlag = true;
+												result = true;
+											}
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	if (traceDebug())
+	{
+		ossimNotify(ossimNotifyLevel_DEBUG)
+			 << "theText: " << theText
+			 << "\ntheCDataFlag: " << (theCDataFlag ? "true" : "false")
+			 << "\nexit status: " << (result ? "true" : "false")
+			 << "\nossimXmlNode::readTextContent: leaving ...\n";
+	}
+
+	return result;
 }
 
-bool ossimXmlNode::readEndTag(std::istream& in,
-                              ossimString& endTag)
+bool ossimXmlNode::readEndTag(std::istream &in,
+										ossimString &endTag)
 {
-   bool result = false;
-   char c = in.peek();
-   endTag = "";
-   
-   if(theTag == "--")// this is a comment tag
-   {
-      skipCommentTag(in);
-      endTag = "--";
-      return (!in.fail());
-   }
-   // check end tag
-   //
-   if(c == '/')
-   {
-      in.ignore();
-      readTag(in, endTag);
-      if(in.fail()) return false;
-      xmlskipws(in);
-      c = in.peek();
-      result = true;
-   }
-   else
-   {
-      return false;
-   }
-   if(c != '>')
-   {
-      setErrorStatus();
-      return false;
-   }
-   else
-   {
-      in.ignore(1);
-   }
-   if(in.fail()) result = false;
-   
-   return result;
+	bool result = false;
+	char c = in.peek();
+	endTag = "";
+
+	if (theTag == "--") // this is a comment tag
+	{
+		skipCommentTag(in);
+		endTag = "--";
+		return (!in.fail());
+	}
+	// check end tag
+	//
+	if (c == '/')
+	{
+		in.ignore();
+		readTag(in, endTag);
+		if (in.fail())
+			return false;
+		xmlskipws(in);
+		c = in.peek();
+		result = true;
+	}
+	else
+	{
+		return false;
+	}
+	if (c != '>')
+	{
+		setErrorStatus();
+		return false;
+	}
+	else
+	{
+		in.ignore(1);
+	}
+	if (in.fail())
+		result = false;
+
+	return result;
 }


=====================================
src/imaging/ossimSICDToDetectedImage.cpp
=====================================
@@ -160,9 +160,6 @@ void ossimSICDToDetectedImage::allocate()
    if( isSourceEnabled() && theInputConnection )
    {
       theTile = ossimImageDataFactory::instance()->create(this, this);
-      if(theTile.valid())
-      {
-      }
 	   if(theTile.valid())
       {
          theTile->initialize();


=====================================
src/imaging/ossimTiffTileSource.cpp
=====================================
The diff for this file was not included because it is too large.

=====================================
src/support_data/TiffHandlerState.cpp
=====================================
@@ -162,12 +162,12 @@ void ossim::TiffHandlerState::loadDefaults(TIFF* tiffPtr)
     }
   }
   TIFFSetDirectory(tiffPtr, currentDirectory);
-
 }
 
 void ossim::TiffHandlerState::loadDefaults(std::shared_ptr<ossim::istream> &str,
                                          const std::string &connectionString)
 {
+  setConnectionString(connectionString);
   ossim_int64 offset = str->tellg();
   ossimTiffInfo info;
   std::ostringstream out;
@@ -675,6 +675,19 @@ void ossim::TiffHandlerState::loadGeotiffTags(TIFF* tiffPtr,
   GTIFFree(gtif);
 }
 
+bool ossim::TiffHandlerState::isDigitalGlobe() const
+{
+  ossimString value;
+  bool result = false;
+
+  if(getValue(value, "tiff.is_digital_globe"))
+  {
+    result = value.toBool();
+  }
+
+  return result;
+}
+
 bool ossim::TiffHandlerState::isReduced(ossim_uint32 directory)const
 {
   return getSubFileType(directory)&FILETYPE_REDUCEDIMAGE;
@@ -749,11 +762,6 @@ ossim_int32 ossim::TiffHandlerState::getLinearUnits(ossim_int32 directory)const
   return getInt32Value("linear_units", directory);
 }
 
-ossim_int32 ossim::TiffHandlerState::getRasterType(ossim_int32 directory)const
-{
-  return getInt32Value("raster_type", directory);
-}
-
 ossim_int32 ossim::TiffHandlerState::getDatumCode(ossim_int32 directory)const
 {
   return getInt32Value("datum_code", directory);
@@ -1035,6 +1043,20 @@ ossim_int32 ossim::TiffHandlerState::getPlanarConfig(ossim_int32 directory) cons
   return result;
 }
 
+ossim_int32 ossim::TiffHandlerState::getRasterType(ossim_int32 directory) const
+{
+  ossimString tempStr;
+  ossimPixelType result = OSSIM_PIXEL_IS_POINT;
+  if (getValue(tempStr, directory, "raster_type"))
+  {
+    if (tempStr.contains("area"))
+    {
+      result = OSSIM_PIXEL_IS_AREA;
+    }
+  }
+  return result;
+}
+
 ossim_int32 ossim::TiffHandlerState::getPhotoInterpretation(ossim_int32 directory) const {
 
   ossimString tempStr;
@@ -1195,7 +1217,19 @@ bool ossim::TiffHandlerState::getCitation(ossimString &citation, ossim_int32 dir
 {
   bool result = true;
 
-  if(!getValue(citation, directory, "citation"))
+  if (!getValue(citation, directory, "citation"))
+  {
+    result = false;
+  }
+
+  return result;
+}
+
+bool ossim::TiffHandlerState::getCopyright(ossimString &copyright, ossim_int32 directory) const
+{
+  bool result = true;
+
+  if (!getValue(copyright, directory, "copyright"))
   {
     result = false;
   }


=====================================
src/support_data/ossimGeoTiff.cpp
=====================================
@@ -1000,6 +1000,7 @@ bool ossimGeoTiff::readTags(std::shared_ptr<ossim::TiffHandlerState> state, ossi
    theDatumCode = state->getDatumCode(entryIdx);
    theAngularUnits = state->getAngularUnits(entryIdx);
    theLinearUnitsCode = state->getLinearUnits(entryIdx);
+   theRasterType = state->getRasterType(entryIdx);
    theGeoKeysPresentFlag = true;
    if (theAngularUnits == ANGULAR_DMS_HEMISPHERE || theAngularUnits == 9122)
    {
@@ -1134,6 +1135,14 @@ bool ossimGeoTiff::readTags(std::shared_ptr<ossim::TiffHandlerState> state, ossi
    setOssimProjectionName(state, entryIdx);
    setOssimDatumName(state, entryIdx);
 
+   if(theModelType == MODEL_TYPE_GEOGRAPHIC)
+   {
+      if (theAngularUnits == 0) 
+      {
+         theAngularUnits = ANGULAR_DEGREE;
+      }
+   }
+
    return true;
 }
 
@@ -1709,7 +1718,7 @@ bool ossimGeoTiff::addImageGeometry(ossimKeywordlist &kwl, const char *prefix) c
       {
          ossimNotify(ossimNotifyLevel_WARN)
              << "WARNING ossimGeoTiff::addImageGeometry:"
-             << "\nNot coded yet for unit type:  "
+             << "\nNot coded yet for angular unit type:  "
              << theAngularUnits << endl;
          return false;
       }


=====================================
src/support_data/ossimNitfRegisteredDesFactory.cpp
=====================================
@@ -14,10 +14,12 @@
 #include <ossim/support_data/ossimNitfRegisteredDesFactory.h>
 
 #include <ossim/support_data/ossimNitfXmlDataContentDes.h>
+#include <ossim/support_data/ossimNitfSicdXmlDes.h>
 
 RTTI_DEF1(ossimNitfRegisteredDesFactory, "ossimNitfRegisteredDesFactory", ossimNitfDesFactory);
 
 static const char XML_DATA_CONTENT_DES[]                = "XML_DATA_CONTENT";
+static const char SICD_XML[]                            = "SICD_XML";
 
 ossimNitfRegisteredDesFactory::ossimNitfRegisteredDesFactory()
 {
@@ -42,5 +44,9 @@ ossimRefPtr<ossimNitfRegisteredDes> ossimNitfRegisteredDesFactory::create(
    {
       return new ossimNitfXmlDataContentDes;
    }
+   else if(desName == SICD_XML)
+   {
+      return new ossimNitfSicdXmlDes;
+   }
    return NULL;
 }


=====================================
src/support_data/ossimNitfSicdXmlDes.cpp
=====================================
@@ -0,0 +1,73 @@
+#include <ossim/support_data/ossimNitfSicdXmlDes.h>
+#include <ossim/base/ossimPreferences.h>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+
+ossimNitfSicdXmlDes::ossimNitfSicdXmlDes()
+   : ossimNitfRegisteredDes(std::string("SICD_XML"), 0),
+     m_xmlString()
+{
+   clearFields();
+}
+void ossimNitfSicdXmlDes::parseStream(std::istream& in)
+{
+  clearFields();
+
+  if(getSizeInBytes())
+  {
+    char* c = new char[getSizeInBytes()+1];
+    in.read(c, getSizeInBytes());
+    c[getSizeInBytes()] = '\0';
+    m_xmlString.string().resize(getSizeInBytes());
+    m_xmlString = c;
+    m_xmlDocument = new ossimXmlDocument;;
+    std::istringstream xmlStringStream(m_xmlString.string());
+    m_xmlDocument->read(xmlStringStream);
+    delete [] c;
+    c = 0;
+  }
+}
+
+void ossimNitfSicdXmlDes::writeStream(std::ostream& out)
+{
+}
+
+std::ostream& ossimNitfSicdXmlDes::print(std::ostream& out,
+                                        const std::string& prefix) const
+{
+   bool typeinfo = ossimString(ossimPreferences::instance()->findPreference("kwl_type_info")).toBool();
+
+   std::string pfx = prefix;
+   pfx += getDesName() + ".";
+   
+   out << setiosflags(ios::left)
+        // Quick hack to print on one line, this will leave extra spaces in CDATA sections
+       << pfx << std::setw(24) << "XML: \"\"\"" << m_xmlString << "\"\"\"\n";
+   return out;
+}
+
+void ossimNitfSicdXmlDes::clearFields()
+{
+}
+
+bool ossimNitfSicdXmlDes::loadState(const ossimKeywordlist& kwl, const char* prefix)
+{
+   return true;
+}
+
+bool ossimNitfSicdXmlDes::loadValueFromXml(const ossimRefPtr<ossimXmlDocument> xml, const ossimString& xpath, ossimString& target) const
+{
+  bool result = false;
+  if (xml->getErrorStatus()) return result;
+  std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
+  xml->findNodes(xpath, xml_nodes);
+  if (xml_nodes.size())
+  { 
+    target = xml_nodes[0]->getText();
+    result = true;
+  }
+
+  return result;
+}
+


=====================================
src/support_data/ossimNitfXmlDataContentDes.cpp
=====================================
@@ -86,8 +86,7 @@ std::ostream& ossimNitfXmlDataContentDes::print(std::ostream& out,
        << pfx << std::setw(24) << "DESSHLI:" << ((typeinfo) ? "(string)" : "") <<  m_desshli << "\n"
        << pfx << std::setw(24) << "DESSHABS:" << ((typeinfo) ? "(string)" : "") <<  m_desshabs << "\n"
         // Quick hack to print on one line, this will leave extra spaces in CDATA sections
-       << pfx << std::setw(24) << "XML:" << m_xmlString.substitute(ossimString("\n"), " ", true) << "\n"
-   ;
+       << pfx << std::setw(24) << "XML: \"\"\"" << m_xmlString << "\"\"\"\n";
    return out;
 }
 


=====================================
src/support_data/ossimQuickbirdMetaData.cpp
=====================================
@@ -20,8 +20,11 @@
 #include <ossim/base/ossimKeywordNames.h>
 #include <ossim/base/ossimString.h>
 #include <ossim/base/ossimTrace.h>
+#include <ossim/base/ossimStreamFactoryRegistry.h>
 #include <cstdio>
 #include <iostream>
+#include <stack>
+#include <memory>
 
 RTTI_DEF1(ossimQuickbirdMetaData, "ossimQuickbirdMetaData", ossimObject);
  
@@ -29,21 +32,148 @@ RTTI_DEF1(ossimQuickbirdMetaData, "ossimQuickbirdMetaData", ossimObject);
 static ossimTrace traceExec  ("ossimQuickbirdMetaData:exec");
 static ossimTrace traceDebug ("ossimQuickbirdMetaData:debug");
 
+class QbMetadataParser
+{
+ public:
+   bool openConnection(const ossimString &connectionString)
+   {
+      m_inputStream = ossim::StreamFactoryRegistry::instance()->createIstream(connectionString);
+      return m_inputStream != nullptr;
+   }
+   bool nextLine(ossimString &line)
+   {
+      std::ostringstream out;
+      line = "";
+      if (m_inputStream->good())
+      {
+         char c = static_cast<char>(m_inputStream->get());
+         while (!m_inputStream->eof() && m_inputStream->good() && c != '\n')
+         {
+            out.write(&c, 1);
+            c = static_cast<char>(m_inputStream->get());
+         }
+         line = out.str();
+      }
+
+      return !line.empty();
+   }
+   bool parseConnection(const ossimString &connectionString)
+   {
+      bool result = false;
+
+      if (openConnection(connectionString))
+      {
+         return parse();
+      }
+
+      return result;
+   }
+   bool parse();
+   void splitKeyValue(const ossimString &input, ossimString &key, ossimString &value) const
+   {
+      key = input.before("=");
+      value = input.after("=");
+      key = key.trim();
+      value = value.trim();
+   }
+   const std::shared_ptr<ossimKeywordlist> &getKwl() const
+   {
+      return m_kwl;
+   }
+
+   std::shared_ptr<ossim::istream> m_inputStream;
+   std::shared_ptr<ossimKeywordlist> m_kwl;
+   ossimString m_currentPrefix;
+};
+
+bool QbMetadataParser::parse() //std::istream& in, ossimKeywordlist& kwl, const ossimString& prefix)
+{
+   bool result = true;
+   std::stack<ossimString> prefixStack;
+   std::stack<ossim_int32> currentIdxStack;
+   ossimString line;
+   ossimString kwlString;
+   ossim_int32 bandIdx = -1;
+   ossim_int32 imageIdx = -1;
+   ossimString fullKeyValue;
+   ossimString key;
+   ossimString value;
+   prefixStack.push("");
+   ossimString bandNames;
+   m_kwl = std::make_shared<ossimKeywordlist>();
+   while (result && !prefixStack.empty() && nextLine(line))
+   {
+      ossimString tempLine = line;
+      tempLine = tempLine.trim();
+      if (tempLine.startsWith("BEGIN_GROUP"))
+      {
+         ossimString currentPrefix = prefixStack.top();
+         splitKeyValue(tempLine, key, value);
+         ossimString test = value;
+         test = test.downcase();
+         if (test.startsWith("band"))
+         {
+            ossimString bandNameValue = value.after("_").downcase();
+            if (bandNames.empty())
+            {
+               bandNames = bandNameValue;
+            }
+            else
+            {
+               bandNames += " " + bandNameValue;
+            }
+         }
+         prefixStack.push(currentPrefix + value.downcase().trim() + ".");
+      }
+      else if (tempLine.startsWith("END_GROUP"))
+      {
+         prefixStack.pop();
+         if (prefixStack.empty())
+         {
+            result = false;
+         }
+      }
+      else if (tempLine.endsWith(";"))
+      {
+         if (!tempLine.startsWith("END"))
+         {
+            fullKeyValue += line;
+            fullKeyValue = fullKeyValue.trim();
+            splitKeyValue(fullKeyValue, key, value);
+            value = value.trim().trim(";").trim("\"");
+            key = prefixStack.top() + key.trim();
+            m_kwl->add(key, value);
+         }
+         fullKeyValue = "";
+      }
+      else
+      {
+         fullKeyValue += line;
+      }
+   }
+   if (!bandNames.empty())
+   {
+      m_kwl->add("band_name_list", bandNames);
+   }
+   return result;
+}
+
 ossimQuickbirdMetaData::ossimQuickbirdMetaData()
-   :
-   theGenerationDate("Unknown"),
-   theBandId("Unknown"),
-   theBitsPerPixel(0),
-   theSatID("Unknown"),
-   theTLCDate("Unknown"),
-   theSunAzimuth(0.0),
-   theSunElevation(0.0),
-   theSatAzimuth(0.0),
-   theSatElevation(0.0),
-   theTDILevel(0),
-   theAbsCalFactors(),
-   theBandNameList("Unknown"),
-   theImageSize()
+    : theGenerationDate("Unknown"),
+      theBandId("Unknown"),
+      theBitsPerPixel(0),
+      theSatID("Unknown"),
+      theTLCDate("Unknown"),
+      theSunAzimuth(0.0),
+      theSunElevation(0.0),
+      theSatAzimuth(0.0),
+      theSatElevation(0.0),
+      theTDILevel(0),
+      theAbsCalFactors(),
+      theBandNameList("Unknown"),
+      theImageSize(),
+      thePNiirs(-1),
+      theCloudCoverage(0.0)
 {
    theImageSize.makeNan();
    theAbsCalFactors.clear();
@@ -53,7 +183,8 @@ ossimQuickbirdMetaData::~ossimQuickbirdMetaData()
 {
 }
 
-bool ossimQuickbirdMetaData::open(const ossimFilename& imageFile)
+bool ossimQuickbirdMetaData::open(const ossimFilename& imageFile,
+                                  ossim_int32 qbParseTypes)
 {
    static const char MODULE[] = "ossimQuickbirdMetaData::open";
 
@@ -63,17 +194,85 @@ bool ossimQuickbirdMetaData::open(const ossimFilename& imageFile)
    //if the Quickbird tif is 02APR01105228-M1BS-000000128955_01_P001.TIF
    //the metadata file will be 02APR01105228-M1BS-000000128955_01_P001.IMD
 
-   ossimFilename metadatafile = imageFile;
-   metadatafile.setExtension(ossimString("IMD"));
+   ossimFilename file = imageFile;
 
-   if( parseMetaData(metadatafile) == false )
+   if(qbParseTypes & QB_PARSE_TYPE_IMD)
    {
-      if(traceDebug())
+      file.setExtension(ossimString("IMD"));
+      if (parseMetaData(file) == false)
       {
-         ossimNotify(ossimNotifyLevel_WARN)
-	    << MODULE << " errors parsing metadata" << std::endl;
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing metadata" << std::endl;
+         }
+         return false;
+      }
+   }
+   if (qbParseTypes & QB_PARSE_TYPE_ATT)
+   {
+      file.setExtension(ossimString("ATT"));
+      if(!parse(m_attKwl, file))
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing att" << std::endl;
+         }
+         return false;
+      }
+   }
+   if (qbParseTypes & QB_PARSE_TYPE_EPH)
+   {
+      file.setExtension(ossimString("EPH"));
+      if (!parse(m_ephKwl, file))
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing eph" << std::endl;
+         }
+         return false;
+      }
+   }
+   if (qbParseTypes & QB_PARSE_TYPE_GEO)
+   {
+      file.setExtension(ossimString("GEO"));
+      if (!parse(m_geoKwl, file))
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing geo" << std::endl;
+         }
+         return false;
+      }
+   }
+   if (qbParseTypes & QB_PARSE_TYPE_RPB)
+   {
+      file.setExtension(ossimString("RPB"));
+      if (!parse(m_rpbKwl, file))
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing rpb" << std::endl;
+         }
+         return false;
+      }
+   }
+   if (qbParseTypes & QB_PARSE_TYPE_TIL)
+   {
+      file.setExtension(ossimString("TIL"));
+      if (!parse(m_tilKwl, file))
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_WARN)
+                << MODULE << " errors parsing til" << std::endl;
+         }
+         return false;
       }
-      return false;
    }
 
    return true;
@@ -94,6 +293,13 @@ void ossimQuickbirdMetaData::clearFields()
    theAbsCalFactors.clear();
    theBandNameList = "Unknown";
    theImageSize.makeNan();
+   m_attKwl = nullptr;
+   m_imdKwl = nullptr;
+   m_ephKwl = nullptr;
+   m_rpbKwl = nullptr;
+   m_geoKwl = nullptr;
+   m_tilKwl = nullptr;
+   m_steKwl = nullptr;
 }
 
 std::ostream& ossimQuickbirdMetaData::print(std::ostream& out) const
@@ -128,84 +334,169 @@ std::ostream& ossimQuickbirdMetaData::print(std::ostream& out) const
 bool ossimQuickbirdMetaData::saveState(ossimKeywordlist& kwl,
 				       const char* prefix)const
 {
-   kwl.add(prefix,
-           ossimKeywordNames::TYPE_KW,
-           "ossimQuickbirdMetaData",
-           true);
+   if(m_imdKwl)
+   {
+      kwl.add(prefix,
+              ossimKeywordNames::TYPE_KW,
+              "ossimQuickbirdMetaData",
+              true);
 
-   kwl.add(prefix,
-           "generation_date",
-           theGenerationDate,
-           true);
+      kwl.add(prefix,
+              "generation_date",
+              theGenerationDate,
+              true);
 
-   kwl.add(prefix,
-           "bits_per_pixel",
-           theBitsPerPixel,
-           true);
+      // will use generation date as the acquisition
+      kwl.add(prefix,
+              "acquisition_date",
+              theGenerationDate,
+              true);
 
-   kwl.add(prefix,
-           "band_id",
-           theBandId,
-           true);
+      kwl.add(prefix,
+              "bits_per_pixel",
+              theBitsPerPixel,
+              true);
 
-   kwl.add(prefix,
-           "sat_id",
-           theSatID,
-           true);
+      kwl.add(prefix,
+              "band_id",
+              theBandId,
+              true);
 
-   kwl.add(prefix,
-           "tlc_date",
-           theTLCDate,
-           true);
+      kwl.add(prefix,
+              "sat_id",
+              theSatID,
+              true);
 
-   kwl.add(prefix,
-           ossimKeywordNames::AZIMUTH_ANGLE_KW,
-           theSunAzimuth,
-           true);
+      kwl.add(prefix,
+              "sensor_id",
+              theSatID,
+              true);
 
-   kwl.add(prefix,
-           ossimKeywordNames::ELEVATION_ANGLE_KW,
-           theSunElevation,
-           true);
+      kwl.add(prefix,
+              "mission_id",
+              theSatID,
+              true);
 
-   kwl.add(prefix,
-           "sat_azimuth_angle",
-           theSatAzimuth,
-           true);
+      kwl.add(prefix,
+              "tlc_date",
+              theTLCDate,
+              true);
 
-   kwl.add(prefix,
-           "sat_elevation_angle",
-           theSatElevation,
-           true);
-          
-   kwl.add(prefix,
-           "TDI_level",
-           theTDILevel,
-           true);
-   kwl.add(prefix,
-           "band_name_list",
-           theBandNameList,
-           true);
+      kwl.add(prefix,
+              "sun_azimuth",
+              theSunAzimuth,
+              true);
+      kwl.add(prefix,
+              "sun_elevation",
+              theSunElevation,
+              true);
 
-   if( theBandId=="Multi" )
-   {
-      std::vector<ossimString> bandNameList = theBandNameList.split(" ");
-      for(unsigned int i = 0 ; i < bandNameList.size(); ++i)
+      kwl.add(prefix,
+              ossimKeywordNames::AZIMUTH_ANGLE_KW,
+              theSunAzimuth,
+              true);
+
+      kwl.add(prefix,
+              ossimKeywordNames::ELEVATION_ANGLE_KW,
+              theSunElevation,
+              true);
+
+      kwl.add(prefix,
+              "sat_azimuth_angle",
+              theSatAzimuth,
+              true);
+
+      kwl.add(prefix,
+              "sat_elevation_angle",
+              theSatElevation,
+              true);
+
+      kwl.add(prefix,
+              "TDI_level",
+              theTDILevel,
+              true);
+      kwl.add(prefix,
+              "band_name_list",
+              theBandNameList,
+              true);
+
+      if (thePNiirs > -1)
       {
          kwl.add(prefix,
-                 bandNameList[i] + "_band_absCalFactor",
-                 theAbsCalFactors[i],
+                 "niirs",
+                 thePNiirs,
                  true);
+      }
 
+      kwl.add(prefix,
+              "cloud_cover",
+              theCloudCoverage,
+              true);
+
+      if (theBandId == "Multi")
+      {
+         std::vector<ossimString> bandNameList = theBandNameList.split(" ");
+         for (unsigned int i = 0; i < bandNameList.size(); ++i)
+         {
+            kwl.add(prefix,
+                    bandNameList[i] + "_band_absCalFactor",
+                    theAbsCalFactors[i],
+                    true);
+         }
       }
+      else if (!theAbsCalFactors.empty())
+      {
+         kwl.add(prefix,
+                 "absCalFactor",
+                 theAbsCalFactors[0],
+                 true);
+      }
+      ossimString testBandId = theBandId;
+      testBandId = testBandId.upcase();
+      if (testBandId == "MULTI")
+      {
+         kwl.add(prefix, "irep", "MULTI");
+         kwl.add(prefix, "icat", "MS");
+      }
+      else if (testBandId == "P")
+      {
+         kwl.add(prefix, "irep", "MONO");
+         kwl.add(prefix, "icat", "VIS");
+      }
+      else if( !testBandId.empty())
+      {
+         kwl.add(prefix, "irep", testBandId);
+      }
+      kwl.add(ossimString(prefix) + "imd.", *m_imdKwl);
    }
-   else if(!theAbsCalFactors.empty())
+   if (m_attKwl)
    {
-      kwl.add(prefix,
-              "absCalFactor",
-              theAbsCalFactors[0],
-              true);  	
+      kwl.add(ossimString(prefix) + "att.", *m_attKwl);
    }
+   if (m_ephKwl)
+   {
+      kwl.add(ossimString(prefix) + "eph.", *m_ephKwl);
+   }
+   if (m_geoKwl)
+   {
+      kwl.add(ossimString(prefix) + "geo.", *m_geoKwl);
+   }
+   if (m_rpbKwl)
+   {
+      kwl.add(ossimString(prefix) + "rpb.", *m_rpbKwl);
+   }
+   if (m_steKwl)
+   {
+      kwl.add(ossimString(prefix) + "ste.", *m_rpbKwl);
+   }
+   if (m_tilKwl)
+   {
+      kwl.add(ossimString(prefix) + "til.", *m_tilKwl);
+   }
+   kwl.add(prefix,
+           "organization",
+           "DigitalGlobe",
+           true);
 
    return true;
 }
@@ -294,11 +585,36 @@ bool ossimQuickbirdMetaData::loadState(const ossimKeywordlist& kwl,
       theSatElevation = s.toFloat64();
    }
 
+   lookup = kwl.find(prefix, "sun_azimuth");
+   if (lookup)
+   {
+      s = lookup;
+      theSunAzimuth = s.toFloat64();
+   }
+
+   lookup = kwl.find(prefix, "sun_elevation");
+   if (lookup)
+   {
+      s = lookup;
+      theSunElevation = s.toFloat64();
+   }
+
    lookup = kwl.find(prefix, "band_name_list");
    if (lookup)
    {
       theBandNameList= lookup;
    }
+   lookup = kwl.find(prefix, "niirs");
+   if (lookup)
+   {
+      thePNiirs = ossimString(lookup).toFloat64();
+   }
+
+   lookup = kwl.find(prefix, "cloud_cover");
+   if(lookup)
+   {
+      theCloudCoverage = ossimString(lookup).toFloat64();
+   }
 
    if(theBandId=="Multi")
    {
@@ -324,6 +640,35 @@ bool ossimQuickbirdMetaData::loadState(const ossimKeywordlist& kwl,
          theAbsCalFactors[0] = s.toDouble();
       }	
    }
+   
+   if (kwl.getNumberOfKeysThatMatch("^" + ossimString(prefix) + "imd."))
+   {
+      m_imdKwl = std::make_shared<ossimKeywordlist>();
+      m_imdKwl->add(kwl , ossimString(prefix) + "imd.");
+   } 
+
+   if (kwl.getNumberOfKeysThatMatch("^" + ossimString(prefix) + "att."))
+   {
+      m_attKwl = std::make_shared<ossimKeywordlist>();
+      m_attKwl->add(kwl, ossimString(prefix) + "att.");
+   }
+
+   if (kwl.getNumberOfKeysThatMatch("^" + ossimString(prefix) + "geo."))
+   {
+      m_geoKwl = std::make_shared<ossimKeywordlist>();
+      m_geoKwl->add(kwl, ossimString(prefix) + "geo.");
+   }
+   if (kwl.getNumberOfKeysThatMatch("^" + ossimString(prefix) + "rpb."))
+   {
+      m_rpbKwl = std::make_shared<ossimKeywordlist>();
+      m_rpbKwl->add(kwl, ossimString(prefix) + "rpb.");
+   }
+   if (kwl.getNumberOfKeysThatMatch("^" + ossimString(prefix) + "ste."))
+   {
+      m_steKwl = std::make_shared<ossimKeywordlist>();
+      m_steKwl->add(kwl, ossimString(prefix) + "ste.");
+   }
+
    return true;
 }
 
@@ -335,442 +680,144 @@ bool ossimQuickbirdMetaData::loadState(const ossimKeywordlist& kwl,
 //*****************************************************************************
 bool ossimQuickbirdMetaData::parseMetaData(const ossimFilename& data_file)
 {
+   bool result = false;
    if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimQuickbirdMetaData::parseMetaData(data_file): entering..." << std::endl;
    
    if( !data_file.exists() )
    {
       if (traceExec()) ossimNotify(ossimNotifyLevel_WARN) << "ossimQuickbirdMetaData::parseMetaData(data_file) WARN:" << "\nmetadate data file <" << data_file << ">. " << "doesn't exist..." << std::endl;
-      return false;
+      return result;
    }
-  
+   m_imdKwl = nullptr;
 
-   FILE* fptr = fopen (data_file, "r");
-   if (!fptr)
+   //     std::shared_ptr<QbMetadataParser>
+   //         qbMetadataParser = std::make_shared<QbMetadataParser>();
+   // if (qbMetadataParser->parseConnection(data_file))
+   if(parse(m_imdKwl, data_file))
    {
-      if (traceDebug())
+      // m_imdKwl = std::make_shared<ossimKeywordlist>(*qbMetadataParser->getKwl());
+      ossimString value = m_imdKwl->find("generationTime");
+      if(!value.empty())
       {
-         ossimNotify(ossimNotifyLevel_DEBUG)
-	    << "ossimQuickbirdRpcModel::parseMetaData(data_file) DEBUG:"
-	    << "\nCould not open Meta data file:  " << data_file
-	    << "\nreturning with error..." << std::endl;
+         theGenerationDate = value;
       }
-      return false;
-   }
+      theBandId = m_imdKwl->find("bandId");
 
-   char* strptr(NULL);
-
-   //---
-   // Read the file into a buffer:
-   //---
-   ossim_int32 fileSize = static_cast<ossim_int32>(data_file.fileSize());
-   char* filebuf = new char[fileSize];
-   fread(filebuf, 1, fileSize, fptr);
-   strptr = filebuf;
-   fclose(fptr);
-   ossimString temp;
-
-   //---
-   // Generation time:
-   //---
-  
-   if(getEndOfLine( strptr, ossimString("\ngenerationTime ="), "%17c %s", temp))
-      theGenerationDate = ossimString(temp).before(";");
-   else
-   {
-      if(traceDebug())
+      value = m_imdKwl->find("numRows");
+      if(!value.empty())
       {
-         ossimNotify(ossimNotifyLevel_FATAL)
-	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-	    << "\n\tAborting construction. Error encountered parsing "
-	    << "presumed meta-data file." << std::endl;
-
-         delete [] filebuf;
-         return false;
+         theImageSize.y = value.toInt64();
       }
-   }
-
-   // Number of rows and columns in full image:
-   if(getEndOfLine( strptr, ossimString("\nnumRows ="), "%10c %s", temp))
-      theImageSize.line = ossimString(temp).before("\";").toInt();
-
-   if(getEndOfLine( strptr, ossimString("\nnumColumns ="), "%13c %s", temp))
-      theImageSize.samp = ossimString(temp).before("\";").toInt();
-
-   //---
-   // BandId:
-   //---
-   if(getEndOfLine( strptr, ossimString("\nbandId ="), "%9c %s", temp))
-      theBandId = ossimString(temp).after("\"").before("\";");
-   else
-   {
-      if(traceDebug())
+      value = m_imdKwl->find("numColumns");
+      if (!value.empty())
       {
-         ossimNotify(ossimNotifyLevel_FATAL)
-	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-	    << "\n\tAborting construction. Error encountered parsing "
-	    << "presumed meta-data file." << std::endl;
-
-         delete [] filebuf;
-         return false;
+         theImageSize.x = value.toInt64();
       }
-   }
-    
-  
-   //---
-   // BitsPerPixel:
-   //---
-   if(getEndOfLine( strptr, ossimString("\nbitsPerPixel = "), "%16c %s", temp))
-      theBitsPerPixel = ossimString(temp).before(";").toInt();
-   else
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_FATAL)
-	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-	    << "\n\tAborting construction. Error encountered parsing "
-	    << "presumed meta-data file." << std::endl;
+      theBandId = m_imdKwl->find("bandId");
 
-         delete [] filebuf;
-         return false;
+      value = m_imdKwl->find("nbitsPerPixel");
+      if(!value.empty())
+      {
+         theBitsPerPixel = value.toInt32();
       }
-   }
-     
-   //---
-   // absCalFactors:
-   //---
-
-   char *iter = (char *)filebuf;
-   unsigned int nbBand = 0;
-   theBandNameList = "";
-   for(iter = strstr(iter, "BEGIN_GROUP = BAND_"); iter ; iter = strstr(iter, "BEGIN_GROUP = BAND_"))
-   {
-      ++nbBand;
-      char dummy[80], nameChar[80];
-      sscanf(iter, "%19c %s", dummy, nameChar);
-      ossimString bandCur = ossimString(nameChar).before("\n");
-      theBandNameList = theBandNameList + bandCur + " ";
-      ++iter;
-   }
-   theBandNameList.trim();
-   
-   //--- Multispectral
-   if(theBandId=="Multi")
-   {
+      theBandNameList = m_imdKwl->find("band_name_list");
       std::vector<ossimString> bandList;
-      bandList = theBandNameList.split(" ");
-      theAbsCalFactors = std::vector<double>(bandList.size(), 1.);
-      for(unsigned int j=0; j<bandList.size(); j++)
-      {
-         ossimString begin_group = "BEGIN_GROUP = BAND_" + bandList[j];
-         strptr = strstr(filebuf, begin_group.c_str());
-         if(!strptr && traceDebug())
-         {	  				
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-            delete [] filebuf;
-            return false;
-         }
-         else
+      theBandNameList.split(bandList, " ");
+      if(bandList.size()>0)
+      {  
+         ossim_uint32 idx = 0;
+         theAbsCalFactors = std::vector<double>(bandList.size(), 1.0);
+         for(auto band:bandList)
          {
-            char dummy[80], nameChar[80];
-            sscanf(strptr, "%19c %s", dummy, nameChar);
-            ossimString bandCur = ossimString(nameChar).before("\n");
-            if(!strptr && traceDebug())
-            {	  				
-               ossimNotify(ossimNotifyLevel_FATAL)
-                  << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-                  << "\n\tAborting construction. Error encountered parsing "
-                  << "presumed meta-data file." << std::endl;
-               delete [] filebuf;
-               return false;
-            }
-            else
+            value = m_imdKwl->find("band_"+band+".absCalFactor");
+            if(!value.empty())
             {
-               if(bandList[j] == bandCur)
-               {
-                  strptr = strstr(strptr, "\tabsCalFactor = ");
-                  sscanf(strptr, "%16c %s", dummy, nameChar);
-                  theAbsCalFactors[j] = ossimString(nameChar).before(";").toDouble();
-               }
+               theAbsCalFactors[idx] = value.toFloat64();
             }
+            ++idx;
          }
       }
-   }
-   //--- Panchromatic
-   else
-   {
-      theAbsCalFactors = std::vector<double>(1, 1.);
-      if(getEndOfLine( strptr, ossimString("\tabsCalFactor = "), "%16c %s", temp))
-         theAbsCalFactors[0] = ossimString(temp).before(";").toDouble();
-      else
+      theSatID = m_imdKwl->find("image_1.satId");
+      theTLCDate = m_imdKwl->find("image_1.TLCTime");
+      if(theTLCDate.empty())
       {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-
-            delete [] filebuf;
-            return false;
-         }
+         theTLCDate = m_imdKwl->find("image_1.firstLineTime");
       }
-   }
-    
-   //---
-   // SatID:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tsatId ="), "%9c %s", temp))
-      theSatID = ossimString(temp).after("\"").before("\";");
-   else
-   {
-      if(traceDebug())
-      {
-         ossimNotify(ossimNotifyLevel_FATAL)
-	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-	    << "\n\tAborting construction. Error encountered parsing "
-	    << "presumed meta-data file." << std::endl;
-
-         delete [] filebuf;
-         return false;
-      }
-   }
-
-   //---
-   // TLCTime:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tTLCTime ="), "%11c %s", temp))
-      theTLCDate = ossimString(temp).before("\";");
-   else
-   {
-      if(getEndOfLine( strptr, ossimString("\n\tfirstLineTime ="), "%17c %s", temp))
-         theTLCDate = ossimString(temp).before("\";");
-      else
+      value = m_imdKwl->find("sunAz");
+      if (!value.empty())
       {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-            delete [] filebuf;
-            return false;
-         }
+         theSunAzimuth = value.toFloat64();
       }
-   }
-   
-   //---
-   // Sun Azimuth:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tsunAz ="), "%9c %s", temp))
-        theSunAzimuth = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( strptr, ossimString("\n\tmeanSunAz ="), "%13c %s", temp))
-         theSunAzimuth = ossimString(temp).before(";").toFloat64();
       else
       {
-         if(traceDebug())
+         value = m_imdKwl->find("image_1.meanSunAz");
+         if (!value.empty())
          {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-
-            delete [] filebuf;
-            return false;
+            theSunAzimuth = value.toFloat64();
          }
       }
-   }
-
-   //---
-   // Sun Elevation:
-   //---
-   if(getEndOfLine( filebuf, ossimString("\n\tsunEl ="), "%9c %s", temp))
-        theSunElevation = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( filebuf, ossimString("\n\tmeanSunEl ="), "%13c %s", temp))
-         theSunElevation = ossimString(temp).before(";").toFloat64();
-      else
+      value = m_imdKwl->find("sunEl");
+      if (!value.empty())
       {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-
-            delete [] filebuf;
-            return false;
-         }
+         theSunElevation = value.toFloat64();
       }
-   }
-
-   //---
-   // Sun Azimuth:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tsunAz ="), "%9c %s", temp))
-      theSunAzimuth = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( strptr, ossimString("\n\tmeanSunAz ="), "%13c %s", temp))
-         theSunAzimuth = ossimString(temp).before(";").toFloat64();
       else
       {
-         if(traceDebug())
+         value = m_imdKwl->find("image_1.meanSunEl");
+         if (!value.empty())
          {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-            
-            delete [] filebuf;
-            return false;
+            theSunElevation = value.toFloat64();
          }
       }
-   }
-
-   //---
-   // Sun Elevation:
-   //---
-   if(getEndOfLine( filebuf, ossimString("\n\tsunEl ="), "%9c %s", temp))
-      theSunElevation = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( filebuf, ossimString("\n\tmeanSunEl ="), "%13c %s", temp))
-         theSunElevation = ossimString(temp).before(";").toFloat64();
-      else
+      value = m_imdKwl->find("image_1.satAz");
+      if (!value.empty())
       {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-
-            delete [] filebuf;
-            return false;
-         }
+         theSatAzimuth = value.toFloat64();
       }
-   }
-
-
-   //---
-   // Sat Azimuth:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tsatAz ="), "%9c %s", temp))
-      theSatAzimuth = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( strptr, ossimString("\n\tmeanSatAz ="), "%13c %s", temp))
-         theSatAzimuth = ossimString(temp).before(";").toFloat64();
       else
       {
-         if(traceDebug())
+         value = m_imdKwl->find("image_1.meanSatAz");
+         if (!value.empty())
          {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-            
-            delete [] filebuf;
-            return false;
+            theSatAzimuth = value.toFloat64();
          }
       }
-   }
-   
-   //---
-   // Sat Elevation:
-   //---
-   if(getEndOfLine( filebuf, ossimString("\n\tsatEl ="), "%9c %s", temp))
-      theSatElevation = ossimString(temp).before(";").toFloat64();
-   else
-   {
-      if(getEndOfLine( filebuf, ossimString("\n\tmeanSatEl ="), "%13c %s", temp))
-         theSatElevation = ossimString(temp).before(";").toFloat64();
-      else
+      value = m_imdKwl->find("image_1.cloudCover");
+      if (!value.empty())
       {
-         if(traceDebug())
-         {
-            ossimNotify(ossimNotifyLevel_FATAL)
-               << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-               << "\n\tAborting construction. Error encountered parsing "
-               << "presumed meta-data file." << std::endl;
-            
-            delete [] filebuf;
-            return false;
-         }
+         theCloudCoverage = value.toFloat64();
       }
-   }
-   
-   
-   //---
-   // TDILevel:
-   //---
-   if(getEndOfLine( strptr, ossimString("\n\tTDILevel = "), "%13c %s", temp))
-      theTDILevel = ossimString(temp).before(";").toInt();
-   else
-   {
-      if(traceDebug())
+      value = m_imdKwl->find("image_1.PNIIRS");
+      if (!value.empty())
       {
-         ossimNotify(ossimNotifyLevel_FATAL)
-	    << "FATAL ossimQuickbirdRpcModel::parseMetaData(data_file): "
-	    << "\n\tAborting construction. Error encountered parsing "
-	    << "presumed meta-data file." << std::endl;
-
-         delete [] filebuf;
-         return false;
+         thePNiirs = value.toFloat64();
       }
-   }
 
-
-   delete [] filebuf;
-   filebuf = 0;
-
-   if (traceExec())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-         << "DEBUG ossimQuickbirdRpcModel::parseMetaData(data_file): returning..."
-         << std::endl;
+      result = true;
    }
 
-   return true;
-}
-
-//*****************************************************************************
-// PROTECTED METHOD: ossimQuickbirdMetaData::parseGEOData()
-//
-//  Parses the Quickbird GEO file.
-//
-//*****************************************************************************
-bool ossimQuickbirdMetaData::parseGEOData(const ossimFilename& /* data_file */)
-{
-  return true;
+   return result;
 }
 
-//*****************************************************************************
-// PROTECTED METHOD: ossimQuickbirdMetaData::parseRpcData()
-//
-//  Parses the Quickbird EPH file.
-//
-//*****************************************************************************
-bool ossimQuickbirdMetaData::parseEPHData(const ossimFilename& /* data_file */)
+bool ossimQuickbirdMetaData::parse(std::shared_ptr<ossimKeywordlist> &kwl, 
+                                   const ossimFilename &file)
 {
-  return true;
-}
-
-//*****************************************************************************
-// PROTECTED METHOD: ossimQuickbirdMetaData::parseRpcData()
-//
-//  Parses the Quickbird ATT file.
-//
-//*****************************************************************************
-bool ossimQuickbirdMetaData::parseATTData(const ossimFilename& /* data_file */)
-{
-  return true;
+   bool result = false;
+   if (!file.exists())
+   {
+      if (traceExec())
+         ossimNotify(ossimNotifyLevel_WARN) << "ossimQuickbirdMetaData::parse(file) WARN:"
+                                            << "\ndata file <" << file << ">. "
+                                            << "doesn't exist..." << std::endl;
+      return result;
+   }
+   std::shared_ptr<QbMetadataParser> qbMetadataParser = std::make_shared<QbMetadataParser>();
+   if (qbMetadataParser->parseConnection(file))
+   {
+      kwl = std::make_shared<ossimKeywordlist>(*qbMetadataParser->getKwl());
+      result = kwl->getSize() > 0;
+   }
+   return result;
 }
 
 ossimString ossimQuickbirdMetaData::getSatID() const
@@ -1037,7 +1084,30 @@ bool ossimQuickbirdMetaData::getMapProjectionKwl( const ossimFilename& imd_file,
 
    return result;
 }
+const std::shared_ptr<ossimKeywordlist> ossimQuickbirdMetaData::getImdKwl() const
+{
+   return m_imdKwl;
+}
 
+const std::shared_ptr<ossimKeywordlist> ossimQuickbirdMetaData::getAttKwl() const
+{
+   return m_attKwl;
+}
+
+const std::shared_ptr<ossimKeywordlist> ossimQuickbirdMetaData::getGeoKwl() const
+{
+   return m_geoKwl;
+}
+
+const std::shared_ptr<ossimKeywordlist> ossimQuickbirdMetaData::getEphKwl() const
+{
+   return m_ephKwl;
+}
+
+const std::shared_ptr<ossimKeywordlist> ossimQuickbirdMetaData::getRpbKwl() const
+{
+   return m_rpbKwl;
+}
 //*****************************************************************************
 // PROTECTED METHOD: ossimQuickbirdMetaData::getEndOfLine
 //


=====================================
src/support_data/ossimTiffInfo.cpp
=====================================
The diff for this file was not included because it is too large.


View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/0f37d557ce4175f060764b650f1458c317cd23ce...302cf18a7e7a78eb2c1f6bd14c6b061ee99dd73a

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/0f37d557ce4175f060764b650f1458c317cd23ce...302cf18a7e7a78eb2c1f6bd14c6b061ee99dd73a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20181017/b35878dd/attachment-0001.html>


More information about the Pkg-grass-devel mailing list