OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfCscrnaTag.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: David Burken
8 //
9 // Description: CSCRNA tag class definition.
10 //
11 // Corner Footprint TRE.
12 //
13 // See document STDI-0006-NCDRD Table 3.2-13 for more info.
14 //
15 //----------------------------------------------------------------------------
16 // $Id
17 
18 #include <cstring>
19 #include <istream>
20 #include <iostream>
21 #include <iomanip>
22 
24 
25 
27 
29  : ossimNitfRegisteredTag(std::string("CSCRNA"), 109)
30 {
31  clearFields();
32 }
33 
35 {
36 }
37 
39 {
40  clearFields();
41 
42  in.read(thePredictedCornerFlag, 1);
43 
44  in.read(theUlLat, 9);
45  in.read(theUlLon, 10);
46  in.read(theUlHt, 8);
47 
48  in.read(theUrLat, 9);
49  in.read(theUrLon, 10);
50  in.read(theUrHt, 8);
51 
52  in.read(theLrLat, 9);
53  in.read(theLrLon, 10);
54  in.read(theLrHt, 8);
55 
56  in.read(theLlLat, 9);
57  in.read(theLlLon, 10);
58  in.read(theLlHt, 8);
59 }
60 
62 {
63  out.write(thePredictedCornerFlag, 1);
64 
65  out.write(theUlLat, 9);
66  out.write(theUlLon, 10);
67  out.write(theUlHt, 8);
68 
69  out.write(theUrLat, 9);
70  out.write(theUrLon, 10);
71  out.write(theUrHt, 8);
72 
73  out.write(theLrLat, 9);
74  out.write(theLrLon, 10);
75  out.write(theLrHt, 8);
76 
77  out.write(theLlLat, 9);
78  out.write(theLlLon, 10);
79  out.write(theLlHt, 8);
80 }
81 
83 {
84  // BCS-N's to '0's, BCS-A's to ' '(spaces)
85  memset(thePredictedCornerFlag, ' ', 1);
86 
87  memset(theUlLat, 0, 9);
88  memset(theUlLon, 0, 10);
89  memset(theUlHt, 0, 8);
90 
91  memset(theUrLat, 0, 9);
92  memset(theUrLon, 0, 10);
93  memset(theUrHt, 0, 8);
94 
95  memset(theLrLat, 0, 9);
96  memset(theLrLon, 0, 10);
97  memset(theLrHt, 0, 8);
98 
99  memset(theLlLat, 0, 9);
100  memset(theLlLon, 0, 10);
101  memset(theLlHt, 0, 8);
102 
103  thePredictedCornerFlag[1] = '\0';
104 
105  theUlLat[9] = '\0';
106  theUlLon[10] = '\0';
107  theUlHt[8] = '\0';
108 
109  theUrLat[9] = '\0';
110  theUrLon[10] = '\0';
111  theUrHt[8] = '\0';
112 
113  theLrLat[9] = '\0';
114  theLrLon[10] = '\0';
115  theLrHt[8] = '\0';
116 
117  theLlLat[9] = '\0';
118  theLlLon[10] = '\0';
119  theLlHt[8] = '\0';
120 }
121 
123  std::ostream& out, const std::string& prefix) const
124 {
125  std::string pfx = prefix;
126  pfx += getTagName();
127  pfx += ".";
128 
129  out << setiosflags(std::ios::left)
130  << pfx << std::setw(24) << "CETAG:"
131  << getTagName() << "\n"
132  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
133 
134  << pfx << std::setw(24) << "PREDICT_CORNERS:"
135  << thePredictedCornerFlag << "\n"
136 
137  << pfx << std::setw(24) << "ULCRN_LAT:" << theUlLat << "\n"
138  << pfx << std::setw(24) << "ULCRN_LON:" << theUlLon << "\n"
139  << pfx << std::setw(24) << "ULCRN_HT:" << theUlHt << "\n"
140 
141  << pfx << std::setw(24) << "URCRN_LAT:" << theUrLat << "\n"
142  << pfx << std::setw(24) << "URCRN_LON:" << theUrLon << "\n"
143  << pfx << std::setw(24) << "URCRN_HT:" << theUrHt << "\n"
144 
145  << pfx << std::setw(24) << "LRCRN_LAT:" << theLrLat << "\n"
146  << pfx << std::setw(24) << "LRCRN_LON:" << theLrLon << "\n"
147  << pfx << std::setw(24) << "LRCRN_HT:" << theLrHt << "\n"
148 
149  << pfx << std::setw(24) << "LLCRN_LAT:" << theLlLat << "\n"
150  << pfx << std::setw(24) << "LLCRN_LON:" << theLlLon << "\n"
151  << pfx << std::setw(24) << "LLCRN_HT:" << theLlHt << "\n";
152 
153  return out;
154 }
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
char theLrLon[11]
FIELD: LRCRN_LON.
char theUlHt[9]
FIELD: ULCRN_HT.
char thePredictedCornerFlag[2]
FIELD: PREDICT_CORNERS.
char theLlLon[11]
FIELD: LLCRN_LON.
RTTI_DEF1(ossimNitfCscrnaTag, "ossimNitfCscrnaTag", ossimNitfRegisteredTag)
char theLlHt[9]
FIELD: LLCRN_HT.
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
ossimNitfCscrnaTag()
default constructor
virtual void parseStream(std::istream &in)
Method to parse data from stream.
virtual ~ossimNitfCscrnaTag()
destructor
char theUlLat[10]
FIELD: ULCRN_LAT.
virtual std::ostream & print(std::ostream &out, const std::string &prefix) const
Print method that outputs a key/value type format adding prefix to keys.
char theUlLon[11]
FIELD: ULCRN_LON.
virtual void clearFields()
Method to clear all fields including null terminating.
char theUrHt[9]
FIELD: URCRN_HT.
char theUrLat[10]
FIELD: URCRN_LAT.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theLlLat[10]
FIELD: LLCRN_LAT.
virtual void writeStream(std::ostream &out)
Method to write data to stream.
char theUrLon[11]
FIELD: URCRN_LON.
char theLrLat[10]
FIELD: LRCRN_LAT.
char theLrHt[9]
FIELD: LRCRN_HT.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23