forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathossimNitfGeoPositioningTag.cpp
More file actions
144 lines (129 loc) · 4.92 KB
/
Copy pathossimNitfGeoPositioningTag.cpp
File metadata and controls
144 lines (129 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//*******************************************************************
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: Garrett Potts
//
// Description: Nitf support class
//
//********************************************************************
// $Id: ossimNitfGeoPositioningTag.cpp 22013 2012-12-19 17:37:20Z dburken $
#include <ossim/support_data/ossimNitfGeoPositioningTag.h>
#include <cstring>
#include <istream>
#include <iostream>
#include <iomanip>
using namespace std;
RTTI_DEF1(ossimNitfGeoPositioningTag, "ossimNitfGeoPositioningTag", ossimNitfRegisteredTag);
ossimNitfGeoPositioningTag::ossimNitfGeoPositioningTag()
: ossimNitfRegisteredTag(std::string("GEOPSB"), 443)
{
clearFields();
}
ossimNitfGeoPositioningTag::~ossimNitfGeoPositioningTag()
{
}
void ossimNitfGeoPositioningTag::parseStream(std::istream& in)
{
clearFields();
in.read(theType, 3);
in.read(theCoordinateUnits, 3);
in.read(theGeodeticDatumName, 80);
in.read(theGeodeticDatumCode, 4);
in.read(theEllipsoidName, 80);
in.read(theEllipsoidCode, 3);
in.read(theVerticalDatumReference, 80);
in.read(theVerticalReferenceCode, 4);
in.read(theSoundingDatumName, 80);
in.read(theSoundingDatumCode, 4);
in.read(theZFalseOrigin, 15);
in.read(theGridCode, 3);
in.read(theGridDescription, 80);
in.read(theGridZoneNumber, 4);
}
void ossimNitfGeoPositioningTag::writeStream(std::ostream& out)
{
out.write(theType, 3);
out.write(theCoordinateUnits, 3);
out.write(theGeodeticDatumName, 80);
out.write(theGeodeticDatumCode, 4);
out.write(theEllipsoidName, 80);
out.write(theEllipsoidCode, 3);
out.write(theVerticalDatumReference, 80);
out.write(theVerticalReferenceCode, 4);
out.write(theSoundingDatumName, 80);
out.write(theSoundingDatumCode, 4);
out.write(theZFalseOrigin, 15);
out.write(theGridCode, 3);
out.write(theGridDescription, 80);
out.write(theGridZoneNumber, 4);
}
void ossimNitfGeoPositioningTag::clearFields()
{
memset(theType, ' ', 3);
memset(theCoordinateUnits, ' ', 3);
memset(theGeodeticDatumName, ' ', 80);
memset(theGeodeticDatumCode, ' ', 4);
memset(theEllipsoidName, ' ', 80);
memset(theEllipsoidCode, ' ', 3);
memset(theVerticalDatumReference, ' ', 80);
memset(theVerticalReferenceCode, ' ', 4);
memset(theSoundingDatumName, ' ', 80);
memset(theSoundingDatumCode, ' ', 4);
memset(theZFalseOrigin, '0', 15);
memset(theGridCode, ' ', 3);
memset(theGridDescription, ' ', 80);
memset(theGridZoneNumber, '0', 4);
memcpy(theType, "MAP", 3);
memcpy(theCoordinateUnits, "M ", 3);
memcpy(theGeodeticDatumName, "World Geodetic System 1984", 26);
memcpy(theGeodeticDatumCode, "WGE", 3);
memcpy(theEllipsoidName, "World Geodetic System 1984", 26);
memcpy(theEllipsoidCode, "WE", 2);
memcpy(theVerticalDatumReference, "Geodetic", 8);
memcpy(theVerticalReferenceCode, "GEOD", 4);
memcpy(theSoundingDatumName, "Mean Sea", 8);
memcpy(theSoundingDatumCode, "MSL", 3);
theType[3] = '\0';
theCoordinateUnits[3] = '\0';
theGeodeticDatumName[80] = '\0';
theGeodeticDatumCode[4] = '\0';
theEllipsoidName[80] = '\0';
theEllipsoidCode[3] = '\0';
theVerticalDatumReference[80] = '\0';
theVerticalReferenceCode[4] = '\0';
theSoundingDatumName[80] = '\0';
theSoundingDatumCode[4] = '\0';
theZFalseOrigin[15] = '\0';
theGridCode[3] = '\0';
theGridDescription[80] = '\0';
theGridZoneNumber[4] = '\0';
}
std::ostream& ossimNitfGeoPositioningTag::print(
std::ostream& out, const std::string& prefix) const
{
std::string pfx = prefix;
pfx += getTagName();
pfx += ".";
out << setiosflags(std::ios::left)
<< pfx << std::setw(24) << "CETAG:"
<< getTagName() << "\n"
<< pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
<< pfx << std::setw(24) << "TYP:" << theType << "\n"
<< pfx << std::setw(24) << "UNI:" << theCoordinateUnits << "\n"
<< pfx << std::setw(24) << "DAG:" << theGeodeticDatumName << "\n"
<< pfx << std::setw(24) << "DCD:" << theGeodeticDatumCode << "\n"
<< pfx << std::setw(24) << "ELL:" << theEllipsoidName << "\n"
<< pfx << std::setw(24) << "ELC:" << theEllipsoidCode << "\n"
<< pfx << std::setw(24) << "DVR:" << theVerticalDatumReference << "\n"
<< pfx << std::setw(24) << "VDCDVR:" << theVerticalReferenceCode << "\n"
<< pfx << std::setw(24) << "SDA:" << theSoundingDatumName << "\n"
<< pfx << std::setw(24) << "VDCSDA:" << theSoundingDatumCode << "\n"
<< pfx << std::setw(24) << "ZOR:" << theZFalseOrigin << "\n"
<< pfx << std::setw(24) << "GRD:" << theGridCode << "\n"
<< pfx << std::setw(24) << "GRN:" << theGridDescription << "\n"
<< pfx << std::setw(24) << "ZNA:" << theGridZoneNumber << "\n";
return out;
}