1 //******************************************************************* 2 // 3 // License: MIT 4 // 5 // See LICENSE.txt file in the top level directory for more details. 6 // 7 // Author: Ken Melero 8 // 9 // Description: This class gives access to the User Header Label 10 // (UHL) of a DTED Level 1 file. 11 // 12 //******************************************************************** 13 // $Id: ossimDtedUhl.h 16104 2009-12-17 18:09:59Z gpotts $ 14 #ifndef ossimDtedUhl_H 15 #define ossimDtedUhl_H 16 #include <iosfwd> 17 #include <ossim/base/ossimConstants.h> 18 #include <ossim/base/ossimErrorStatusInterface.h> 19 #include <ossim/base/ossimFilename.h> 20 #include <ossim/base/ossimRefPtr.h> 21 #include <ossim/base/ossimIosFwd.h> 22 #include <memory> 23 24 class ossimProperty; 25 26 class OSSIM_DLL ossimDtedUhl : public ossimErrorStatusInterface 27 { 28 public: 29 ossimDtedUhl(); 30 ossimDtedUhl(std::shared_ptr<ossim::istream>& str, ossim_int64 offset=0); 31 32 enum 33 { 34 UHL_LENGTH = 80, 35 UHL_LON_ORIGIN = 5, 36 UHL_LAT_ORIGIN = 13, 37 UHL_LON_INTERVAL = 21, 38 UHL_LAT_INTERVAL = 25, 39 UHL_ABSOLUTE_LE = 29, 40 UHL_SECURITY_CODE = 33, 41 UHL_REFERENCE_NUM = 33, 42 UHL_NUM_LON_LINES = 48, 43 UHL_NUM_LAT_LINES = 52, 44 UHL_MULTIPLE_ACC = 56, 45 UHL_RESERVED = 57, 46 FIELD1_SIZE = 3, 47 FIELD2_SIZE = 1, 48 FIELD3_SIZE = 8, 49 FIELD4_SIZE = 8, 50 FIELD5_SIZE = 4, 51 FIELD6_SIZE = 4, 52 FIELD7_SIZE = 4, 53 FIELD8_SIZE = 3, 54 FIELD9_SIZE = 12, 55 FIELD10_SIZE = 4, 56 FIELD11_SIZE = 4, 57 FIELD12_SIZE = 1, 58 FIELD13_SIZE = 24 59 }; 60 61 // The Recognition Sentinel signifies if the UHL record exists. 62 ossimString recognitionSentinel() const; 63 64 double lonOrigin() const; 65 double latOrigin() const; 66 double lonInterval() const; 67 double latInterval() const; 68 double absoluteLE() const; 69 ossimString securityCode() const; 70 ossim_int32 numLonLines() const; 71 ossim_int32 numLatPoints() const; 72 ossim_int32 mulitpleAccuracy() const; 73 ossim_int32 startOffset() const; 74 ossim_int32 stopOffset() const; 75 76 friend OSSIM_DLL std::ostream& operator<<( std::ostream& out, 77 const ossimDtedUhl& uhl); 78 79 /** 80 * @brief print method that outputs a key/value type format adding prefix 81 * to keys. 82 * @param out String to output to. 83 * @param prefix This will be prepended to key. 84 * e.g. Where prefix = "nitf." and key is "file_name" key becomes: 85 * "nitf.file_name:" 86 * @return output stream. 87 */ 88 std::ostream& print(std::ostream& out, 89 const std::string& prefix) const; 90 91 void parse(std::istream& in); 92 93 /** 94 * @brief Gets a property for name. 95 * @param name Property name to get. 96 * @return ossimRefPtr<ossimProperty> Note that this can be empty if 97 * property for name was not found. 98 */ 99 ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const; 100 101 /** 102 * @brief Adds this class's properties to list. 103 * @param propertyNames list to append to. 104 */ 105 void getPropertyNames(std::vector<ossimString>& propertyNames)const; 106 107 private: 108 // Do not allow... 109 ossimDtedUhl(const ossimDtedUhl& source); 110 const ossimDtedUhl& operator=(const ossimDtedUhl& rhs); 111 112 double degreesFromString(const char* str) const; 113 double spacingFromString(const char* str) const; 114 115 char theRecSen[FIELD1_SIZE+1]; 116 char theField2[FIELD2_SIZE+1]; 117 char theLonOrigin[FIELD3_SIZE+1]; 118 char theLatOrigin[FIELD4_SIZE+1]; 119 char theLonInterval[FIELD5_SIZE+1]; 120 char theLatInterval[FIELD6_SIZE+1]; 121 char theAbsoluteLE[FIELD7_SIZE+1]; 122 char theSecurityCode[FIELD8_SIZE+1]; 123 char theField9[FIELD9_SIZE+1]; 124 char theNumLonLines[FIELD10_SIZE+1]; 125 char theNumLatPoints[FIELD11_SIZE+1]; 126 char theMultipleAccuracy[FIELD12_SIZE+1]; 127 128 ossim_int32 theStartOffset; 129 ossim_int32 theStopOffset; 130 }; 131 132 #endif 133