OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfUse00aTag.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: Walt Bunch
8 //
9 // Description: Nitf support class for USE00A -
10 // Exploitation Usability extension.
11 //
12 //********************************************************************
13 // $Id: ossimNitfUse00aTag.cpp 22013 2012-12-19 17:37:20Z dburken $
14 
15 #include <iostream>
16 #include <iomanip>
19 #include <ossim/base/ossimCommon.h>
20 
22 
23 static const ossimString ANGLETONORTH_KW = "ANGLETONORTH";
24 static const ossimString MEANGSD_KW = "MEANGSD";
25 static const ossimString DYNAMICRANGE_KW = "DYNAMICRANGE";
26 static const ossimString OBLANG_KW = "OBLANG";
27 static const ossimString ROLLANG_KW = "ROLLANG";
28 static const ossimString NREF_KW = "NREF";
29 static const ossimString REVNUM_KW = "REVNUM";
30 static const ossimString NSEG_KW = "NSEG";
31 static const ossimString MAXLPSEG_KW = "MAXLPSEG";
32 static const ossimString SUNEL_KW = "SUNEL";
33 static const ossimString SUNAZ_KW = "SUNAZ";
34 
35 
37  : ossimNitfRegisteredTag(std::string("USE00A"), 107)
38 {
39  clearFields();
40 }
41 
43 {
44 }
45 
47 {
48  clearFields();
49 
51  in.read(theMeanGsd, MEAN_GSD_SIZE);
52  in.read(theField3, FIELD3_SIZE);
54  in.read(theField5, FIELD5_SIZE);
55  in.read(theField6, FIELD6_SIZE);
56  in.read(theField7, FIELD7_SIZE);
57  in.read(theOblAng, OBL_ANG_SIZE);
58  in.read(theRollAng, ROLL_ANG_SIZE);
59  in.read(theField10, FIELD10_SIZE);
60  in.read(theField11, FIELD11_SIZE);
61  in.read(theField12, FIELD12_SIZE);
62  in.read(theField13, FIELD13_SIZE);
63  in.read(theField14, FIELD14_SIZE);
64  in.read(theField15, FIELD15_SIZE);
65  in.read(theField16, FIELD16_SIZE);
66  in.read(theNRef, N_REF_SIZE);
67  in.read(theRevNum, REV_NUM_SIZE);
68  in.read(theNSeg, N_SEG_SIZE);
69  in.read(theMaxLpSeg, MAX_LP_SEG_SIZE);
70  in.read(theField20, FIELD20_SIZE);
71  in.read(theField21, FIELD21_SIZE);
72  in.read(theSunEl, SUN_EL_SIZE);
73  in.read(theSunAz, SUN_AZ_SIZE);
74 }
75 
77 {
79  out.write(theMeanGsd, MEAN_GSD_SIZE);
80  out.write(theField3, FIELD3_SIZE);
82  out.write(theField5, FIELD5_SIZE);
83  out.write(theField6, FIELD6_SIZE);
84  out.write(theField7, FIELD7_SIZE);
85  out.write(theOblAng, OBL_ANG_SIZE);
86  out.write(theRollAng, ROLL_ANG_SIZE);
87  out.write(theField10, FIELD10_SIZE);
88  out.write(theField11, FIELD11_SIZE);
89  out.write(theField12, FIELD12_SIZE);
90  out.write(theField13, FIELD13_SIZE);
91  out.write(theField14, FIELD14_SIZE);
92  out.write(theField15, FIELD15_SIZE);
93  out.write(theField16, FIELD16_SIZE);
94  out.write(theNRef, N_REF_SIZE);
95  out.write(theRevNum, REV_NUM_SIZE);
96  out.write(theNSeg, N_SEG_SIZE);
97  out.write(theMaxLpSeg, MAX_LP_SEG_SIZE);
98  out.write(theField20, FIELD20_SIZE);
99  out.write(theField21, FIELD21_SIZE);
100  out.write(theSunEl, SUN_EL_SIZE);
101  out.write(theSunAz, SUN_AZ_SIZE);
102 }
103 
105 {
106  memset(theAngleToNorth, ' ', ANGLE_TO_NORTH_SIZE);
107  memset(theMeanGsd, ' ', MEAN_GSD_SIZE);
108  memset(theField3, ' ', FIELD3_SIZE);
109  memset(theDynamicRange, ' ', DYNAMIC_RANGE_SIZE);
110  memset(theField5, ' ', FIELD5_SIZE);
111  memset(theField6, ' ', FIELD6_SIZE);
112  memset(theField7, ' ', FIELD7_SIZE);
113  memset(theOblAng, ' ', OBL_ANG_SIZE);
114  memset(theRollAng, ' ', ROLL_ANG_SIZE);
115  memset(theField10, ' ', FIELD10_SIZE);
116  memset(theField11, ' ', FIELD11_SIZE);
117  memset(theField12, ' ', FIELD12_SIZE);
118  memset(theField13, ' ', FIELD13_SIZE);
119  memset(theField14, ' ', FIELD14_SIZE);
120  memset(theField15, ' ', FIELD15_SIZE);
121  memset(theField16, ' ', FIELD16_SIZE);
122  memset(theNRef, ' ', N_REF_SIZE);
123  memset(theRevNum, ' ', REV_NUM_SIZE);
124  memset(theNSeg, ' ', N_SEG_SIZE);
125  memset(theMaxLpSeg, ' ', MAX_LP_SEG_SIZE);
126  memset(theField20, ' ', FIELD20_SIZE);
127  memset(theField21, ' ', FIELD21_SIZE);
128  memset(theSunEl, ' ', SUN_EL_SIZE);
129  memset(theSunAz, ' ', SUN_AZ_SIZE);
130 
132  theMeanGsd[MEAN_GSD_SIZE] = '\0';
133  theField3[FIELD3_SIZE] = '\0';
135  theField5[FIELD5_SIZE] = '\0';
136  theField6[FIELD6_SIZE] = '\0';
137  theField7[FIELD7_SIZE] = '\0';
138  theOblAng[OBL_ANG_SIZE] = '\0';
139  theRollAng[ROLL_ANG_SIZE] = '\0';
140  theField10[FIELD10_SIZE] = '\0';
141  theField11[FIELD11_SIZE] = '\0';
142  theField12[FIELD12_SIZE] = '\0';
143  theField13[FIELD13_SIZE] = '\0';
144  theField14[FIELD14_SIZE] = '\0';
145  theField15[FIELD15_SIZE] = '\0';
146  theField16[FIELD16_SIZE] = '\0';
147  theNRef[N_REF_SIZE] = '\0';
148  theRevNum[REV_NUM_SIZE] = '\0';
149  theNSeg[N_SEG_SIZE] = '\0';
151  theField20[FIELD20_SIZE] = '\0';
152  theField21[FIELD21_SIZE] = '\0';
153  theSunEl[SUN_EL_SIZE] = '\0';
154  theSunAz[SUN_AZ_SIZE] = '\0';
155 }
156 
158 {
159  return theAngleToNorth;
160 }
161 
163 {
164  memset(theAngleToNorth, ' ', ANGLE_TO_NORTH_SIZE);
165  memcpy(theAngleToNorth, angleToNorth.c_str(), std::min((size_t)ANGLE_TO_NORTH_SIZE, angleToNorth.length()));
166 }
167 
169 {
170  return theMeanGsd;
171 }
172 
174 {
175  ossim_float64 gsd = 0.0;
176 
178  if (s.size())
179  {
180  ossim_float64 d = s.toFloat64();
181  if ( (d != 0.0) && (ossim::isnan(d) == false) )
182  {
183  gsd = d / 12.0 * MTRS_PER_FT;
184  }
185  }
186 
187  return gsd;
188 }
189 
191 {
192  memset(theMeanGsd, ' ', MEAN_GSD_SIZE);
193  memcpy(theMeanGsd, meanGsd.c_str(), std::min((size_t)MEAN_GSD_SIZE, meanGsd.length()));
194 }
195 
197 {
198  return theField3;
199 }
200 
202 {
203  memset(theField3, ' ', FIELD3_SIZE);
204  memcpy(theField3, field3.c_str(), std::min((size_t)FIELD3_SIZE, field3.length()));
205 }
206 
208 {
209  return theDynamicRange;
210 }
211 
213 {
214  memset(theDynamicRange, ' ', DYNAMIC_RANGE_SIZE);
215  memcpy(theDynamicRange, dynamicRange.c_str(), std::min((size_t)DYNAMIC_RANGE_SIZE, dynamicRange.length()));
216 }
217 
219 {
220  return theField5;
221 }
222 
224 {
225  memset(theField5, ' ', FIELD5_SIZE);
226  memcpy(theField5, field5.c_str(), std::min((size_t)FIELD5_SIZE, field5.length()));
227 }
228 
230 {
231  return theField6;
232 }
233 
235 {
236  memset(theField6, ' ', FIELD6_SIZE);
237  memcpy(theField6, field6.c_str(), std::min((size_t)FIELD6_SIZE, field6.length()));
238 }
239 
241 {
242  return theField7;
243 }
244 
246 {
247  memset(theField7, ' ', FIELD7_SIZE);
248  memcpy(theField7, field7.c_str(), std::min((size_t)FIELD7_SIZE, field7.length()));
249 }
250 
252 {
253  return theOblAng;
254 }
255 
257 {
258  memset(theOblAng, ' ', OBL_ANG_SIZE);
259  memcpy(theOblAng, oblAng.c_str(), std::min((size_t)OBL_ANG_SIZE, oblAng.length()));
260 }
261 
263 {
264  return theRollAng;
265 }
266 
268 {
269  memset(theRollAng, ' ', ROLL_ANG_SIZE);
270  memcpy(theRollAng, rollAng.c_str(), std::min((size_t)ROLL_ANG_SIZE, rollAng.length()));
271 }
272 
274 {
275  return theField10;
276 }
277 
279 {
280  memset(theField10, ' ', FIELD10_SIZE);
281  memcpy(theField10, field10.c_str(), std::min((size_t)FIELD10_SIZE, field10.length()));
282 }
283 
285 {
286  return theField11;
287 }
288 
290 {
291  memset(theField11, ' ', FIELD11_SIZE);
292  memcpy(theField11, field11.c_str(), std::min((size_t)FIELD11_SIZE, field11.length()));
293 }
294 
296 {
297  return theField12;
298 }
299 
301 {
302  memset(theField12, ' ', FIELD12_SIZE);
303  memcpy(theField12, field12.c_str(), std::min((size_t)FIELD12_SIZE, field12.length()));
304 }
305 
307 {
308  return theField13;
309 }
310 
312 {
313  memset(theField13, ' ', FIELD13_SIZE);
314  memcpy(theField13, field13.c_str(), std::min((size_t)FIELD13_SIZE, field13.length()));
315 }
316 
318 {
319  return theField14;
320 }
321 
323 {
324  memset(theField14, ' ', FIELD14_SIZE);
325  memcpy(theField14, field14.c_str(), std::min((size_t)FIELD14_SIZE, field14.length()));
326 }
327 
329 {
330  return theField15;
331 }
332 
334 {
335  memset(theField15, ' ', FIELD15_SIZE);
336  memcpy(theField15, field15.c_str(), std::min((size_t)FIELD15_SIZE, field15.length()));
337 }
338 
340 {
341  return theField16;
342 }
343 
345 {
346  memset(theField16, ' ', FIELD16_SIZE);
347  memcpy(theField16, field16.c_str(), std::min((size_t)FIELD16_SIZE, field16.length()));
348 }
349 
351 {
352  return theNRef;
353 }
354 
356 {
357  memset(theNRef, ' ', N_REF_SIZE);
358  memcpy(theNRef, nRef.c_str(), std::min((size_t)N_REF_SIZE, nRef.length()));
359 }
360 
362 {
363  return theRevNum;
364 }
365 
367 {
368  memset(theRevNum, ' ', REV_NUM_SIZE);
369  memcpy(theRevNum, revNum.c_str(), std::min((size_t)REV_NUM_SIZE, revNum.length()));
370 }
371 
373 {
374  return theNSeg;
375 }
376 
378 {
379  memset(theNSeg, ' ', N_SEG_SIZE);
380  memcpy(theNSeg, nSeg.c_str(), std::min((size_t)N_SEG_SIZE, nSeg.length()));
381 }
382 
384 {
385  return theMaxLpSeg;
386 }
387 
389 {
390  memset(theMaxLpSeg, ' ', MAX_LP_SEG_SIZE);
391  memcpy(theMaxLpSeg, maxLpSeg.c_str(), std::min((size_t)MAX_LP_SEG_SIZE, maxLpSeg.length()));
392 }
393 
395 {
396  return theField20;
397 }
398 
400 {
401  memset(theField20, ' ', FIELD20_SIZE);
402  memcpy(theField20, field20.c_str(), std::min((size_t)FIELD20_SIZE, field20.length()));
403 }
404 
406 {
407  return theField21;
408 }
409 
411 {
412  memset(theField21, ' ', FIELD21_SIZE);
413  memcpy(theField21, field21.c_str(), std::min((size_t)FIELD21_SIZE, field21.length()));
414 }
415 
417 {
418  return theSunEl;
419 }
420 
422 {
423  memset(theSunEl, ' ', SUN_EL_SIZE);
424  memcpy(theSunEl, sunEl.c_str(), std::min((size_t)SUN_EL_SIZE, sunEl.length()));
425 }
426 
428 {
429  return theSunAz;
430 }
431 
433 {
434  memset(theSunAz, ' ', SUN_AZ_SIZE);
435  memcpy(theSunAz, sunAz.c_str(), std::min((size_t)SUN_AZ_SIZE, sunAz.length()));
436 }
437 
439  const std::string& prefix) const
440 {
441  std::string pfx = prefix;
442  pfx += getTagName();
443  pfx += ".";
444 
445  out << setiosflags(std::ios::left)
446  << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
447  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
448  << pfx << std::setw(24) << "ANGLETONORTH:" << theAngleToNorth << "\n"
449  << pfx << std::setw(24) << "MEANGSD:" << theMeanGsd << "\n"
450  << pfx << std::setw(24) << "DYNAMICRANGE:" << theDynamicRange << "\n"
451  << pfx << std::setw(24) << "OBLANG:" << theOblAng << "\n"
452  << pfx << std::setw(24) << "ROLLANG:" << theRollAng << "\n"
453  << pfx << std::setw(24) << "NREF:" << theNRef << "\n"
454  << pfx << std::setw(24) << "REVNUM:" << theRevNum << "\n"
455  << pfx << std::setw(24) << "NSEG:" << theNSeg << "\n"
456  << pfx << std::setw(24) << "MAXLPSEG:" << theMaxLpSeg << "\n"
457  << pfx << std::setw(24) << "SUNEL:" << theSunEl << "\n"
458  << pfx << std::setw(24) << "SUNAZ:" << theSunAz << "\n";
459 
460  return out;
461 }
462 
464 {
466 }
467 
469 {
470  ossimProperty* result = 0;
471 
472  if(name == ANGLETONORTH_KW)
473  {
474  result = new ossimStringProperty(name, theAngleToNorth);
475  }
476  else if(name == MEANGSD_KW)
477  {
478  result = new ossimStringProperty(name, theMeanGsd);
479  }
480  else if(name == DYNAMICRANGE_KW)
481  {
482  result = new ossimStringProperty(name, theDynamicRange);
483  }
484  else if(name == OBLANG_KW)
485  {
486  result = new ossimStringProperty(name, theOblAng);
487  }
488  else if(name == ROLLANG_KW)
489  {
490  result = new ossimStringProperty(name, theRollAng);
491  }
492  else if(name == NREF_KW)
493  {
494  result = new ossimStringProperty(name, theNRef);
495  }
496  else if(name == REVNUM_KW)
497  {
498  result = new ossimStringProperty(name, theRevNum);
499  }
500  else if(name == NSEG_KW)
501  {
502  result = new ossimStringProperty(name, theNSeg);
503  }
504  else if(name == MAXLPSEG_KW)
505  {
506  result = new ossimStringProperty(name, theMaxLpSeg);
507  }
508  else if(name == SUNEL_KW)
509  {
510  result = new ossimStringProperty(name, theSunEl);
511  }
512  else if(name == SUNAZ_KW)
513  {
514  result = new ossimStringProperty(name, theSunAz);
515  }
516  else
517  {
519  }
520 
521  return result;
522 }
523 
524 void ossimNitfUse00aTag::getPropertyNames(std::vector<ossimString>& propertyNames)const
525 {
527 
528  propertyNames.push_back(ANGLETONORTH_KW);
529  propertyNames.push_back(MEANGSD_KW);
530  propertyNames.push_back(DYNAMICRANGE_KW);
531  propertyNames.push_back(OBLANG_KW);
532  propertyNames.push_back(ROLLANG_KW);
533  propertyNames.push_back(NREF_KW);
534  propertyNames.push_back(REVNUM_KW);
535  propertyNames.push_back(NSEG_KW);
536  propertyNames.push_back(MAXLPSEG_KW);
537  propertyNames.push_back(SUNEL_KW);
538  propertyNames.push_back(SUNAZ_KW);
539 }
char theNSeg[N_SEG_SIZE+1]
FIELD: NSEG.
ossimString getField6() const
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
void setField11(const ossimString &field11)
void setField16(const ossimString &field16)
ossimString getSunEl() const
ossimString getField12() const
char theMaxLpSeg[MAX_LP_SEG_SIZE+1]
FIELD: MAXLPSEG.
void setField6(const ossimString &field6)
void setAngleToNorth(const ossimString &angleToNorth)
void setNSeg(const ossimString &nSeg)
RTTI_DEF1(ossimNitfUse00aTag, "ossimNitfUse00aTag", ossimNitfRegisteredTag)
ossimString getField16() const
char theField15[FIELD15_SIZE+1]
FIELD: FIELD15.
ossimString getField13() const
char theRevNum[REV_NUM_SIZE+1]
FIELD: REVNUM.
void setField15(const ossimString &field15)
char theField14[FIELD14_SIZE+1]
FIELD: FIELD14.
ossimString getRollAng() const
char theField3[FIELD3_SIZE+1]
FIELD: FIELD3.
char theNRef[N_REF_SIZE+1]
FIELD: NREF.
char theField12[FIELD12_SIZE+1]
FIELD: FIELD12.
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.
char theField11[FIELD11_SIZE+1]
FIELD: FIELD11.
ossimString getField11() const
void setSunAz(const ossimString &sunAz)
char theMeanGsd[MEAN_GSD_SIZE+1]
FIELD: MEANGSD.
ossimString getMaxLpSeg() const
ossimString getSunAz() const
char theField6[FIELD6_SIZE+1]
FIELD: FIELD6.
char theField13[FIELD13_SIZE+1]
FIELD: FIELD13.
virtual void writeStream(std::ostream &out)
ossimString getField10() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
char theField5[FIELD5_SIZE+1]
FIELD: FIELD5.
double ossim_float64
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
char theField7[FIELD7_SIZE+1]
FIELD: FIELD7.
ossimString getDynamicRange() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setNRef(const ossimString &nRef)
void setDynamicRange(const ossimString &dynamicRange)
std::string::size_type length() const
Definition: ossimString.h:408
char theField21[FIELD21_SIZE+1]
FIELD: FIELD21.
std::string::size_type size() const
Definition: ossimString.h:405
void setField12(const ossimString &field12)
ossim_float64 toFloat64() const
void setRevNum(const ossimString &revNum)
void setField20(const ossimString &field20)
void setField10(const ossimString &field10)
virtual void parseStream(std::istream &in)
ossimString getMeanGsd() const
ossimString getField5() const
virtual void clearFields()
char theRollAng[ROLL_ANG_SIZE+1]
FIELD: ROLLANG.
#define MTRS_PER_FT
char theField10[FIELD10_SIZE+1]
FIELD: FIELD10.
void setField21(const ossimString &field21)
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theAngleToNorth[ANGLE_TO_NORTH_SIZE+1]
FIELD: ANGLETONORTH.
ossimString getField20() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setRollAng(const ossimString &rollAng)
char theSunEl[SUN_EL_SIZE+1]
FIELD: SUNEL.
ossimString getNSeg() const
ossimString getOblAng() const
void setMaxLpSeg(const ossimString &maxLpSeg)
ossimString getField7() const
char theOblAng[OBL_ANG_SIZE+1]
FIELD: OBLANG.
void setSunEl(const ossimString &sunEl)
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
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 setField13(const ossimString &field13)
ossimString getField15() const
char theDynamicRange[DYNAMIC_RANGE_SIZE+1]
FIELD: DYNAMICRANGE.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void setField5(const ossimString &field5)
ossimString getField3() const
char theField20[FIELD20_SIZE+1]
FIELD: FIELD20.
void setField7(const ossimString &field7)
void setMeanGsd(const ossimString &meanGsd)
ossimString getRevNum() const
ossimString getNRef() const
ossim_float64 getMeanGsdInMeters() const
ossimString getField14() const
ossimString getField21() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
char theSunAz[SUN_AZ_SIZE+1]
FIELD: SUNAZ.
void setField3(const ossimString &field3)
void setField14(const ossimString &field14)
ossimString getAngleToNorth() const
#define min(a, b)
Definition: auxiliary.h:75
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91
void setOblAng(const ossimString &oblAng)
char theField16[FIELD16_SIZE+1]
FIELD: FIELD16.