1 //**************************************************************************
2 // Copyright (C) 2003 Storage Area Networks, Inc.
3 //
4 // Written by:   Kenneth Melero  <kmelero@sanz.com>
5 //
6 //**************************************************************************
7 
8 #ifndef ossimNadconGridHeader_HEADER
9 #define ossimNadconGridHeader_HEADER 1
10 #include <ossim/base/ossimConstants.h>
11 #include <ossim/base/ossimFilename.h>
12 #include <ossim/base/ossimDrect.h>
13 #include <iostream>
14 
15 class OSSIM_DLL ossimNadconGridHeader
16 {
ossimNadconGridFile()17 public:
18    friend OSSIM_DLL std::ostream& operator <<(std::ostream& out, const ossimNadconGridHeader& rhs);
19    ossimNadconGridHeader()
20       :theCols(0),
21        theRows(0),
22        theZ(0),
23        theMinX(0),
24        theDx(0),
25        theMinY(0),
getBoundingRect()26        theDy(0)
27       {
28       }
29    bool readHeader(const ossimFilename& file);
30    bool readHeader(std::istream& in);
getFilename()31 
32    int getStartOffset()const
33       {
34          return (theCols+2)*4;
35       }
36 
37    int getBytesPerRow()const
38       {
getSpacing()39          return (theCols+1)*4;
40       }
41 
42    int getNumberOfRows()const
43       {
44          return theRows;
45       }
46    int getNumberOfCols()const
47       {
48          return theCols;
49       }
50    double getDeltaX()const
51       {
52          return (double)theDx;
53       }
54    double getDeltaY()const
55       {
56          return (double)theDy;
57       }
58    ossimDrect getBoundingRect()const
59       {
60          return ossimDrect(theMinX,
61                            theMinY + (theRows)*theDy,
62                            theMinX + (theCols)*theDx,
63                            theMinY,
64                            OSSIM_RIGHT_HANDED);
65       }
66    double getMinX()const
67       {
68          return theMinX;
69       }
70    double getMinY()const
71       {
72          return theMinY;
73       }
74    ossimDpt getSpacing()const
75       {
76          return ossimDpt(theDx, theDy);
77       }
78 protected:
79    int*   theCharBuf[64];
80    int   theCols;
81    int   theRows;
82    int   theZ;
83    double theMinX;
84    double theDx;
85    double theMinY;
86    double theDy;
87 };
88 
89 #endif
90