OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfGeoPositioningTag.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: LGPL
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 //
7 // Author: Garrett Potts
8 //
9 // Description: Nitf support class
10 //
11 //********************************************************************
12 // $Id: ossimNitfGeoPositioningTag.cpp 22013 2012-12-19 17:37:20Z dburken $
13 
15 #include <cstring>
16 #include <istream>
17 #include <iostream>
18 #include <iomanip>
19 
20 RTTI_DEF1(ossimNitfGeoPositioningTag, "ossimNitfGeoPositioningTag", ossimNitfRegisteredTag);
21 
23  : ossimNitfRegisteredTag(std::string("GEOPSB"), 443)
24 {
25  clearFields();
26 }
27 
29 {
30 }
31 
33 {
34  clearFields();
35 
36  in.read(theType, 3);
37  in.read(theCoordinateUnits, 3);
38  in.read(theGeodeticDatumName, 80);
39  in.read(theGeodeticDatumCode, 4);
40  in.read(theEllipsoidName, 80);
41  in.read(theEllipsoidCode, 3);
42  in.read(theVerticalDatumReference, 80);
43  in.read(theVerticalReferenceCode, 4);
44  in.read(theSoundingDatumName, 80);
45  in.read(theSoundingDatumCode, 4);
46  in.read(theZFalseOrigin, 15);
47  in.read(theGridCode, 3);
48  in.read(theGridDescription, 80);
49  in.read(theGridZoneNumber, 4);
50 }
51 
53 {
54  out.write(theType, 3);
55  out.write(theCoordinateUnits, 3);
56  out.write(theGeodeticDatumName, 80);
57  out.write(theGeodeticDatumCode, 4);
58  out.write(theEllipsoidName, 80);
59  out.write(theEllipsoidCode, 3);
60  out.write(theVerticalDatumReference, 80);
61  out.write(theVerticalReferenceCode, 4);
62  out.write(theSoundingDatumName, 80);
63  out.write(theSoundingDatumCode, 4);
64  out.write(theZFalseOrigin, 15);
65  out.write(theGridCode, 3);
66  out.write(theGridDescription, 80);
67  out.write(theGridZoneNumber, 4);
68 }
69 
71 {
72  memset(theType, ' ', 3);
73  memset(theCoordinateUnits, ' ', 3);
74  memset(theGeodeticDatumName, ' ', 80);
75  memset(theGeodeticDatumCode, ' ', 4);
76  memset(theEllipsoidName, ' ', 80);
77  memset(theEllipsoidCode, ' ', 3);
78  memset(theVerticalDatumReference, ' ', 80);
79  memset(theVerticalReferenceCode, ' ', 4);
80  memset(theSoundingDatumName, ' ', 80);
81  memset(theSoundingDatumCode, ' ', 4);
82  memset(theZFalseOrigin, '0', 15);
83  memset(theGridCode, ' ', 3);
84  memset(theGridDescription, ' ', 80);
85  memset(theGridZoneNumber, '0', 4);
86 
87  memcpy(theType, "MAP", 3);
88  memcpy(theCoordinateUnits, "M ", 3);
89  memcpy(theGeodeticDatumName, "World Geodetic System 1984", 26);
90  memcpy(theGeodeticDatumCode, "WGE", 3);
91  memcpy(theEllipsoidName, "World Geodetic System 1984", 26);
92  memcpy(theEllipsoidCode, "WE", 2);
93  memcpy(theVerticalDatumReference, "Geodetic", 8);
94  memcpy(theVerticalReferenceCode, "GEOD", 4);
95  memcpy(theSoundingDatumName, "Mean Sea", 8);
96  memcpy(theSoundingDatumCode, "MSL", 3);
97 
98  theType[3] = '\0';
99  theCoordinateUnits[3] = '\0';
100  theGeodeticDatumName[80] = '\0';
101  theGeodeticDatumCode[4] = '\0';
102  theEllipsoidName[80] = '\0';
103  theEllipsoidCode[3] = '\0';
104  theVerticalDatumReference[80] = '\0';
105  theVerticalReferenceCode[4] = '\0';
106  theSoundingDatumName[80] = '\0';
107  theSoundingDatumCode[4] = '\0';
108  theZFalseOrigin[15] = '\0';
109  theGridCode[3] = '\0';
110  theGridDescription[80] = '\0';
111  theGridZoneNumber[4] = '\0';
112 
113 }
114 
116  std::ostream& out, const std::string& prefix) const
117 {
118  std::string pfx = prefix;
119  pfx += getTagName();
120  pfx += ".";
121 
122  out << setiosflags(std::ios::left)
123  << pfx << std::setw(24) << "CETAG:"
124  << getTagName() << "\n"
125  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
126  << pfx << std::setw(24) << "TYP:" << theType << "\n"
127  << pfx << std::setw(24) << "UNI:" << theCoordinateUnits << "\n"
128  << pfx << std::setw(24) << "DAG:" << theGeodeticDatumName << "\n"
129  << pfx << std::setw(24) << "DCD:" << theGeodeticDatumCode << "\n"
130  << pfx << std::setw(24) << "ELL:" << theEllipsoidName << "\n"
131  << pfx << std::setw(24) << "ELC:" << theEllipsoidCode << "\n"
132  << pfx << std::setw(24) << "DVR:" << theVerticalDatumReference << "\n"
133  << pfx << std::setw(24) << "VDCDVR:" << theVerticalReferenceCode << "\n"
134  << pfx << std::setw(24) << "SDA:" << theSoundingDatumName << "\n"
135  << pfx << std::setw(24) << "VDCSDA:" << theSoundingDatumCode << "\n"
136  << pfx << std::setw(24) << "ZOR:" << theZFalseOrigin << "\n"
137  << pfx << std::setw(24) << "GRD:" << theGridCode << "\n"
138  << pfx << std::setw(24) << "GRN:" << theGridDescription << "\n"
139  << pfx << std::setw(24) << "ZNA:" << theGridZoneNumber << "\n";
140 
141  return out;
142 }
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
char theVerticalReferenceCode[5]
FIELD: VDCDVR.
char theVerticalDatumReference[81]
FIELD: DVR.
virtual void parseStream(std::istream &in)
char theGeodeticDatumName[81]
FIELD: DAG.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
RTTI_DEF1(ossimNitfGeoPositioningTag, "ossimNitfGeoPositioningTag", ossimNitfRegisteredTag)
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theSoundingDatumCode[5]
FIELD: VDCSDA.
virtual std::ostream & print(std::ostream &out, const std::string &prefix=std::string()) const
Print method that outputs a key/value type format adding prefix to keys.
virtual void writeStream(std::ostream &out)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23