OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfLocalCartographicTag.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // LICENSE: LGPL
4 //
5 // see top level LICENSE.txt
6 //
7 // Author: Garrett Potts
8 // Description: Nitf support class
9 //
10 //********************************************************************
11 // $Id: ossimNitfLocalCartographicTag.cpp 22013 2012-12-19 17:37:20Z dburken $
12 
13 #include <sstream>
14 #include <iostream>
15 #include <iomanip>
17 
18 RTTI_DEF1(ossimNitfLocalCartographicTag, "ossimNitfLocalCartographicTag", ossimNitfRegisteredTag);
19 
21  : ossimNitfRegisteredTag(std::string("MAPLOB"), 43)
22 {
23 }
24 
26 {
27 }
28 
30 {
31  clearFields();
32 
33  in.read(theLengthUnits, 3);
34  in.read(theEastingInterval, 5);
35  in.read(theNorthingInterval, 5);
36  in.read(theEastingReferenceOrigin, 15);
37  in.read(theNorthingReferenceOrigin, 15);
38 }
39 
41 {
42  out.write(theLengthUnits, 3);
43  out.write(theEastingInterval, 5);
44  out.write(theNorthingInterval, 5);
45  out.write(theEastingReferenceOrigin, 15);
46  out.write(theNorthingReferenceOrigin, 15);
47 }
48 
50 {
51  memset(theLengthUnits, ' ', 3);
52  memset(theEastingInterval, '0', 5);
53  memset(theNorthingInterval, '0', 5);
54  memset(theEastingReferenceOrigin, '0', 15);
55  memset(theNorthingReferenceOrigin, '0', 15);
56 
57  theLengthUnits[3] = '\0';
58  theEastingInterval[5] = '\0';
59  theNorthingInterval[5] = '\0';
60  theEastingReferenceOrigin[15] = '\0';
61  theNorthingReferenceOrigin[15] = '\0';
62 }
63 
65 {
66  ossimString temp = ossimString(units).trim().upcase();
68 
69  out << std::setw(3)
70  << std::setfill(' ')
71  << temp.c_str();
72 
73  memcpy(theLengthUnits, out.str().c_str(), 3);
74 }
75 
77 {
78  ossim_uint32 temp = eastingInterval;
79 
80  if(temp > 99999)
81  {
82  temp = 99999;
83  }
84 
86 
87  out << std::setw(5)
88  << std::setfill('0')
89  << temp;
90 
91  memcpy(theEastingInterval, out.str().c_str(), 5);
92 }
93 
95 {
96  ossim_uint32 temp = northingInterval;
97 
98  if(temp > 99999)
99  {
100  temp = 99999;
101  }
102 
103  std::ostringstream out;
104 
105  out << std::setw(5)
106  << std::setfill('0')
107  << temp;
108 
109  memcpy(theNorthingInterval, out.str().c_str(), 5);
110 }
111 
113 {
114  std::ostringstream out;
115 
116  out << std::setw(15)
117  << std::setfill(' ')
118  << std::setprecision(1)
119  << std::setiosflags(std::ios::fixed)
120  << east;
121 
122  memcpy(theEastingReferenceOrigin, out.str().c_str(), 15);
123 
124 }
125 
127 {
128  std::ostringstream out;
129 
130  out << std::setw(15)
131  << std::setfill(' ')
132  << std::setprecision(1)
133  << std::setiosflags(std::ios::fixed)
134  << north;
135 
136  memcpy(theNorthingReferenceOrigin, out.str().c_str(), 15);
137 }
static ossimString upcase(const ossimString &aString)
Definition: ossimString.cpp:34
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
void setLengthUnits(const ossimString &units)
virtual void parseStream(std::istream &in)
double ossim_float64
unsigned int ossim_uint32
void setNorthingInterval(ossim_uint32 northingInterval)
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
void setNorthingReferenceOrigin(ossim_float64 north)
void setEastingInterval(ossim_uint32 eastingInterval)
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
void setEastingReferenceOrigin(ossim_float64 east)
virtual void writeStream(std::ostream &out)
RTTI_DEF1(ossimNitfLocalCartographicTag, "ossimNitfLocalCartographicTag", ossimNitfRegisteredTag)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23