OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNitfSensraTag.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 
3 // LICENSE: LGPL
4 //
5 // see top level LICENSE.txt
6 //
7 // Author: Walt Bunch
8 //
9 // Description: Nitf support class for SENSRA - Sensor parameters extension.
10 //
11 //********************************************************************
12 // $Id: ossimNitfSensraTag.cpp 22013 2012-12-19 17:37:20Z dburken $
13 
14 #include <istream>
15 #include <iomanip>
17 
19 
20 
22  : ossimNitfRegisteredTag(std::string("SENSRA"), 132)
23 {
24  clearFields();
25 }
26 
28 {
29 }
30 
32 {
33  clearFields();
34 
35  in.read(theRefRow, REF_ROW_SIZE);
36  in.read(theRefCol, REF_COL_SIZE);
39  in.read(theSensorLoc, SENSOR_LOC_SIZE);
41  in.read(theSensorAlt, SENSOR_ALT_SIZE);
43  in.read(theSensorAgl, SENSOR_AGL_SIZE);
46  in.read(theSensorYaw, SENSOR_YAW_SIZE);
57  in.read(theNSwaths, N_SWATHS_SIZE);
58  in.read(theSpotNum, SPOT_NUM_SIZE);
59 }
60 
62 {
63  out.write(theRefRow, REF_ROW_SIZE);
64  out.write(theRefCol, REF_COL_SIZE);
67  out.write(theSensorLoc, SENSOR_LOC_SIZE);
69  out.write(theSensorAlt, SENSOR_ALT_SIZE);
71  out.write(theSensorAgl, SENSOR_AGL_SIZE);
73  out.write(theSensorRoll, SENSOR_ROLL_SIZE);
74  out.write(theSensorYaw, SENSOR_YAW_SIZE);
85  out.write(theNSwaths, N_SWATHS_SIZE);
86  out.write(theSpotNum, SPOT_NUM_SIZE);
87 }
88 
90 {
91  memset(theRefRow, ' ', REF_ROW_SIZE);
92  memset(theRefCol, ' ', REF_COL_SIZE);
93  memset(theSensorModel, ' ', SENSOR_MODEL_SIZE);
94  memset(theSensorMount, ' ', SENSOR_MOUNT_SIZE);
95  memset(theSensorLoc, ' ', SENSOR_LOC_SIZE);
97  memset(theSensorAlt, ' ', SENSOR_ALT_SIZE);
99  memset(theSensorAgl, ' ', SENSOR_AGL_SIZE);
100  memset(theSensorPitch, ' ', SENSOR_PITCH_SIZE);
101  memset(theSensorRoll, ' ', SENSOR_ROLL_SIZE);
102  memset(theSensorYaw, ' ', SENSOR_YAW_SIZE);
104  memset(thePlatformRoll, ' ', PLATFORM_ROLL_SIZE);
105  memset(thePlatformHdg, ' ', PLATFORM_HDG_SIZE);
106  memset(theGroundSpdSrc, ' ', GROUND_SPD_SRC_SIZE);
107  memset(theGroundSpeed, ' ', GROUND_SPEED_SIZE);
109  memset(theGroundTrack, ' ', GROUND_TRACK_SIZE);
110  memset(theVerticalVel, ' ', VERTICAL_VEL_SIZE);
111  memset(theVertVelUnit, ' ', VERT_VEL_UNIT_SIZE);
112  memset(theSwathFrames, ' ', SWATH_FRAMES_SIZE);
113  memset(theNSwaths, ' ', N_SWATHS_SIZE);
114  memset(theSpotNum, ' ', SPOT_NUM_SIZE);
115 
116  theRefRow[REF_ROW_SIZE] = '\0';
117  theRefCol[REF_COL_SIZE] = '\0';
138  theNSwaths[N_SWATHS_SIZE] = '\0';
139  theSpotNum[SPOT_NUM_SIZE] = '\0';
140 }
141 
143  std::ostream& out, const std::string& prefix) const
144 {
145  std::string pfx = prefix;
146  pfx += getTagName();
147  pfx += ".";
148 
149  out << std::setiosflags(std::ios::left)
150  << pfx << std::setw(24) << "CETAG:"
151  << getTagName() << "\n"
152  << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
153  << pfx << std::setw(24) << "REFROW:" << theRefRow << "\n"
154  << pfx << std::setw(24) << "REFCOL:" << theRefCol << "\n"
155  << pfx << std::setw(24) << "SENSORMODEL:" << theSensorModel<< "\n"
156  << pfx << std::setw(24) << "SENSORMOUNT:" << theSensorMount << "\n"
157  << pfx << std::setw(24) << "SENSORLOC:" << theSensorLoc << "\n"
158  << pfx << std::setw(24) << "SENSORALTSRC:" << theSensorAltSrc<< "\n"
159  << pfx << std::setw(24) << "SENSORALT:" << theSensorAlt << "\n"
160  << pfx << std::setw(24) << "SENSORALTUNIT:" << theSensorAltUnit << "\n"
161  << pfx << std::setw(24) << "SENSORAGL:" << theSensorAgl << "\n"
162  << pfx << std::setw(24) << "SENSORPITCH:" << theSensorPitch << "\n"
163  << pfx << std::setw(24) << "SENSORROLL:" << theSensorRoll<< "\n"
164  << pfx << std::setw(24) << "SENSORYAW:" << theSensorYaw << "\n"
165  << pfx << std::setw(24) << "PLATFORMPITCH:" << thePlatformPitch << "\n"
166  << pfx << std::setw(24) << "PLATFORMROLL:" << thePlatformRoll << "\n"
167  << pfx << std::setw(24) << "PLATFORMHDG:" << thePlatformHdg << "\n"
168  << pfx << std::setw(24) << "GROUNDSPDSRC:" << theGroundSpdSrc << "\n"
169  << pfx << std::setw(24) << "GROUNDSPEED:" << theGroundSpeed << "\n"
170  << pfx << std::setw(24) << "GROUNDSPDUNIT:" << theGroundSpdUnit << "\n"
171  << pfx << std::setw(24) << "GROUNDTRACK:" << theGroundTrack << "\n"
172  << pfx << std::setw(24) << "VERTICALVEL:" << theVerticalVel<< "\n"
173  << pfx << std::setw(24) << "VERTVELUNIT:" << theVertVelUnit << "\n"
174  << pfx << std::setw(24) << "SWATHFRAMES:" << theSwathFrames<< "\n"
175  << pfx << std::setw(24) << "NSWATHS:" << theNSwaths << "\n"
176  << pfx << std::setw(24) << "SPOTNUM:" << theSpotNum << "\n";
177 
178  return out;
179 }
180 
182 {
183  return theRefRow;
184 }
185 
187 {
188  memset(theRefRow, ' ', REF_ROW_SIZE);
189  memcpy(theRefRow, refRow.c_str(), std::min((size_t)REF_ROW_SIZE, refRow.length()));
190 }
191 
193 {
194  return theRefCol;
195 }
196 
198 {
199  memset(theRefCol, ' ', REF_COL_SIZE);
200  memcpy(theRefCol, refCol.c_str(), std::min((size_t)REF_COL_SIZE, refCol.length()));
201 }
202 
204 {
205  return theSensorModel;
206 }
207 
209 {
210  memset(theSensorModel, ' ', SENSOR_MODEL_SIZE);
211  memcpy(theSensorModel, sensorModel.c_str(), std::min((size_t)SENSOR_MODEL_SIZE, sensorModel.length()));
212 }
213 
215 {
216  return theSensorMount;
217 }
218 
220 {
221  memset(theSensorMount, ' ', SENSOR_MOUNT_SIZE);
222  memcpy(theSensorMount, sensorMount.c_str(), std::min((size_t)SENSOR_MOUNT_SIZE, sensorMount.length()));
223 }
224 
226 {
227  return theSensorLoc;
228 }
229 
231 {
232  memset(theSensorLoc, ' ', SENSOR_LOC_SIZE);
233  memcpy(theSensorLoc, sensorLoc.c_str(), std::min((size_t)SENSOR_LOC_SIZE, sensorLoc.length()));
234 }
235 
237 {
238  return theSensorAltSrc;
239 }
240 
242 {
243  memset(theSensorAltSrc, ' ', SENSOR_ALT_SRC_SIZE);
244  memcpy(theSensorAltSrc, sensorAltSrc.c_str(), std::min((size_t)SENSOR_ALT_SRC_SIZE, sensorAltSrc.length()));
245 }
246 
248 {
249  return theSensorAlt;
250 }
251 
253 {
254  memset(theSensorAlt, ' ', SENSOR_ALT_SIZE);
255  memcpy(theSensorAlt, sensorAlt.c_str(), std::min((size_t)SENSOR_ALT_SIZE, sensorAlt.length()));
256 }
257 
259 {
260  return theSensorAltUnit;
261 }
262 
264 {
266  memcpy(theSensorAltUnit, sensorAltUnit.c_str(), std::min((size_t)SENSOR_ALT_UNIT_SIZE, sensorAltUnit.length()));
267 }
268 
270 {
271  return theSensorAgl;
272 }
273 
275 {
276  memset(theSensorAgl, ' ', SENSOR_AGL_SIZE);
277  memcpy(theSensorAgl, sensorAgl.c_str(), std::min((size_t)SENSOR_AGL_SIZE, sensorAgl.length()));
278 }
279 
281 {
282  return theSensorPitch;
283 }
284 
286 {
287  memset(theSensorPitch, ' ', SENSOR_PITCH_SIZE);
288  memcpy(theSensorPitch, sensorPitch.c_str(), std::min((size_t)SENSOR_PITCH_SIZE, sensorPitch.length()));
289 }
290 
292 {
293  return theSensorRoll;
294 }
295 
297 {
298  memset(theSensorRoll, ' ', SENSOR_ROLL_SIZE);
299  memcpy(theSensorRoll, sensorRoll.c_str(), std::min((size_t)SENSOR_ROLL_SIZE, sensorRoll.length()));
300 }
301 
303 {
304  return theSensorYaw;
305 }
306 
308 {
309  memset(theSensorYaw, ' ', SENSOR_YAW_SIZE);
310  memcpy(theSensorYaw, sensorYaw.c_str(), std::min((size_t)SENSOR_YAW_SIZE, sensorYaw.length()));
311 }
312 
314 {
315  return thePlatformPitch;
316 }
317 
319 {
321  memcpy(thePlatformPitch, platformPitch.c_str(), std::min((size_t)PLATFORM_PITCH_SIZE, platformPitch.length()));
322 }
323 
325 {
326  return thePlatformRoll;
327 }
328 
330 {
331  memset(thePlatformRoll, ' ', PLATFORM_ROLL_SIZE);
332  memcpy(thePlatformRoll, platformRoll.c_str(), std::min((size_t)PLATFORM_ROLL_SIZE, platformRoll.length()));
333 }
334 
336 {
337  return thePlatformHdg;
338 }
339 
341 {
342  memset(thePlatformHdg, ' ', PLATFORM_HDG_SIZE);
343  memcpy(thePlatformHdg, platformHdg.c_str(), std::min((size_t)PLATFORM_HDG_SIZE, platformHdg.length()));
344 }
345 
347 {
348  return theGroundSpdSrc;
349 }
350 
352 {
353  memset(theGroundSpdSrc, ' ', GROUND_SPD_SRC_SIZE);
354  memcpy(theGroundSpdSrc, groundSpdSrc.c_str(), std::min((size_t)GROUND_SPD_SRC_SIZE, groundSpdSrc.length()));
355 }
356 
358 {
359  return theGroundSpeed;
360 }
361 
363 {
364  memset(theGroundSpeed, ' ', GROUND_SPEED_SIZE);
365  memcpy(theGroundSpeed, groundSpeed.c_str(), std::min((size_t)GROUND_SPEED_SIZE, groundSpeed.length()));
366 }
367 
369 {
370  return theGroundSpdUnit;
371 }
372 
374 {
376  memcpy(theGroundSpdUnit, groundSpdUnit.c_str(), std::min((size_t)GROUND_SPD_UNIT_SIZE, groundSpdUnit.length()));
377 }
378 
380 {
381  return theGroundTrack;
382 }
383 
385 {
386  memset(theGroundTrack, ' ', GROUND_TRACK_SIZE);
387  memcpy(theGroundTrack, groundTrack.c_str(), std::min((size_t)GROUND_TRACK_SIZE, groundTrack.length()));
388 }
389 
391 {
392  return theVerticalVel;
393 }
394 
396 {
397  memset(theVerticalVel, ' ', VERTICAL_VEL_SIZE);
398  memcpy(theVerticalVel, verticalVel.c_str(), std::min((size_t)VERTICAL_VEL_SIZE, verticalVel.length()));
399 }
400 
402 {
403  return theVertVelUnit;
404 }
405 
407 {
408  memset(theVertVelUnit, ' ', VERT_VEL_UNIT_SIZE);
409  memcpy(theVertVelUnit, vertVelUnit.c_str(), std::min((size_t)VERT_VEL_UNIT_SIZE, vertVelUnit.length()));
410 }
411 
413 {
414  return theSwathFrames;
415 }
416 
418 {
419  memset(theSwathFrames, ' ', SWATH_FRAMES_SIZE);
420  memcpy(theSwathFrames, swathFrames.c_str(), std::min((size_t)SWATH_FRAMES_SIZE, swathFrames.length()));
421 }
422 
424 {
425  return theNSwaths;
426 }
427 
429 {
430  memset(theNSwaths, ' ', N_SWATHS_SIZE);
431  memcpy(theNSwaths, nSwaths.c_str(), std::min((size_t)N_SWATHS_SIZE, nSwaths.length()));
432 }
433 
435 {
436  return theSpotNum;
437 }
438 
440 {
441  memset(theSpotNum, ' ', SPOT_NUM_SIZE);
442  memcpy(theSpotNum, spotNum.c_str(), std::min((size_t)SPOT_NUM_SIZE, spotNum.length()));
443 }
444 
ossimString getSensorAltUnit() const
virtual const std::string & getTagName() const
This will return the name of the registered tag for this user defined header.
void setGroundSpdUnit(ossimString groundSpdUnit)
ossimString getRefRow() const
ossimString getSpotNum() const
ossimString getSwathFrames() const
ossimString getSensorLoc() const
void setVerticalVel(ossimString verticalVel)
char theGroundSpdUnit[GROUND_SPD_UNIT_SIZE+1]
FIELD: GROUNDSPDUNIT.
char theSensorPitch[SENSOR_PITCH_SIZE+1]
FIELD: SENSORPITCH.
void setGroundSpeed(ossimString groundSpeed)
virtual void writeStream(std::ostream &out)
char theSwathFrames[SWATH_FRAMES_SIZE+1]
FIELD: SWATHFRAMES.
char thePlatformPitch[PLATFORM_PITCH_SIZE+1]
FIELD: PLATFORMPITCH.
void setGroundTrack(ossimString groundTrack)
ossimString getGroundSpdSrc() const
void setSensorLoc(ossimString sensorLoc)
ossimString getSensorPitch() const
void setNSwaths(ossimString nSwaths)
ossimString getNSwaths() const
ossimString getGroundSpdUnit() const
ossimString getSensorRoll() const
void setSensorAlt(ossimString sensorAlt)
char theSensorAgl[SENSOR_AGL_SIZE+1]
FIELD: SENSORAGL.
void setSwathFrames(ossimString swathFrames)
void setSensorPitch(ossimString sensorPitch)
ossimString getGroundSpeed() const
char theSensorAlt[SENSOR_ALT_SIZE+1]
FIELD: SENSORALT.
RTTI_DEF1(ossimNitfSensraTag, "ossimNitfSensraTag", ossimNitfRegisteredTag)
void setSensorAltUnit(ossimString sensorAltUnit)
void setGroundSpdSrc(ossimString groundSpdSrc)
virtual ossim_uint32 getTagLength() const
Returns the length in bytes of the tag from the CEL or REL field.
char theSensorAltUnit[SENSOR_ALT_UNIT_SIZE+1]
FIELD: SENSORALTUNIT.
void setSensorAltSrc(ossimString sensorAltSrc)
ossimString getPlatformPitch() const
ossimString getVertVelUnit() const
std::string::size_type length() const
Definition: ossimString.h:408
virtual void parseStream(std::istream &in)
void setRefRow(ossimString refRow)
void setSpotNum(ossimString spotNum)
char theSensorRoll[SENSOR_ROLL_SIZE+1]
FIELD: SENSORROLL.
char theGroundSpdSrc[GROUND_SPD_SRC_SIZE+1]
FIELD: GROUNDSPDSRC.
char theGroundTrack[GROUND_TRACK_SIZE+1]
FIELD: GROUNDTRACK.
void setVertVelUnit(ossimString vertVelUnit)
void setRefCol(ossimString refCol)
ossimString getSensorAlt() const
ossimString getSensorYaw() const
ossimString getPlatformRoll() const
char theVertVelUnit[VERT_VEL_UNIT_SIZE+1]
FIELD: VERTVELUNIT.
void setSensorYaw(ossimString sensorYaw)
void setSensorRoll(ossimString sensorRoll)
ossimString getPlatformHdg() const
virtual void clearFields()
ossimString getSensorModel() const
char theSensorModel[SENSOR_MODEL_SIZE+1]
FIELD: SENSORMODEL.
ossimString getSensorMount() const
void setPlatformPitch(ossimString platformPitch)
char theSensorAltSrc[SENSOR_ALT_SRC_SIZE+1]
FIELD: SENSORALTSRC.
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
char theGroundSpeed[GROUND_SPEED_SIZE+1]
FIELD: GROUNDSPEED.
char theSensorLoc[SENSOR_LOC_SIZE+1]
FIELD: SENSORLOC.
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.
char theSensorMount[SENSOR_MOUNT_SIZE+1]
FIELD: SENSORMOUNT.
char theNSwaths[N_SWATHS_SIZE+1]
FIELD: NSWATHS.
char theRefCol[REF_COL_SIZE+1]
FIELD: REFCOL.
char theRefRow[REF_ROW_SIZE+1]
FIELD: REFROW.
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 setPlatformRoll(ossimString platformRoll)
ossimString getRefCol() const
ossimString getSensorAgl() const
char theSpotNum[SPOT_NUM_SIZE+1]
FIELD: SPOTNUM.
void setSensorMount(ossimString sensorMount)
void setSensorAgl(ossimString sensorAgl)
char theSensorYaw[SENSOR_YAW_SIZE+1]
FIELD: SENSORYAW.
char thePlatformHdg[PLATFORM_HDG_SIZE+1]
FIELD: PLATFORMHDG.
void setPlatformHdg(ossimString platformHdg)
char theVerticalVel[VERTICAL_VEL_SIZE+1]
FIELD: VERTICALVEL.
ossimString getVerticalVel() const
char thePlatformRoll[PLATFORM_ROLL_SIZE+1]
FIELD: PLATFORMROLL.
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void setSensorModel(ossimString sensorModel)
#define min(a, b)
Definition: auxiliary.h:75
ossimString getSensorAltSrc() const
ossimString getGroundTrack() const