1 //*******************************************************************
2 //
3 // License:  See top level LICENSE.txt file.
4 //
5 // Author:  Garrett Potts
6 //
7 // Description:
8 //
9 //*******************************************************************
10 //  $Id: ossimQuickbirdTile.h 19682 2011-05-31 14:21:20Z dburken $
11 #ifndef ossimQuickbirdTil_HEADER
12 #define ossimQuickbirdTil_HEADER
13 #include <map>
14 #include <fstream>
15 #include <ossim/base/ossimErrorStatusInterface.h>
16 #include <ossim/base/ossimString.h>
isAPolynomial()17 #include <ossim/base/ossimFilename.h>
18 #include <ossim/base/ossimCommon.h>
19 
20 class ossimQuickbirdTileInfo
21 {
22 public:
23    friend std::ostream& operator << (std::ostream& out, const ossimQuickbirdTileInfo& /* rhs */)
24    {
25       return out;
26    }
27    bool operator ==(const ossimString& rhs)const
28       {
29          return theFilename == rhs;
30       }
31    bool operator <(const ossimString& rhs)const
32       {
33          return theFilename < rhs;
34       }
35    bool operator >(const ossimString& rhs)const
36       {
37          return theFilename > rhs;
38       }
39    bool operator ==(const ossimQuickbirdTileInfo& rhs)const
40       {
41          return theFilename == rhs.theFilename;
42       }
43    bool operator <(const ossimQuickbirdTileInfo& rhs)const
44       {
45          return theFilename < rhs.theFilename;
46       }
47    bool operator >(const ossimQuickbirdTileInfo& rhs)const
48       {
49          return theFilename > rhs.theFilename;
50       }
51 
52    ossimQuickbirdTileInfo()
53       {
54          initialize();
55       }
56 
57    void initialize()
58       {
59          theTileGroup = "";
60          theFilename  = "";
61          theUlXOffset = OSSIM_INT_NAN;
62          theUlYOffset = OSSIM_INT_NAN;
63          theUrXOffset = OSSIM_INT_NAN;
64          theUrYOffset = OSSIM_INT_NAN;
65          theLrXOffset = OSSIM_INT_NAN;
66          theLrYOffset = OSSIM_INT_NAN;
67          theLlXOffset = OSSIM_INT_NAN;
68          theLlYOffset = OSSIM_INT_NAN;
69 
70          theUlLon     = ossim::nan();
71          theUlLat     = ossim::nan();
72          theUrLon     = ossim::nan();
73          theUrLat     = ossim::nan();
74          theLrLon     = ossim::nan();
75          theLrLat     = ossim::nan();
76          theLlLon     = ossim::nan();
77          theLlLat     = ossim::nan();
78       }
79    ossimString    theTileGroup;
80    ossimFilename  theFilename;
81    ossim_int32    theUlXOffset;
82    ossim_int32    theUlYOffset;
83    ossim_int32    theUrXOffset;
84    ossim_int32    theUrYOffset;
85    ossim_int32    theLrXOffset;
86    ossim_int32    theLrYOffset;
87    ossim_int32    theLlXOffset;
88    ossim_int32    theLlYOffset;
89    ossim_float64  theUlLon;
90    ossim_float64  theUlLat;
91    ossim_float64  theUrLon;
92    ossim_float64  theUrLat;
93    ossim_float64  theLrLon;
94    ossim_float64  theLrLat;
95    ossim_float64  theLlLon;
96    ossim_float64  theLlLat;
97 };
98 
99 class ossimQuickbirdTile : public ossimErrorStatusInterface
100 {
101 public:
102    ossimQuickbirdTile();
103    bool open(const ossimFilename tileFile);
104 
105    bool getInfo(ossimQuickbirdTileInfo& result,
106                 const ossimFilename& filename)const;
107 
108    const std::map<std::string, ossimQuickbirdTileInfo>& getMap() const { return theTileMap; }
109 
110    typedef std::map<std::string, ossimQuickbirdTileInfo> TileMap;
111 
112 protected:
113 
114    TileMap     theTileMap;
115    ossim_int32 theNumberOfTiles;
116    ossimString theBandId;
117 
118    void parseTileGroup(std::istream& in,
119                        const ossimString& tileName);
120    void parseNameValue(ossimString& name,
121                        ossimString& value,
122                        const ossimString& line)const;
123 
124 
125 };
126 
127 #endif
128