OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRpfCoverageSection.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: Rpf support class
10 //
11 //********************************************************************
12 // $Id: ossimRpfCoverageSection.cpp 16997 2010-04-12 18:53:48Z dburken $
13 
14 #include <istream>
15 #include <iostream>
16 
18 #include <ossim/base/ossimCommon.h> /* ossim::byteOrder */
19 #include <ossim/base/ossimEndian.h>
20 
22 {
23  return data.print(out);
24 }
25 
27  :
28  theUpperLeftLat(0.0),
29  theUpperLeftLon(0.0),
30 
31  theLowerLeftLat(0.0),
32  theLowerLeftLon(0.0),
33 
34  theUpperRightLat(0.0),
35  theUpperRightLon(0.0),
36 
37  theLowerRightLat(0.0),
38  theLowerRightLon(0.0),
39 
40  theVerticalResolution(0.0),
41  theHorizontalResolution(0.0),
42 
43  theVerticalInterval(0.0),
44  theHorizontalInterval(0.0)
45 {
46 }
47 
49  :
50  theUpperLeftLat(obj.theUpperLeftLat),
51  theUpperLeftLon(obj.theUpperLeftLon),
52 
53  theLowerLeftLat(obj.theLowerLeftLat),
54  theLowerLeftLon(obj.theLowerLeftLon),
55 
56  theUpperRightLat(obj.theUpperRightLat),
57  theUpperRightLon(obj.theUpperRightLon),
58 
59  theLowerRightLat(obj.theLowerRightLat),
60  theLowerRightLon(obj.theLowerRightLon),
61 
62  theVerticalResolution(obj.theVerticalResolution),
63  theHorizontalResolution(obj.theHorizontalResolution),
64 
65  theVerticalInterval(obj.theVerticalInterval),
66  theHorizontalInterval(obj.theHorizontalInterval)
67 {
68 }
69 
71  const ossimRpfCoverageSection& rhs)
72 {
73  if ( this != & rhs )
74  {
77 
80 
83 
86 
89 
92  }
93  return *this;
94 }
95 
98 {
99  if(in)
100  {
101  in.read((char*)&theUpperLeftLat, 8);
102  in.read((char*)&theUpperLeftLon, 8);
103  in.read((char*)&theLowerLeftLat, 8);
104  in.read((char*)&theLowerLeftLon, 8);
105  in.read((char*)&theUpperRightLat, 8);
106  in.read((char*)&theUpperRightLon, 8);
107  in.read((char*)&theLowerRightLat, 8);
108  in.read((char*)&theLowerRightLon, 8);
109  in.read((char*)&theVerticalResolution, 8);
110  in.read((char*)&theHorizontalResolution, 8);
111  in.read((char*)&theVerticalInterval, 8);
112  in.read((char*)&theHorizontalInterval, 8);
113 
114  if( ossim::byteOrder() != byteOrder )
115  {
116  ossimEndian anEndian;
117  anEndian.swap(theUpperLeftLat);
118  anEndian.swap(theUpperLeftLon);
119  anEndian.swap(theLowerLeftLat);
120  anEndian.swap(theLowerLeftLon);
121  anEndian.swap(theUpperRightLat);
122  anEndian.swap(theUpperRightLon);
123  anEndian.swap(theLowerRightLat);
124  anEndian.swap(theLowerRightLon);
125  anEndian.swap(theVerticalResolution);
126  anEndian.swap(theHorizontalResolution);
127  anEndian.swap(theVerticalInterval);
128  anEndian.swap(theHorizontalInterval);
129  }
130  }
131  else
132  {
134  }
135 
137 }
138 
140 {
141  ossimEndian anEndian;
142 
143  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
144  {
145  // Always write out big endian.
146  anEndian.swap(theUpperLeftLat);
147  anEndian.swap(theUpperLeftLon);
148  anEndian.swap(theLowerLeftLat);
149  anEndian.swap(theLowerLeftLon);
150  anEndian.swap(theUpperRightLat);
151  anEndian.swap(theUpperRightLon);
152  anEndian.swap(theLowerRightLat);
153  anEndian.swap(theLowerRightLon);
154  anEndian.swap(theVerticalResolution);
155  anEndian.swap(theHorizontalResolution);
156  anEndian.swap(theVerticalInterval);
157  anEndian.swap(theHorizontalInterval);
158  }
159 
160  out.write((char*)&theUpperLeftLat, 8);
161  out.write((char*)&theUpperLeftLon, 8);
162  out.write((char*)&theLowerLeftLat, 8);
163  out.write((char*)&theLowerLeftLon, 8);
164  out.write((char*)&theUpperRightLat, 8);
165  out.write((char*)&theUpperRightLon, 8);
166  out.write((char*)&theLowerRightLat, 8);
167  out.write((char*)&theLowerRightLon, 8);
168  out.write((char*)&theVerticalResolution, 8);
169  out.write((char*)&theHorizontalResolution, 8);
170  out.write((char*)&theVerticalInterval, 8);
171  out.write((char*)&theHorizontalInterval, 8);
172 
173  if( anEndian.getSystemEndianType() != OSSIM_BIG_ENDIAN )
174  {
175  // Swap back to native byte order.
176  anEndian.swap(theUpperLeftLat);
177  anEndian.swap(theUpperLeftLon);
178  anEndian.swap(theLowerLeftLat);
179  anEndian.swap(theLowerLeftLon);
180  anEndian.swap(theUpperRightLat);
181  anEndian.swap(theUpperRightLon);
182  anEndian.swap(theLowerRightLat);
183  anEndian.swap(theLowerRightLon);
184  anEndian.swap(theVerticalResolution);
185  anEndian.swap(theHorizontalResolution);
186  anEndian.swap(theVerticalInterval);
187  anEndian.swap(theHorizontalInterval);
188  }
189 }
190 
192  std::ostream& out, const std::string& prefix) const
193 {
194  out << prefix << "ul_lat: "
195  << theUpperLeftLat << "\n"
196  << prefix << "ul_lon: "
197  << theUpperLeftLon << "\n"
198  << prefix << "ll_lat: "
199  << theLowerLeftLat << "\n"
200  << prefix << "ll_lon: "
201  << theLowerLeftLon << "\n"
202  << prefix << "ur_lat: "
203  << theUpperRightLat << "\n"
204  << prefix << "ur_lon: "
205  << theUpperRightLon << "\n"
206  << prefix << "lr_lat: "
207  << theLowerRightLat << "\n"
208  << prefix << "lr_lon: "
209  << theLowerRightLon << "\n"
210  << prefix << "vertical_resolution: "
211  << theVerticalResolution << "\n"
212  << prefix << "horizontal_resolution: "
213  << theHorizontalResolution << "\n"
214  << prefix << "vertical_interval: "
215  << theVerticalInterval << "\n"
216  << prefix << "horizontal_interval: "
217  << theHorizontalInterval << std::endl;
218  return out;
219 }
220 
222 {
223  theUpperLeftLat = 0.0;
224  theUpperLeftLon = 0.0;
225  theLowerLeftLat = 0.0;
226  theLowerLeftLon = 0.0;
227  theUpperRightLat = 0.0;
228  theUpperRightLon = 0.0;
229  theLowerRightLat = 0.0;
230  theLowerRightLon = 0.0;
231  theVerticalResolution = 0.0;
233  theVerticalInterval = 0.0;
234  theHorizontalInterval = 0.0;
235 }
236 
238 {
239  theUpperLeftLat = value;
240 }
241 
243 {
244  theUpperLeftLon = value;
245 }
246 
248 {
249  theLowerLeftLat = value;
250 }
251 
253 {
254  theLowerLeftLon = value;
255 }
256 
258 {
259  theLowerRightLat = value;
260 }
261 
263 {
264  theLowerRightLon = value;
265 }
266 
268 {
269  theUpperRightLat = value;
270 }
271 
273 {
274  theUpperRightLon = value;
275 }
276 
278 {
279  theVerticalResolution = value;
280 }
281 
283 {
284  theHorizontalResolution = value;
285 }
286 
288 {
289  theVerticalInterval = value;
290 }
291 
293 {
294  theHorizontalInterval = value;
295 }
ossim_int32 ossimErrorCode
std::ostream & operator<<(std::ostream &out, const ossimRpfCoverageSection &data)
void setLrLat(ossim_float64 value)
Sets theLowerRightLat to value.
ossimErrorCode parseStream(std::istream &in, ossimByteOrder byteOrder)
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.
void setLlLon(ossim_float64 value)
Sets theLowerLeftLon to value.
static const ossimErrorCode OSSIM_OK
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
static const ossimErrorCode OSSIM_ERROR
void setUrLon(ossim_float64 value)
Sets theUpperRightLon to value.
void setUrLat(ossim_float64 value)
Sets theUpperRightLat to value.
void setHorizontalResolution(ossim_float64 value)
Sets theHorizontalResolution to value.
double ossim_float64
void setUlLon(ossim_float64 value)
Sets theUpperLeftLon to value.
ossimByteOrder
const ossimRpfCoverageSection & operator=(const ossimRpfCoverageSection &rhs)
ossimByteOrder getSystemEndianType() const
Definition: ossimEndian.h:78
void setVerticalResolution(ossim_float64 value)
Sets theVerticalResolution to value.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
void setUlLat(ossim_float64 value)
Sets theUpperLeftLat to value.
void writeStream(std::ostream &out)
Write method.
void setVerticalInterval(ossim_float64 value)
Sets theVerticalInterval to value.
void setLrLon(ossim_float64 value)
Sets theLowerRightLon to value.
void setHorizontalInterval(ossim_float64 value)
Sets theHorizontalInterval to value.
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void setLlLat(ossim_float64 value)
Sets theLowerLeftLat to value.