OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfStdidcTag.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 data class for STDIDC - Standard ID extension.
10 //
11 // See: STDI-000_v2.1 Table 7-3 for detailed description.
12 //
13 //********************************************************************
14 // $Id: ossimNitfStdidcTag.cpp 22013 2012-12-19 17:37:20Z dburken $
15 
16 #include <iostream>
17 #include <iomanip>
20 
22 static const ossimString ACQDATE_KW = "ACQDATE";
23 static const ossimString MISSION_KW = "MISSION";
24 static const ossimString PASS_KW = "PASS";
25 static const ossimString OPNUM_KW = "OPNUM";
26 static const ossimString STARTSEGMENT_KW = "STARTSEGMENT";
27 static const ossimString REPRONUM_KW = "REPRONUM";
28 static const ossimString REPLAYREGEN_KW = "REPLAYREGEN";
29 static const ossimString BLANKFILL_KW = "BLANKFILL";
30 static const ossimString STARTCOLUMN_KW = "STARTCOLUMN";
31 static const ossimString STARTROW_KW = "STARTROW";
32 static const ossimString ENDSEGMENT_KW = "ENDSEGMENT";
33 static const ossimString ENDCOLUMN_KW = "ENDCOLUMN";
34 static const ossimString ENDROW_KW = "ENDROW";
35 static const ossimString COUNTRY_KW = "COUNTRY";
36 static const ossimString WAC_KW = "WAC";
37 static const ossimString LOCATION_KW = "LOCATION";
38 
39 
41  : ossimNitfRegisteredTag(std::string("STDIDC"), 89)
42 {
43  clearFields();
44 }
45 
47 {
48 }
49 
51 {
52  clearFields();
53 
54  in.read(theAcqDate, ACQ_DATE_SIZE);
55  in.read(theMission, MISSION_SIZE);
56  in.read(thePass, PASS_SIZE);
57  in.read(theOpNum, OP_NUM_SIZE);
59  in.read(theReproNum, REPRO_NUM_SIZE);
61  in.read(theBlankFill, BLANK_FILL_SIZE);
63  in.read(theStartRow, START_ROW_SIZE);
65  in.read(theEndColumn, END_COLUMN_SIZE);
66  in.read(theEndRow, END_ROW_SIZE);
67  in.read(theCountry, COUNTRY_SIZE);
68  in.read(theWac, WAC_SIZE);
69  in.read(theLocation, LOCATION_SIZE);
70  in.read(theField17, FIELD17_SIZE);
71  in.read(theField18, FIELD18_SIZE);
72 }
73 
75 {
76  out.write(theAcqDate, ACQ_DATE_SIZE);
77  out.write(theMission, MISSION_SIZE);
78  out.write(thePass, PASS_SIZE);
79  out.write(theOpNum, OP_NUM_SIZE);
81  out.write(theReproNum, REPRO_NUM_SIZE);
83  out.write(theBlankFill, BLANK_FILL_SIZE);
85  out.write(theStartRow, START_ROW_SIZE);
86  out.write(theEndSegment, END_SEGMENT_SIZE);
87  out.write(theEndColumn, END_COLUMN_SIZE);
88  out.write(theEndRow, END_ROW_SIZE);
89  out.write(theCountry, COUNTRY_SIZE);
90  out.write(theWac, WAC_SIZE);
91  out.write(theLocation, LOCATION_SIZE);
92  out.write(theField17, FIELD17_SIZE);
93  out.write(theField18, FIELD18_SIZE);
94 }
95 
97 {
98  memset(theAcqDate, ' ', ACQ_DATE_SIZE);
99  memset(theMission, ' ', MISSION_SIZE);
100  memset(thePass, ' ', PASS_SIZE);
101  memset(theOpNum, ' ', OP_NUM_SIZE);
102  memset(theStartSegment, ' ', START_SEGMENT_SIZE);
103  memset(theReproNum, ' ', REPRO_NUM_SIZE);
104  memset(theReplayRegen, ' ', REPLAY_REGEN_SIZE);
105  memset(theBlankFill, ' ', BLANK_FILL_SIZE);
106  memset(theStartColumn, ' ', START_COLUMN_SIZE);
107  memset(theStartRow, ' ', START_ROW_SIZE);
108  memset(theEndSegment, ' ', END_SEGMENT_SIZE);
109  memset(theEndColumn, ' ', END_COLUMN_SIZE);
110  memset(theEndRow, ' ', END_ROW_SIZE);
111  memset(theCountry, ' ', COUNTRY_SIZE);
112  memset(theWac, ' ', WAC_SIZE);
113  memset(theLocation, ' ', LOCATION_SIZE);
114  memset(theField17, ' ', FIELD17_SIZE);
115  memset(theField18, ' ', FIELD18_SIZE);
116 
117  theAcqDate[ACQ_DATE_SIZE] = '\0';
118  theMission[MISSION_SIZE] = '\0';
119  thePass[PASS_SIZE] = '\0';
120  theOpNum[OP_NUM_SIZE] = '\0';
122  theReproNum[REPRO_NUM_SIZE] = '\0';
126  theStartRow[START_ROW_SIZE] = '\0';
129  theEndRow[END_ROW_SIZE] = '\0';
130  theCountry[COUNTRY_SIZE] = '\0';
131  theWac[WAC_SIZE] = '\0';
132  theLocation[LOCATION_SIZE] = '\0';
133  theField17[FIELD17_SIZE] = '\0';
134  theField18[FIELD18_SIZE] = '\0';
135 }
136 
138 {
139  return ossimString(theAcqDate);
140 }
141 
143 {
144  memset(theAcqDate, ' ', ACQ_DATE_SIZE);
145  memcpy(theAcqDate, acqDate.c_str(), std::min((size_t)ACQ_DATE_SIZE, acqDate.length()));
146 }
147 
149 {
150  return ossimString(theMission);
151 }
152 
154 {
155  memset(theMission, ' ', MISSION_SIZE);
156  memcpy(theMission, mission.c_str(), std::min((size_t)MISSION_SIZE, mission.length()));
157 }
158 
160 {
161  return ossimString(thePass);
162 }
163 
165 {
166  memset(thePass, ' ', PASS_SIZE);
167  memcpy(thePass, pass.c_str(), std::min((size_t)PASS_SIZE, pass.length()));
168 }
169 
171 {
172  return ossimString(theOpNum);
173 }
174 
176 {
177  memset(theOpNum, ' ', OP_NUM_SIZE);
178  memcpy(theOpNum, opNum.c_str(), std::min((size_t)OP_NUM_SIZE, opNum.length()));
179 }
180 
182 {
184 }
185 
187 {
188  memset(theStartSegment, ' ', START_SEGMENT_SIZE);
189  memcpy(theStartSegment, startSegment.c_str(), std::min((size_t)START_SEGMENT_SIZE, startSegment.length()));
190 }
191 
193 {
194  return ossimString(theReproNum);
195 }
196 
198 {
199  memset(theReproNum, ' ', REPRO_NUM_SIZE);
200  memcpy(theReproNum, reproNum.c_str(), std::min((size_t)REPRO_NUM_SIZE, reproNum.length()));
201 }
202 
204 {
205  return ossimString(theReplayRegen);
206 }
207 
209 {
210  memset(theReplayRegen, ' ', REPLAY_REGEN_SIZE);
211  memcpy(theReplayRegen, replayRegen.c_str(), std::min((size_t)REPLAY_REGEN_SIZE, replayRegen.length()));
212 }
213 
215 {
216  return ossimString(theBlankFill);
217 }
218 
220 {
221  memset(theBlankFill, ' ', BLANK_FILL_SIZE);
222  memcpy(theBlankFill, blankFill.c_str(), std::min((size_t)BLANK_FILL_SIZE, blankFill.length()));
223 }
224 
226 {
227  return ossimString(theStartColumn);
228 }
229 
231 {
232  memset(theStartColumn, ' ', START_COLUMN_SIZE);
233  memcpy(theStartColumn, startColumn.c_str(), std::min((size_t)START_COLUMN_SIZE, startColumn.length()));
234 }
235 
237 {
238  return ossimString(theStartRow);
239 }
240 
242 {
243  memset(theStartRow, ' ', START_ROW_SIZE);
244  memcpy(theStartRow, startRow.c_str(), std::min((size_t)START_ROW_SIZE, startRow.length()));
245 }
246 
248 {
249  return ossimString(theEndSegment);
250 }
251 
253 {
254  memset(theEndSegment, ' ', END_SEGMENT_SIZE);
255  memcpy(theEndSegment, endSegment.c_str(), std::min((size_t)END_SEGMENT_SIZE, endSegment.length()));
256 }
257 
259 {
260  return ossimString(theEndColumn);
261 }
262 
264 {
265  memset(theEndColumn, ' ', END_COLUMN_SIZE);
266  memcpy(theEndColumn, endColumn.c_str(), std::min((size_t)END_COLUMN_SIZE, endColumn.length()));
267 }
268 
270 {
271  return ossimString(theEndRow);
272 }
273 
275 {
276  memset(theEndRow, ' ', END_ROW_SIZE);
277  memcpy(theEndRow, endRow.c_str(), std::min((size_t)END_ROW_SIZE, endRow.length()));
278 }
279 
281 {
282  return ossimString(theCountry);
283 }
284 
286 {
287  memset(theCountry, ' ', COUNTRY_SIZE);
288  memcpy(theCountry, country.c_str(), std::min((size_t)COUNTRY_SIZE, country.length()));
289 }
290 
292 {
293  return ossimString(theWac);
294 }
295 
297 {
298  memset(theWac, ' ', WAC_SIZE);
299  memcpy(theWac, wac.c_str(), std::min((size_t)WAC_SIZE, wac.length()));
300 }
301 
303 {
304  return ossimString(theLocation);
305 }
306 
308 {
309  memset(theLocation, ' ', LOCATION_SIZE);
310  memcpy(theLocation, location.c_str(), std::min((size_t)LOCATION_SIZE, location.length()));
311 }
312 
314 {
315  return ossimString(theField17);
316 }
317 
319 {
320  memset(theField17, ' ', FIELD17_SIZE);
321  memcpy(theField17, field17.c_str(), std::min((size_t)FIELD17_SIZE, field17.length()));
322 }
323 
325 {
326  return ossimString(theField18);
327 }
328 
330 {
331  memset(theField18, ' ', FIELD18_SIZE);
332  memcpy(theField18, field18.c_str(), std::min((size_t)FIELD18_SIZE, field18.length()));
333 }
334 
336  const std::string& prefix) const
337 {
338  std::string pfx = prefix;
339  pfx += getTagName();
340  pfx += ".";
341 
342  out << setiosflags(std::ios::left)
343  << pfx << std::setw(24) << "CETAG:"
344  << getTagName() << "\n"
345  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
346  << pfx << std::setw(24) << "ACQDATE:" << theAcqDate << "\n"
347  << pfx << std::setw(24) << "MISSION:" << theMission << "\n"
348  << pfx << std::setw(24) << "PASS:" << thePass << "\n"
349  << pfx << std::setw(24) << "OPNUM:" << theOpNum << "\n"
350  << pfx << std::setw(24) << "STARTSEGMENT:" << theStartSegment << "\n"
351  << pfx << std::setw(24) << "REPRONUM:" << theReproNum << "\n"
352  << pfx << std::setw(24) << "REPLAYREGEN:" << theReplayRegen << "\n"
353  << pfx << std::setw(24) << "STARTCOLUMN:" << theStartColumn << "\n"
354  << pfx << std::setw(24) << "STARTROW:" << theStartRow << "\n"
355  << pfx << std::setw(24) << "ENDSEGMENT:" << theEndSegment << "\n"
356  << pfx << std::setw(24) << "ENDCOLUMN:" << theEndColumn << "\n"
357  << pfx << std::setw(24) << "ENDROW:" << theEndRow << "\n"
358  << pfx << std::setw(24) << "COUNTRY:" << theCountry << "\n"
359  << pfx << std::setw(24) << "WAC:" << theWac << "\n"
360  << pfx << std::setw(24) << "LOCATION:" << theLocation << "\n";
361 
362  return out;
363 }
364 
366 {
368 }
369 
371 {
372  ossimProperty* result = 0;
373 
374  if(name == ACQDATE_KW)
375  {
376  result = new ossimStringProperty(name, theAcqDate);
377  }
378  else if(name == MISSION_KW)
379  {
380  result = new ossimStringProperty(name, theMission);
381  }
382  else if(name == PASS_KW)
383  {
384  result = new ossimStringProperty(name, thePass);
385  }
386  else if(name == OPNUM_KW)
387  {
388  result = new ossimStringProperty(name, theOpNum);
389  }
390  else if(name == STARTSEGMENT_KW)
391  {
392  result = new ossimStringProperty(name, theStartSegment);
393  }
394  else if(name == REPRONUM_KW)
395  {
396  result = new ossimStringProperty(name, theReproNum);
397  }
398  else if(name == REPLAYREGEN_KW)
399  {
400  result = new ossimStringProperty(name, theReplayRegen);
401  }
402  else if(name == BLANKFILL_KW)
403  {
404  result = new ossimStringProperty(name, theBlankFill);
405  }
406  else if(name == STARTCOLUMN_KW)
407  {
408  result = new ossimStringProperty(name, theStartColumn);
409  }
410  else if(name == STARTROW_KW)
411  {
412  result = new ossimStringProperty(name, theStartRow);
413  }
414  else if(name == ENDSEGMENT_KW)
415  {
416  result = new ossimStringProperty(name, theEndSegment);
417  }
418  else if(name == ENDCOLUMN_KW)
419  {
420  result = new ossimStringProperty(name, theEndColumn);
421  }
422  else if(name == ENDROW_KW)
423  {
424  result = new ossimStringProperty(name, theEndRow);
425  }
426  else if(name == COUNTRY_KW)
427  {
428  result = new ossimStringProperty(name,theCountry );
429  }
430  else if(name == WAC_KW)
431  {
432  result = new ossimStringProperty(name, theWac);
433  }
434  else if(name == LOCATION_KW)
435  {
436  result = new ossimStringProperty(name, theLocation);
437  }
438  else
439  {
441  }
442 
443  return result;
444 }
445 
446 void ossimNitfStdidcTag::getPropertyNames(std::vector<ossimString>& propertyNames)const
447 {
449 
450  propertyNames.push_back(ACQDATE_KW);
451  propertyNames.push_back(MISSION_KW);
452  propertyNames.push_back(PASS_KW);
453  propertyNames.push_back(OPNUM_KW);
454  propertyNames.push_back(STARTSEGMENT_KW);
455  propertyNames.push_back(REPRONUM_KW);
456  propertyNames.push_back(REPLAYREGEN_KW);
457  propertyNames.push_back(BLANKFILL_KW);
458  propertyNames.push_back(STARTCOLUMN_KW);
459  propertyNames.push_back(STARTROW_KW);
460  propertyNames.push_back(ENDSEGMENT_KW);
461  propertyNames.push_back(ENDCOLUMN_KW);
462  propertyNames.push_back(ENDROW_KW);
463  propertyNames.push_back(COUNTRY_KW);
464  propertyNames.push_back(WAC_KW);
465  propertyNames.push_back(LOCATION_KW);
466 
467 }
468 
ossimString getAcqDate() const
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
virtual void clearFields()
ossimString getStartRow() const
ossimString getMission() const
ossimString getWac() const
virtual void setProperty(ossimRefPtr< ossimProperty > property)
char theAcqDate[ACQ_DATE_SIZE+1]
FIELD: ACQDATE.
ossimString getField17() const
ossimString getStartSegment() const
char theMission[MISSION_SIZE+1]
FIELD: MISSION.
virtual void parseStream(std::istream &in)
char theBlankFill[BLANK_FILL_SIZE+1]
FIELD: BLANKFILL.
char theReplayRegen[REPLAY_REGEN_SIZE+1]
FIELD: REPLAYREGEN.
void setStartColumn(ossimString startColumn)
void setAcqDate(ossimString acqDate)
char theReproNum[REPRO_NUM_SIZE+1]
FIELD: REPRONUM.
RTTI_DEF1(ossimNitfStdidcTag, "ossimNitfStdidcTag", ossimNitfRegisteredTag)
void setField17(ossimString field17)
char theStartColumn[START_COLUMN_SIZE+1]
FIELD: STARTCOLUMN.
char theLocation[LOCATION_SIZE+1]
FIELD: LOCATION.
char theField17[FIELD17_SIZE+1]
FIELD: FIELD17.
void setOpNum(ossimString opNum)
ossimString getField18() const
void setPass(ossimString pass)
char thePass[PASS_SIZE+1]
FIELD: PASS.
char theCountry[COUNTRY_SIZE+1]
FIELD: COUNTRY.
char theOpNum[OP_NUM_SIZE+1]
FIELD: OPNUM.
void setField18(ossimString field18)
ossimString getCountry() const
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
void setEndRow(ossimString endRow)
void setWac(ossimString wac)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
void setCountry(ossimString country)
std::string::size_type length() const
Definition: ossimString.h:408
void setBlankFill(ossimString blankFill)
ossimString getEndRow() const
ossimString getEndColumn() const
ossimString getReplayRegen() const
ossimString getOpNum() const
void setStartSegment(ossimString startSegment)
char theStartRow[START_ROW_SIZE+1]
FIELD: STARTROW.
virtual void writeStream(std::ostream &out)
void setStartRow(ossimString startRow)
void setMission(ossimString mission)
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theEndRow[END_ROW_SIZE+1]
FIELD: ENDROW.
void setEndSegment(ossimString endSegment)
void setReproNum(ossimString reproNum)
char theWac[WAC_SIZE+1]
FIELD: WAC.
char theEndColumn[END_COLUMN_SIZE+1]
FIELD: ENDCOLUMN.
char theField18[FIELD18_SIZE+1]
FIELD: FIELD18.
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
ossimString getEndSegment() const
ossimString getPass() const
void setEndColumn(ossimString endColumn)
ossimString getStartColumn() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void setLocation(ossimString location)
char theStartSegment[START_SEGMENT_SIZE+1]
FIELD: STARTSEGMENT.
ossimString getReproNum() const
void setReplayRegen(ossimString replayRegen)
ossimString getLocation() const
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.
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
ossimString getBlankFill() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
#define min(a, b)
Definition: auxiliary.h:75
char theEndSegment[END_SEGMENT_SIZE+1]
FIELD: ENDSEGMENT.