OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfPiaimcTag.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: PIAIMC tag class declaration.
10 //
11 // "Profile for Imagery Access Image Support Extensions"
12 //
13 // See document STDI-0002 Table 6-1 for more info.
14 //
15 // http://164.214.2.51/ntb/baseline/docs/stdi0002/final.pdf
16 //
17 //----------------------------------------------------------------------------
18 // $Id: ossimNitfPiaimcTag.cpp 22013 2012-12-19 17:37:20Z dburken $
19 
20 #include <cstring> /* for memcpy */
21 #include <iostream>
22 #include <iomanip>
23 
25 #include <ossim/base/ossimString.h>
27 #include <ossim/base/ossimCommon.h>
28 
29 static const ossimString CLOUDCVR_KW = "CLOUDCVR";
30 static const ossimString SRP_KW = "SRP";
31 static const ossimString SENSMODE_KW = "SENSMODE";
32 static const ossimString SENSNAME_KW = "SENSNAME";
33 static const ossimString SOURCE_KW = "SOURCE";
34 static const ossimString COMGEN_KW = "COMGEN";
35 static const ossimString SUBQUAL_KW = "SUBQUAL";
36 static const ossimString PIAMSNNUM_KW = "PIAMSNNUM";
37 static const ossimString CAMSPECS_KW = "CAMSPECS";
38 static const ossimString PROJID_KW = "PROJID";
39 static const ossimString GENERATION_KW = "GENERATION";
40 static const ossimString ESD_KW = "ESD";
41 static const ossimString OTHERCOND_KW = "OTHERCOND";
42 static const ossimString MEANGSD_KW = "MEANGSD";
43 static const ossimString IDATUM_KW = "IDATUM";
44 static const ossimString IELLIP_KW = "IELLIP";
45 static const ossimString PREPROC_KW = "PREPROC";
46 static const ossimString IPROJ_KW = "IPROJ";
47 static const ossimString SATTRACK_KW = "SATTRACK";
48 
50  "ossimNitfPiaimcTag",
52 
54  : ossimNitfRegisteredTag(std::string("PIAIMC"), 362)
55 {
56  clearFields();
57 }
58 
60 {
61  clearFields();
62 
63  in.read(theCloudcvr, CLOUDCVR_SIZE);
64  in.read(theSrp, SRP_SIZE);
65  in.read(thesSensmode, SENSMODE_SIZE);
66  in.read(theSensname, SENSNAME_SIZE);
67  in.read(theSource, SOURCE_SIZE);
68  in.read(theComgen, COMGEN_SIZE);
69  in.read(theSubqual, SUBQUAL_SIZE);
70  in.read(thePiamsnnum, PIAMSNNUM_SIZE);
71  in.read(theCamspecs, CAMSPECS_SIZE);
72  in.read(theProjid, PROJID_SIZE);
74  in.read(theEsd, ESD_SIZE);
75  in.read(theOthercond, OTHERCOND_SIZE);
76  in.read(theMeanGsd, MEANGSD_SIZE);
77  in.read(theIdatum, IDATUM_SIZE);
78  in.read(theIellip, IELLIP_SIZE);
79  in.read(thePreproc, PREPROC_SIZE);
80  in.read(theIproj, IPROJ_SIZE);
81  in.read(theSattrack, SATTRACK_SIZE);
82 }
83 
85 {
86  out.write(theCloudcvr, CLOUDCVR_SIZE);
87  out.write(theSrp, SRP_SIZE);
88  out.write(thesSensmode, SENSMODE_SIZE);
89  out.write(theSensname, SENSNAME_SIZE);
90  out.write(theSource, SOURCE_SIZE);
91  out.write(theComgen, COMGEN_SIZE);
92  out.write(theSubqual, SUBQUAL_SIZE);
93  out.write(thePiamsnnum, PIAMSNNUM_SIZE);
94  out.write(theCamspecs, CAMSPECS_SIZE);
95  out.write(theProjid, PROJID_SIZE);
96  out.write(theGeneration, GENERATION_SIZE);
97  out.write(theEsd, ESD_SIZE);
98  out.write(theOthercond, OTHERCOND_SIZE);
99  out.write(theMeanGsd, MEANGSD_SIZE);
100  out.write(theIdatum, IDATUM_SIZE);
101  out.write(theIellip, IELLIP_SIZE);
102  out.write(thePreproc, PREPROC_SIZE);
103  out.write(theIproj, IPROJ_SIZE);
104  out.write(theSattrack, SATTRACK_SIZE);
105 }
106 
108 {
109  memcpy(theCloudcvr, "999", CLOUDCVR_SIZE);
110  memset(theSrp, ' ', SRP_SIZE);
111  memset(thesSensmode, ' ', SENSMODE_SIZE);
112  memset(theSensname, ' ', SENSNAME_SIZE);
113  memset(theSource, ' ', SOURCE_SIZE);
114  memset(theComgen, ' ', COMGEN_SIZE);
115  memset(theSubqual, ' ', SUBQUAL_SIZE);
116  memset(thePiamsnnum, ' ', PIAMSNNUM_SIZE);
117  memset(theCamspecs, ' ', CAMSPECS_SIZE);
118  memset(theProjid, ' ', PROJID_SIZE);
119  memset(theGeneration, ' ', GENERATION_SIZE);
120  memset(theEsd, ' ', ESD_SIZE);
121  memset(theOthercond, ' ', OTHERCOND_SIZE);
122  memset(theMeanGsd, ' ', MEANGSD_SIZE);
123  memset(theIdatum, ' ', IDATUM_SIZE);
124  memset(theIellip, ' ', IELLIP_SIZE);
125  memset(thePreproc, ' ', PREPROC_SIZE);
126  memset(theIproj, ' ', IPROJ_SIZE);
127  memset(theSattrack, ' ', SATTRACK_SIZE);
128 
129  theCloudcvr[CLOUDCVR_SIZE] = '\0';
130  theSrp[SRP_SIZE] = '\0';
131  thesSensmode[SENSMODE_SIZE] = '\0';
132  theSensname[SENSNAME_SIZE] = '\0';
133  theSource[SOURCE_SIZE] = '\0';
134  theComgen[COMGEN_SIZE] = '\0';
135  theSubqual[SUBQUAL_SIZE] = '\0';
137  theCamspecs[CAMSPECS_SIZE] = '\0';
138  theProjid[PROJID_SIZE] = '\0';
140  theEsd[ESD_SIZE] = '\0';
142  theMeanGsd[MEANGSD_SIZE] = '\0';
143  theIdatum[IDATUM_SIZE] = '\0';
144  theIellip[IELLIP_SIZE] = '\0';
145  thePreproc[PREPROC_SIZE] = '\0';
146  theIproj[IPROJ_SIZE] = '\0';
147  theSattrack[SATTRACK_SIZE] = '\0';
148 }
149 
151  const std::string& prefix) const
152 {
153  std::string pfx = prefix;
154  pfx += getTagName();
155  pfx += ".";
156 
157  out << setiosflags(std::ios::left)
158  << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
159  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
160  << pfx << std::setw(24) << "CLOUDCVR:" << theCloudcvr << "\n"
161  << pfx << std::setw(24) << "SRP:" << theSrp << "\n"
162  << pfx << std::setw(24) << "SENSMODE:" << thesSensmode << "\n"
163  << pfx << std::setw(24) << "SENSNAME:" << theSensname << "\n"
164  << pfx << std::setw(24) << "SOURCE:" << theSource << "\n"
165  << pfx << std::setw(24) << "COMGEN:" << theComgen << "\n"
166  << pfx << std::setw(24) << "SUBQUAL:" << theSubqual << "\n"
167  << pfx << std::setw(24) << "PIAMSNNUM:" << thePiamsnnum << "\n"
168  << pfx << std::setw(24) << "CAMSPECS:" << theCamspecs << "\n"
169  << pfx << std::setw(24) << "PROJID:" << theProjid << "\n"
170  << pfx << std::setw(24) << "GENERATION:" << theGeneration << "\n"
171  << pfx << std::setw(24) << "ESD:" << theEsd << "\n"
172  << pfx << std::setw(24) << "OTHERCOND:" << theOthercond << "\n"
173  << pfx << std::setw(24) << "MEANGSD:" << theMeanGsd << "\n"
174  << pfx << std::setw(24) << "IDATUM:" << theIdatum << "\n"
175  << pfx << std::setw(24) << "IELLIP:" << theIellip << "\n"
176  << pfx << std::setw(24) << "PREPROC:" << thePreproc << "\n"
177  << pfx << std::setw(24) << "IPROJ:" << theIproj << "\n"
178  << pfx << std::setw(24) << "SATTRACK:" << theSattrack << "\n";
179 
180  return out;
181 }
182 
184 {
185  return ossimString(theCloudcvr);
186 }
187 
189 {
190  return ossimString(theSrp);
191 }
192 
194 {
195  return ossimString(thesSensmode);
196 }
197 
199 {
200  return ossimString(theSensname);
201 }
202 
204 {
205  return ossimString(theSource);
206 }
207 
209 {
210  return ossimString(theComgen);
211 }
212 
214 {
215  return ossimString(theSubqual);
216 }
217 
219 {
220  return ossimString(thePiamsnnum);
221 }
222 
224 {
225  return ossimString(theCamspecs);
226 }
227 
229 {
230  return ossimString(theProjid);
231 }
232 
234 {
235  return ossimString(theGeneration);
236 }
237 
239 {
240  return ossimString(theEsd);
241 }
242 
244 {
245  return ossimString(theOthercond);
246 }
247 
249 {
250  return ossimString(theMeanGsd);
251 }
252 
254 {
255  ossim_float64 gsd = 0.0;
256 
258  if (s.size())
259  {
260  ossim_float64 d = s.toFloat64();
261  if ( (d != 0.0) && (ossim::isnan(d) == false) )
262  {
263  gsd = d / 12.0 * MTRS_PER_FT;
264  }
265  }
266 
267  return gsd;
268 }
269 
271 {
272  return ossimString(theIdatum);
273 }
274 
276 {
277  return ossimString(theIellip);
278 }
279 
281 {
282  return ossimString(thePreproc);
283 }
284 
286 {
287  return ossimString(theIproj);
288 }
289 
291 {
292  return ossimString(theSattrack);
293 }
294 
296 {
298 }
299 
301 {
302  ossimProperty* result = 0;
303 
304  if(name == CLOUDCVR_KW)
305  {
306  result = new ossimStringProperty(name, theCloudcvr);
307  }
308  else if(name == SRP_KW)
309  {
310  result = new ossimStringProperty(name, theSrp);
311  }
312  else if(name == SENSMODE_KW)
313  {
314  result = new ossimStringProperty(name, thesSensmode);
315  }
316  else if(name == SENSNAME_KW)
317  {
318  result = new ossimStringProperty(name, theSensname);
319  }
320  else if(name == SOURCE_KW)
321  {
322  result = new ossimStringProperty(name, theSource);
323  }
324  else if(name == COMGEN_KW)
325  {
326  result = new ossimStringProperty(name, theComgen);
327  }
328  else if(name == SUBQUAL_KW)
329  {
330  result = new ossimStringProperty(name, theSubqual);
331  }
332  else if(name == PIAMSNNUM_KW)
333  {
334  result = new ossimStringProperty(name, thePiamsnnum);
335  }
336  else if(name == CAMSPECS_KW)
337  {
338  result = new ossimStringProperty(name, theCamspecs);
339  }
340  else if(name == PROJID_KW)
341  {
342  result = new ossimStringProperty(name, theProjid);
343  }
344  else if(name == GENERATION_KW)
345  {
346  result = new ossimStringProperty(name, theGeneration);
347  }
348  else if(name == ESD_KW)
349  {
350  result = new ossimStringProperty(name, theEsd);
351  }
352  else if(name == OTHERCOND_KW)
353  {
354  result = new ossimStringProperty(name, theOthercond);
355  }
356  else if(name == MEANGSD_KW)
357  {
358  result = new ossimStringProperty(name, theMeanGsd);
359  }
360  else if(name == IDATUM_KW)
361  {
362  result = new ossimStringProperty(name, theIdatum);
363  }
364  else if(name == IELLIP_KW)
365  {
366  result = new ossimStringProperty(name, theIellip);
367  }
368  else if(name == PREPROC_KW)
369  {
370  result = new ossimStringProperty(name, thePreproc);
371  }
372  else if(name == IPROJ_KW)
373  {
374  result = new ossimStringProperty(name, theIproj);
375  }
376  else if(name == SATTRACK_KW)
377  {
378  result = new ossimStringProperty(name, theSattrack);
379  }
380  else
381  {
383  }
384 
385  return result;
386 }
387 
388 void ossimNitfPiaimcTag::getPropertyNames(std::vector<ossimString>& propertyNames)const
389 {
391 
392  propertyNames.push_back(CLOUDCVR_KW);
393  propertyNames.push_back(SRP_KW);
394  propertyNames.push_back(SENSMODE_KW);
395  propertyNames.push_back(SENSNAME_KW);
396  propertyNames.push_back(SOURCE_KW);
397  propertyNames.push_back(COMGEN_KW);
398  propertyNames.push_back(SUBQUAL_KW);
399  propertyNames.push_back(PIAMSNNUM_KW);
400  propertyNames.push_back(CAMSPECS_KW);
401  propertyNames.push_back(PROJID_KW);
402  propertyNames.push_back(GENERATION_KW);
403  propertyNames.push_back(ESD_KW);
404  propertyNames.push_back(OTHERCOND_KW);
405  propertyNames.push_back(MEANGSD_KW);
406  propertyNames.push_back(IDATUM_KW);
407  propertyNames.push_back(IELLIP_KW);
408  propertyNames.push_back(PREPROC_KW);
409  propertyNames.push_back(IPROJ_KW);
410  propertyNames.push_back(SATTRACK_KW);
411 }
char theSensname[SENSNAME_SIZE+1]
FIELD: SENSNAME.
char thePiamsnnum[PIAMSNNUM_SIZE+1]
FIELD: PIAMSNNUM.
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
ossimString getSensmodeString() const
char theIellip[IELLIP_SIZE+1]
FIELD: IELLIP.
ossimString getSourceString() const
char theSattrack[SATTRACK_SIZE+1]
FIELD: SATTRACK.
RTTI_DEF1(ossimNitfPiaimcTag, "ossimNitfPiaimcTag", ossimNitfRegisteredTag)
virtual void clearFields()
Clears all string fields within the record to some default nothingness.
ossimString getSensnameString() const
virtual void writeStream(std::ostream &out)
Write method.
ossimNitfPiaimcTag()
default constructor
ossimString getIdatumString() const
char thesSensmode[SENSMODE_SIZE+1]
FIELD: SENSMODE.
ossimString getIprojString() const
char theIproj[IPROJ_SIZE+1]
FIELD: IPROJ.
ossimString getProjidString() const
ossimString getIellipString() const
char theProjid[PROJID_SIZE+1]
FIELD: PROJID.
char theSubqual[SUBQUAL_SIZE+1]
FIELD: SUBQUAL.
char theSrp[SRP_SIZE+1]
FIELD: SRP.
ossimString getSubqualString() const
double ossim_float64
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
ossimString getSrpString() const
ossimString getPiamsnnumString() const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
std::string::size_type size() const
Definition: ossimString.h:405
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.
ossim_float64 toFloat64() const
char thePreproc[PREPROC_SIZE+1]
FIELD: PREPROC.
ossimString getComgenString() const
ossimString getMeadGsdString() const
ossimString getCamspecsString() const
ossimString getPreprocString() const
ossimString getCloudcvrString() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
#define MTRS_PER_FT
ossimString getOthercondString() const
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
char theIdatum[IDATUM_SIZE+1]
FIELD: IDATUM.
virtual void parseStream(std::istream &in)
Parse method.
char theComgen[COMGEN_SIZE+1]
FIELD: COMGEN.
ossim_float64 getMeanGsdInMeters() const
char theCloudcvr[CLOUDCVR_SIZE+1]
FIELD: CLOUDCVR.
char theSource[SOURCE_SIZE+1]
FIELD: SOURCE.
char theMeanGsd[MEANGSD_SIZE+1]
FIELD: MEANGSD.
char theOthercond[OTHERCOND_SIZE+1]
FIELD: OTHERCOND.
char theCamspecs[CAMSPECS_SIZE+1]
FIELD: CAMSPECS.
ossimString getSattrackString() const
ossimString getGenerationString() const
ossimString getEsdString() const
char theGeneration[GENERATION_SIZE+1]
FIELD: GENERATION.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
char theEsd[ESD_SIZE+1]
FIELD: ESD.
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91