1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Oscar Kramer
6 //
7 // Description:
8 //
9 // Class for reading CEOS-formatted metadata.
10 //
11 //*******************************************************************
12 // $Id:$
13
14 #include <cstdio>
15 #include <cstdlib>
16 #include <cstring>
17 using namespace std;
18
19 #include <ossim/support_data/ossimCeosData.h>
20 #include "ossim/base/ossimCommon.h"
21 #include <ossim/base/ossimTrace.h>
22
23 // Define Trace flags for use within this file:
24 static ossimTrace traceExec ("ossimCeosData:exec");
25 static ossimTrace traceDebug ("ossimCeosData:debug");
26
27 static const ossimFilename CEOS_VOL_DIR_FILENAME = "vdf_dat.001";
28 static const ossimFilename CEOS_LEADER_FILENAME = "lea_01.001";
29 static const ossimFilename CEOS_IMAGE_FILENAME = "dat_01.001";
30 static const ossimFilename CEOS_TRAILER_FILENAME = "tra_01.001";
31
32
33 //******************************************************************************
34 // CONSTRUCTOR:
35 //******************************************************************************
ossimCeosData(const ossimFilename & volDirFile,const ossimFilename & leaderFile,const ossimFilename & imageFile,const ossimFilename & trailerFile)36 ossimCeosData::ossimCeosData(const ossimFilename& volDirFile,
37 const ossimFilename& leaderFile,
38 const ossimFilename& imageFile,
39 const ossimFilename& trailerFile)
40 :
41 theVolDirFileName (volDirFile),
42 theLeaderFileName (leaderFile),
43 theImageFileName (imageFile),
44 theTrailerFileName (trailerFile),
45 theErrorStatus (OK),
46 theVolDescRec (0),
47 theTextRec (0),
48 theDataSetSumRec (0),
49 theQualSumRec (0),
50 theSdrHistRec (0),
51 thePdr16HistRec (0),
52 thePdr8HistRec (0),
53 theProcParmRec (0),
54 theMapProjRec (0),
55 thePosDataRec (0),
56 theAttDataRec (0),
57 theRadiDataRec (0),
58 theRadiCompRec (0)
59 {
60 static const char MODULE[] = "ossimCeosData Constructor #1";
61 if (traceExec()) CLOG << "entering..." << endl;
62
63 loadCeosRecords();
64
65 if (traceExec()) CLOG << "returning..." << endl;
66 }
67
68
69 //******************************************************************************
70 // CONSTRUCTOR: ossimCeosData(ossimFilename)
71 //
72 // Initializes given the image directory (assumes default filenames).
73 //
74 //******************************************************************************
ossimCeosData(const ossimFilename & imageDir)75 ossimCeosData::ossimCeosData(const ossimFilename& imageDir)
76 :
77 theErrorStatus (OK),
78 theVolDescRec (0),
79 theTextRec (0),
80 theDataSetSumRec (0),
81 theQualSumRec (0),
82 theSdrHistRec (0),
83 thePdr16HistRec (0),
84 thePdr8HistRec (0),
85 theProcParmRec (0),
86 theMapProjRec (0),
87 thePosDataRec (0),
88 theAttDataRec (0),
89 theRadiDataRec (0),
90 theRadiCompRec (0)
91 {
92 static const char MODULE[] = "ossimCeosData Constructor #1";
93 if (traceExec()) CLOG << "entering..." << endl;
94
95 //***
96 // Assign values to ossimFilename data members:
97 //***
98 theVolDirFileName = imageDir.dirCat(CEOS_VOL_DIR_FILENAME);
99 theLeaderFileName = imageDir.dirCat(CEOS_LEADER_FILENAME);
100 theImageFileName = imageDir.dirCat(CEOS_IMAGE_FILENAME);
101 theTrailerFileName = imageDir.dirCat(CEOS_TRAILER_FILENAME);
102
103 loadCeosRecords();
104
105 if (traceExec()) CLOG << "returning..." << endl;
106 }
107
108
109 //******************************************************************************
110 // PUBLIC METHOD: ossimCeosData::dump(ostream&)
111 //
112 //******************************************************************************
dump(ostream & stream) const113 void ossimCeosData::dump(ostream& stream) const
114 {
115 static const char MODULE[] = "ossimCeosData::dump(ostream& stream)";
116 if (traceExec()) CLOG << "entering..." << endl;
117
118 stream << "\nDump of ossimCeosData Object -----------------------------" << endl;
119
120 if (theVolDescRec)
121 dumpVolDescRec(stream);
122 else
123 stream << "\n\n\tvol_desc_rec not present." << endl;
124
125 if (theTextRec)
126 dumpTextRec(stream);
127 else
128 stream << "\n\n\ttext_rec not present." << endl;
129
130 if (imopDescRec())
131 dumpImopDescRec(stream);
132 else
133 stream << "\n\n\timop_desc_rec not present." << endl;
134
135 if (theDataSetSumRec)
136 dumpDataSetSumRec(stream);
137 else
138 stream << "\n\n\tdataset_sum_rec not present." << endl;
139
140 if (theQualSumRec)
141 dumpQualSumRec(stream);
142 else
143 stream << "\n\n\tqual_sum_rec not present." << endl;
144
145 if (theSdrHistRec)
146 dumpSdrHistRec(stream);
147 else
148 stream << "\n\n\tsdr_hist_rec not present." << endl;
149
150 if (thePdr16HistRec)
151 dumpPdr16HistRec(stream);
152 else
153 stream << "\n\n\tpdr16_hist_rec not present." << endl;
154
155 if (thePdr8HistRec)
156 dumpPdr8HistRec(stream);
157 else
158 stream << "\n\n\tpdr8_hist_rec not present." << endl;
159
160 if (theProcParmRec)
161 dumpProcParmRec(stream);
162 else
163 stream << "\n\n\tproc_parm_rec not present." << endl;
164
165 if (theMapProjRec)
166 dumpMapProjRec(stream);
167 else
168 stream << "\n\n\tmap_proj_rec not present." << endl;
169
170 if (thePosDataRec)
171 dumpPosDataRec(stream);
172 else
173 stream << "\n\n\tpos_data_rec not present." << endl;
174
175 if (theAttDataRec)
176 dumpAttDataRec(stream);
177 else
178 stream << "\n\n\tatt_data_rec not present." << endl;
179
180 if (theRadiDataRec)
181 dumpRadiDataRec(stream);
182 else
183 stream << "\n\n\tradi_data_rec not present." << endl;
184
185 if (theRadiCompRec)
186 dumpRadiCompRec(stream);
187 else
188 stream << "\n\n\tradi_comp_rec not present." << endl;
189
190 stream << "\nEnd of ossimCeosData Object Dump -------------------------" << endl;
191
192 if (traceExec()) CLOG << "returning..." << endl;
193 return;
194 }
195
196 //******************************************************************************
197 // PRIVATE METHOD: ossimCeosData::dumpVolDescRec()
198 //
199 //******************************************************************************
dumpVolDescRec(ostream & stream) const200 void ossimCeosData::dumpVolDescRec(ostream& stream) const
201 {
202 const vol_desc_rec* p = theVolDescRec;
203
204 stream << "\n\n\tContents of vol_desc_rec:\n";
205 stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2);
206 stream << "\"\n\t format_doc \""; stream.write(p->format_doc, 12);
207 stream << "\"\n\t format_ver \""; stream.write(p->format_ver, 2);
208 stream << "\"\n\t format_rev \""; stream.write(p->format_rev, 2);
209 stream << "\"\n\t software_id \""; stream.write(p->software_id, 12);
210 stream << "\"\n\t phyvol_id \""; stream.write(p->phyvol_id, 16);
211 stream << "\"\n\t logvol_id \""; stream.write(p->logvol_id, 16);
212 stream << "\"\n\t volset_id \""; stream.write(p->volset_id, 16);
213 stream << "\"\n\t phyvol_cnt \""; stream.write(p->phyvol_cnt, 2);
214 stream << "\"\n\t first_phyvol \""; stream.write(p->first_phyvol, 2);
215 stream << "\"\n\t last_phyvol \""; stream.write(p->last_phyvol, 2);
216 stream << "\"\n\t curr_phyvol \""; stream.write(p->curr_phyvol, 2);
217 stream << "\"\n\t first_file \""; stream.write(p->first_file, 4);
218 stream << "\"\n\t volset_log \""; stream.write(p->volset_log, 4);
219 stream << "\"\n\t phyvol_log \""; stream.write(p->phyvol_log, 4);
220 stream << "\"\n\t logvol_date \""; stream.write(p->logvol_date, 8);
221 stream << "\"\n\t logvol_time \""; stream.write(p->logvol_time, 8);
222 stream << "\"\n\t logvol_country \"";
223 stream.write(p->logvol_country, 12);
224 stream << "\"\n\t logvol_agency \""; stream.write(p->logvol_agency, 8);
225 stream << "\"\n\t logvol_facility \"";
226 stream.write(p->logvol_facility,12);
227 stream << "\"\n\t n_filepoint \""; stream.write(p->n_filepoint, 4);
228 stream << "\"\n\t n_voldir \""; stream.write(p->n_voldir, 4);
229 stream << "\"\n\t product_id \""; stream.write(p->product_id, 8);
230
231 stream << "\"" << endl;
232 }
233
234 //******************************************************************************
235 // PRIVATE METHOD: ossimCeosData::dumpTextRec()
236 //
237 //******************************************************************************
dumpTextRec(ostream & stream) const238 void ossimCeosData::dumpTextRec(ostream& stream) const
239 {
240 const text_rec* p = theTextRec;
241
242 stream << "\n\n\tContents of text_rec:\n\t";
243 stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2);
244 stream << "\"\n\t cont_flag \""; stream.write(p->cont_flag, 2);
245 stream << "\"\n\t product_type \""; stream.write(p->product_type, 40);
246 stream << "\"\n\t product_create \"";
247 stream.write(p->product_create, 60);
248 stream << "\"\n\t phyvol_id \""; stream.write(p->phyvol_id, 40);
249 stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 40);
250 stream << "\"\n\t scene_loc \""; stream.write(p->scene_loc, 40);
251 stream << "\"" << endl;
252 }
253
254 //******************************************************************************
255 // PRIVATE METHOD: ossimCeosData::dumpImopDescRec()
256 //
257 //******************************************************************************
dumpImopDescRec(ostream & stream) const258 void ossimCeosData::dumpImopDescRec(ostream& stream) const
259 {
260 const imop_desc_rec* p = &theImopDescRec;
261
262 stream << "\n\n\tContents of imop_desc_rec:\n\t";
263 stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2);
264 stream << "\"\n\t spare1 \""; stream.write(p->spare1, 2);
265 stream << "\"\n\t format_doc \""; stream.write(p->format_doc, 12);
266 stream << "\"\n\t format_rev \""; stream.write(p->format_rev, 2);
267 stream << "\"\n\t design_rev \""; stream.write(p->design_rev, 2);
268 stream << "\"\n\t software_id \""; stream.write(p->software_id, 12);
269 stream << "\"\n\t file_num \""; stream.write(p->file_num, 4);
270 stream << "\"\n\t file_name \""; stream.write(p->file_name, 16);
271 stream << "\"\n\t rec_seq \""; stream.write(p->rec_seq, 4);
272 stream << "\"\n\t seq_loc \""; stream.write(p->seq_loc, 8);
273 stream << "\"\n\t seq_len \""; stream.write(p->seq_len, 4);
274 stream << "\"\n\t rec_code \""; stream.write(p->rec_code, 4);
275 stream << "\"\n\t code_loc \""; stream.write(p->code_loc, 8);
276 stream << "\"\n\t code_len \""; stream.write(p->code_len, 4);
277 stream << "\"\n\t rec_len \""; stream.write(p->rec_len, 4);
278 stream << "\"\n\t rlen_loc \""; stream.write(p->rlen_loc, 8);
279 stream << "\"\n\t rlen_len \""; stream.write(p->rlen_len, 4);
280 stream << "\"\n\t spare2 \""; stream.write(p->spare2, 4);
281 stream << "\"\n\t spare3 \""; stream.write(p->spare3, 64);
282 stream << "\"\n\t n_dataset \""; stream.write(p->n_dataset, 6);
283 stream << "\"\n\t l_dataset \""; stream.write(p->l_dataset, 6);
284 stream << "\"\n\t spare4 \""; stream.write(p->spare4, 24);
285 stream << "\"\n\t nbit \""; stream.write(p->nbit, 4);
286 stream << "\"\n\t nsamp \""; stream.write(p->nsamp, 4);
287 stream << "\"\n\t nbyte \""; stream.write(p->nbyte, 4);
288 stream << "\"\n\t justify \""; stream.write(p->justify, 4);
289 stream << "\"\n\t nchn \""; stream.write(p->nchn, 4);
290 stream << "\"\n\t nlin \""; stream.write(p->nlin, 8);
291 stream << "\"\n\t nleft \""; stream.write(p->nleft, 4);
292 stream << "\"\n\t ngrp \""; stream.write(p->ngrp, 8);
293 stream << "\"\n\t nright \""; stream.write(p->nright, 4);
294 stream << "\"\n\t ntop \""; stream.write(p->ntop, 4);
295 stream << "\"\n\t nbott \""; stream.write(p->nbott, 4);
296 stream << "\"\n\t intleav \""; stream.write(p->intleav, 4);
297 stream << "\"\n\t nrec_lin \""; stream.write(p->nrec_lin, 2);
298 stream << "\"\n\t nrec_chn \""; stream.write(p->nrec_chn, 2);
299 stream << "\"\n\t n_prefix \""; stream.write(p->n_prefix, 4);
300 stream << "\"\n\t n_sar \""; stream.write(p->n_sar, 8);
301 stream << "\"\n\t n_suffix \""; stream.write(p->n_suffix, 4);
302 stream << "\"\n\t spare5 \""; stream.write(p->spare5, 4);
303 stream << "\"\n\t lin_loc \""; stream.write(p->lin_loc, 8);
304 stream << "\"\n\t chn_loc \""; stream.write(p->chn_loc, 8);
305 stream << "\"\n\t tim_loc \""; stream.write(p->tim_loc, 8);
306 stream << "\"\n\t left_loc \""; stream.write(p->left_loc, 8);
307 stream << "\"\n\t right_loc \""; stream.write(p->right_loc, 8);
308 stream << "\"\n\t pad_ind \""; stream.write(p->pad_ind, 4);
309 stream << "\"\n\t spare6 \""; stream.write(p->spare6, 28);
310 stream << "\"\n\t qual_loc \""; stream.write(p->qual_loc, 8);
311 stream << "\"\n\t cali_loc \""; stream.write(p->cali_loc, 8);
312 stream << "\"\n\t gain_loc \""; stream.write(p->gain_loc, 8);
313 stream << "\"\n\t bias_loc \""; stream.write(p->bias_loc, 8);
314 stream << "\"\n\t type_id \""; stream.write(p->type_id, 28);
315 stream << "\"\n\t type_code \""; stream.write(p->type_code, 4);
316 stream << "\"\n\t left_fill \""; stream.write(p->left_fill, 4);
317 stream << "\"\n\t right_fill \""; stream.write(p->right_fill, 4);
318 stream << "\"\n\t pix_rng \""; stream.write(p->pix_rng, 8);
319 stream << "\"" << endl;
320 }
321
322 //******************************************************************************
323 // PRIVATE METHOD: ossimCeosData::dumpDataSetSumRec()
324 //
325 //******************************************************************************
dumpDataSetSumRec(ostream & stream) const326 void ossimCeosData::dumpDataSetSumRec(ostream& stream) const
327 {
328 const dataset_sum_rec* p = theDataSetSumRec;
329
330 stream << "\n\n\tContents of dataset_sum_rec:\n\t \"";
331 stream << "\n\t seq_num \""; stream.write(p->seq_num, 4);
332 stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4);
333 stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 16);
334 stream << "\"\n\t scene_des \""; stream.write(p->scene_des, 32);
335 stream << "\"\n\t inp_sctim \""; stream.write(p->inp_sctim, 32);
336 stream << "\"\n\t asc_des \""; stream.write(p->asc_des, 16);
337 stream << "\"\n\t pro_lat \""; stream.write(p->pro_lat, 16);
338 stream << "\"\n\t pro_long \""; stream.write(p->pro_long, 16);
339 stream << "\"\n\t pro_head \""; stream.write(p->pro_head, 16);
340 stream << "\"\n\t ellip_des \""; stream.write(p->ellip_des, 16);
341 stream << "\"\n\t ellip_maj \""; stream.write(p->ellip_maj, 16);
342 stream << "\"\n\t ellip_min \""; stream.write(p->ellip_min, 16);
343 stream << "\"\n\t earth_mass \""; stream.write(p->earth_mass, 16);
344 stream << "\"\n\t grav_const \""; stream.write(p->grav_const, 16);
345 stream << "\"\n\t ellip_j[0] \""; stream.write(p->ellip_j[0], 16);
346 stream << "\"\n\t ellip_j[1] \""; stream.write(p->ellip_j[1], 16);
347 stream << "\"\n\t ellip_j[2] \""; stream.write(p->ellip_j[2], 16);
348 stream << "\"\n\t spare1 \""; stream.write(p->spare1, 16);
349 stream << "\"\n\t terrain_h \""; stream.write(p->terrain_h, 16);
350 stream << "\"\n\t sc_lin \""; stream.write(p->sc_lin, 8);
351 stream << "\"\n\t sc_pix \""; stream.write(p->sc_pix, 8);
352 stream << "\"\n\t scene_len \""; stream.write(p->scene_len, 16);
353 stream << "\"\n\t scene_wid \""; stream.write(p->scene_wid, 16);
354 stream << "\"\n\t spare2 \""; stream.write(p->spare2, 16);
355 stream << "\"\n\t nchn \""; stream.write(p->nchn, 4);
356 stream << "\"\n\t spare3 \""; stream.write(p->spare3, 4);
357 stream << "\"\n\t mission_id \""; stream.write(p->mission_id, 16);
358 stream << "\"\n\t sensor_id \""; stream.write(p->sensor_id, 32);
359 stream << "\"\n\t orbit_num \""; stream.write(p->orbit_num, 8);
360 stream << "\"\n\t plat_lat \""; stream.write(p->plat_lat, 8);
361 stream << "\"\n\t plat_long \""; stream.write(p->plat_long, 8);
362 stream << "\"\n\t plat_head \""; stream.write(p->plat_head, 8);
363 stream << "\"\n\t clock_ang \""; stream.write(p->clock_ang, 8);
364 stream << "\"\n\t incident_ang \""; stream.write(p->incident_ang, 8);
365 stream << "\"\n\t spare4 \""; stream.write(p->spare4, 8);
366 stream << "\"\n\t wave_length \""; stream.write(p->wave_length, 16);
367 stream << "\"\n\t motion_comp \""; stream.write(p->motion_comp, 2);
368 stream << "\"\n\t pulse_code \""; stream.write(p->pulse_code, 16);
369 stream << "\"\n\t ampl_coef[0] \""; stream.write(p->ampl_coef[0], 16);
370 stream << "\"\n\t ampl_coef[1] \""; stream.write(p->ampl_coef[1], 16);
371 stream << "\"\n\t ampl_coef[2] \""; stream.write(p->ampl_coef[2], 16);
372 stream << "\"\n\t ampl_coef[3] \""; stream.write(p->ampl_coef[3], 16);
373 stream << "\"\n\t ampl_coef[4] \""; stream.write(p->ampl_coef[4], 16);
374 stream << "\"\n\t phas_coef[0] \""; stream.write(p->phas_coef[0], 16);
375 stream << "\"\n\t phas_coef[1] \""; stream.write(p->phas_coef[1], 16);
376 stream << "\"\n\t phas_coef[2] \""; stream.write(p->phas_coef[2], 16);
377 stream << "\"\n\t phas_coef[3] \""; stream.write(p->phas_coef[3], 16);
378 stream << "\"\n\t phas_coef[4] \""; stream.write(p->phas_coef[4], 16);
379 stream << "\"\n\t chirp_ext_ind \""; stream.write(p->chirp_ext_ind, 8);
380 stream << "\"\n\t spare5 \""; stream.write(p->spare5, 8);
381 stream << "\"\n\t fr \""; stream.write(p->fr, 16);
382 stream << "\"\n\t rng_gate \""; stream.write(p->rng_gate, 16);
383 stream << "\"\n\t rng_length \""; stream.write(p->rng_length, 16);
384 stream << "\"\n\t baseband_f \""; stream.write(p->baseband_f, 4);
385 stream << "\"\n\t rngcmp_f \""; stream.write(p->rngcmp_f, 4);
386 stream << "\"\n\t gn_polar \""; stream.write(p->gn_polar, 16);
387 stream << "\"\n\t gn_cross \""; stream.write(p->gn_cross, 16);
388 stream << "\"\n\t chn_bits \""; stream.write(p->chn_bits, 8);
389 stream << "\"\n\t quant_desc \""; stream.write(p->quant_desc, 12);
390 stream << "\"\n\t i_bias \""; stream.write(p->i_bias, 16);
391 stream << "\"\n\t q_bias \""; stream.write(p->q_bias, 16);
392 stream << "\"\n\t iq_ratio \""; stream.write(p->iq_ratio, 16);
393 stream << "\"\n\t spare6 \""; stream.write(p->spare6, 16);
394 stream << "\"\n\t spare7 \""; stream.write(p->spare7, 16);
395 stream << "\"\n\t ele_sight \""; stream.write(p->ele_sight, 16);
396 stream << "\"\n\t mech_sight \""; stream.write(p->mech_sight, 16);
397 stream << "\"\n\t echo_track \""; stream.write(p->echo_track, 4);
398 stream << "\"\n\t fa \""; stream.write(p->fa, 16);
399 stream << "\"\n\t elev_beam \""; stream.write(p->elev_beam, 16);
400 stream << "\"\n\t azim_beam \""; stream.write(p->azim_beam, 16);
401 stream << "\"\n\t sat_bintim \""; stream.write(p->sat_bintim, 16);
402 stream << "\"\n\t sat_clktim \""; stream.write(p->sat_clktim, 32);
403 stream << "\"\n\t sat_clkinc \""; stream.write(p->sat_clkinc, 8);
404 stream << "\"\n\t spare8 \""; stream.write(p->spare8, 8);
405 stream << "\"\n\t fac_id \""; stream.write(p->fac_id, 16);
406 stream << "\"\n\t sys_id \""; stream.write(p->sys_id, 8);
407 stream << "\"\n\t ver_id \""; stream.write(p->ver_id, 8);
408 stream << "\"\n\t fac_code \""; stream.write(p->fac_code, 16);
409 stream << "\"\n\t lev_code \""; stream.write(p->lev_code, 16);
410 stream << "\"\n\t prod_type \""; stream.write(p->prod_type, 32);
411 stream << "\"\n\t algor_id \""; stream.write(p->algor_id, 32);
412 stream << "\"\n\t n_azilok \""; stream.write(p->n_azilok, 16);
413 stream << "\"\n\t n_rnglok \""; stream.write(p->n_rnglok, 16);
414 stream << "\"\n\t bnd_azilok \""; stream.write(p->bnd_azilok, 16);
415 stream << "\"\n\t bnd_rnglok \""; stream.write(p->bnd_rnglok, 16);
416 stream << "\"\n\t bnd_azi \""; stream.write(p->bnd_azi, 16);
417 stream << "\"\n\t bnd_rng \""; stream.write(p->bnd_rng, 16);
418 stream << "\"\n\t azi_weight \""; stream.write(p->azi_weight, 32);
419 stream << "\"\n\t rng_weight \""; stream.write(p->rng_weight, 32);
420 stream << "\"\n\t data_inpsrc \""; stream.write(p->data_inpsrc, 16);
421 stream << "\"\n\t rng_res \""; stream.write(p->rng_res, 16);
422 stream << "\"\n\t azi_res \""; stream.write(p->azi_res, 16);
423 stream << "\"\n\t radi_stretch[0] \"";
424 stream.write(p->radi_stretch[0],16);
425 stream << "\"\n\t radi_stretch[1] \"";
426 stream.write(p->radi_stretch[1],16);
427 stream << "\"\n\t alt_dopcen[0] \""; stream.write(p->alt_dopcen[0],16);
428 stream << "\"\n\t alt_dopcen[1] \""; stream.write(p->alt_dopcen[1],16);
429 stream << "\"\n\t alt_dopcen[2] \""; stream.write(p->alt_dopcen[2],16);
430 stream << "\"\n\t spare9 \""; stream.write(p->spare9, 16);
431 stream << "\"\n\t crt_dopcen[0] \""; stream.write(p->crt_dopcen[0],16);
432 stream << "\"\n\t crt_dopcen[1] \""; stream.write(p->crt_dopcen[1],16);
433 stream << "\"\n\t crt_dopcen[2] \""; stream.write(p->crt_dopcen[2],16);
434 stream << "\"\n\t time_dir_pix \""; stream.write(p->time_dir_pix, 8);
435 stream << "\"\n\t time_dir_lin \""; stream.write(p->time_dir_lin, 8);
436 stream << "\"\n\t alt_rate[0] \""; stream.write(p->alt_rate[0], 16);
437 stream << "\"\n\t alt_rate[1] \""; stream.write(p->alt_rate[1], 16);
438 stream << "\"\n\t alt_rate[2] \""; stream.write(p->alt_rate[2], 16);
439 stream << "\"\n\t spare10 \""; stream.write(p->spare10, 16);
440 stream << "\"\n\t crt_rate[0] \""; stream.write(p->crt_rate[0], 16);
441 stream << "\"\n\t crt_rate[1] \""; stream.write(p->crt_rate[1], 16);
442 stream << "\"\n\t crt_rate[2] \""; stream.write(p->crt_rate[2], 16);
443 stream << "\"\n\t spare11 \""; stream.write(p->spare11, 16);
444 stream << "\"\n\t line_cont \""; stream.write(p->line_cont, 8);
445 stream << "\"\n\t clutter_lock \""; stream.write(p->clutter_lock, 4);
446 stream << "\"\n\t auto_focus \""; stream.write(p->auto_focus, 4);
447 stream << "\"\n\t line_spacing \""; stream.write(p->line_spacing, 16);
448 stream << "\"\n\t pix_spacing \""; stream.write(p->pix_spacing, 16);
449 stream << "\"\n\t rngcmp_desg \""; stream.write(p->rngcmp_desg, 16);
450 stream << "\"" << endl;
451 }
452
453 //******************************************************************************
454 // PRIVATE METHOD: ossimCeosData::dumpQualSumRec()
455 //
456 //******************************************************************************
dumpQualSumRec(ostream & stream) const457 void ossimCeosData::dumpQualSumRec(ostream& stream) const
458 {
459 const qual_sum_rec* p = theQualSumRec;
460
461 stream << "\n\n\tContents of qual_sum_rec:\n\t";
462 stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4);
463 stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4);
464 stream << "\"\n\t cali_date \""; stream.write(p->cali_date, 6);
465 stream << "\"\n\t nchn \""; stream.write(p->nchn, 4);
466 stream << "\"\n\t islr \""; stream.write(p->islr, 16);
467 stream << "\"\n\t pslr \""; stream.write(p->pslr, 16);
468 stream << "\"\n\t azi_ambig \""; stream.write(p->azi_ambig, 16);
469 stream << "\"\n\t rng_ambig \""; stream.write(p->rng_ambig, 16);
470 stream << "\"\n\t snr \""; stream.write(p->snr, 16);
471 stream << "\"\n\t ber \""; stream.write(p->ber, 16);
472 stream << "\"\n\t rng_res \""; stream.write(p->rng_res, 16);
473 stream << "\"\n\t azi_res \""; stream.write(p->azi_res, 16);
474 stream << "\"\n\t rad_res \""; stream.write(p->rad_res, 16);
475 stream << "\"\n\t dyn_rng \""; stream.write(p->dyn_rng, 16);
476 stream << "\"\n\t rad_unc_db \""; stream.write(p->rad_unc_db, 16);
477 stream << "\"\n\t rad_unc_deg \""; stream.write(p->rad_unc_deg, 16);
478 int i;
479 for (i=0; i<16; i++)
480 {
481 stream << "\"\n\t rad_unc[" << i << "]:";
482 stream << "\n\t db \"";
483 stream.write(p->rad_unc[i].db, 16);
484 stream << "\"\n\t deg \"";
485 stream.write(p->rad_unc[i].deg, 16);
486 }
487 stream << "\"\n\t alt_locerr \""; stream.write(p->alt_locerr, 16);
488 stream << "\"\n\t crt_locerr \""; stream.write(p->crt_locerr, 16);
489 stream << "\"\n\t alt_scale \""; stream.write(p->alt_scale, 16);
490 stream << "\"\n\t crt_scale \""; stream.write(p->crt_scale, 16);
491 stream << "\"\n\t dis_skew \""; stream.write(p->dis_skew, 16);
492 stream << "\"\n\t ori_err \""; stream.write(p->ori_err, 16);
493 for (i=0; i<16; i++)
494 {
495 stream << "\"\n\t misreg[" << i << "]:";
496 stream << "\n\t alt_m \"";
497 stream.write(p->misreg[i].alt_m, 16);
498 stream << "\"\n\t crt_m \"";
499 stream.write(p->misreg[i].crt_m, 16);
500 }
501 stream << "\"\n\t nesz \""; stream.write(p->nesz, 16);
502 stream << "\"\n\t enl \""; stream.write(p->enl, 16);
503 stream << "\"\n\t tb_update \""; stream.write(p->tb_update, 8);
504 stream << "\"" << endl;
505 }
506
507 //******************************************************************************
508 // PRIVATE METHOD: ossimCeosData::dumpSdrHistRec()
509 //
510 //******************************************************************************
dumpSdrHistRec(ostream & stream) const511 void ossimCeosData::dumpSdrHistRec(ostream& stream) const
512 {
513 const sdr_hist_rec* p = theSdrHistRec;
514
515 stream << "\n\n\tContents of sdr_hist_rec:\n\t";
516 stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4);
517 stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4);
518 stream << "\"\n\t ntab \""; stream.write(p->ntab, 8);
519 stream << "\"\n\t ltab \""; stream.write(p->ltab, 8);
520 stream << "\"\n\t htab[0] (only one sdr_htab_rec declared in data struct):";
521 stream << "\n\t hist_desc \"";
522 stream.write(p->htab.hist_desc, 32);
523 stream << "\"\n\t nrec \""; stream.write(p->htab.nrec, 4);
524 stream << "\"\n\t tab_seq \""; stream.write(p->htab.tab_seq, 4);
525 stream << "\"\n\t nbin \""; stream.write(p->htab.nbin, 8);
526 stream << "\"\n\t ns_lin \""; stream.write(p->htab.ns_lin, 8);
527 stream << "\"\n\t ns_pix \""; stream.write(p->htab.ns_pix, 8);
528 stream << "\"\n\t ngrp_lin \""; stream.write(p->htab.ngrp_lin, 8);
529 stream << "\"\n\t ngrp_pix \""; stream.write(p->htab.ngrp_pix, 8);
530 stream << "\"\n\t nsamp_lin \""; stream.write(p->htab.nsamp_lin,8);
531 stream << "\"\n\t nsamp_pix \""; stream.write(p->htab.nsamp_pix,8);
532 stream << "\"\n\t min_smp \""; stream.write(p->htab.min_smp, 16);
533 stream << "\"\n\t max_smp \""; stream.write(p->htab.max_smp, 16);
534 stream << "\"\n\t mean_smp \""; stream.write(p->htab.mean_smp,16);
535 stream << "\"\n\t std_smp \""; stream.write(p->htab.std_smp, 16);
536 stream << "\"\n\t smp_inc \""; stream.write(p->htab.smp_inc, 16);
537 stream << "\"\n\t min_hist \""; stream.write(p->htab.min_hist,16);
538 stream << "\"\n\t max_hist \""; stream.write(p->htab.max_hist,16);
539 stream << "\"\n\t mean_hist \"";
540 stream.write(p->htab.mean_hist, 16);
541 stream << "\"\n\t std_hist \""; stream.write(p->htab.std_hist,16);
542 stream << "\"\n\t nhist \""; stream.write(p->htab.nhist, 8);
543 stream << "\"\n\t [Use debugger to view histogram]";
544 stream << endl;
545 }
546
547 //******************************************************************************
548 // PRIVATE METHOD: ossimCeosData::dumpPdr16HistRec()
549 //
550 //******************************************************************************
dumpPdr16HistRec(ostream & stream) const551 void ossimCeosData::dumpPdr16HistRec(ostream& stream) const
552 {
553 const pdr16_hist_rec* p = thePdr16HistRec;
554
555 stream << "\n\n\tContents of pdr16_hist_rec:\n\t";
556 stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4);
557 stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4);
558 stream << "\"\n\t ntab \""; stream.write(p->ntab, 8);
559 stream << "\"\n\t ltab \""; stream.write(p->ltab, 8);
560
561 char buf[] = "12345678";
562 strncpy(buf, p->ntab, 8);
563 int n = atoi(buf);
564 for (int i=0; i<n; i++)
565 {
566 stream << "\"\n\t htab[" << i << "]:";
567 stream << "\n\t hist_desc \"";
568 stream.write(p->htab[i].hist_desc, 32);
569 stream << "\"\n\t nrec \"";
570 stream.write(p->htab[i].nrec, 4);
571 stream << "\"\n\t tab_seq \"";
572 stream.write(p->htab[i].tab_seq, 4);
573 stream << "\"\n\t nbin \"";
574 stream.write(p->htab[i].nbin, 8);
575 stream << "\"\n\t ns_lin \"";
576 stream.write(p->htab[i].ns_lin, 8);
577 stream << "\"\n\t ns_pix \"";
578 stream.write(p->htab[i].ns_pix, 8);
579 stream << "\"\n\t ngrp_lin \"";
580 stream.write(p->htab[i].ngrp_lin, 8);
581 stream << "\"\n\t ngrp_pix \"";
582 stream.write(p->htab[i].ngrp_pix, 8);
583 stream << "\"\n\t nsamp_lin \"";
584 stream.write(p->htab[i].nsamp_lin, 8);
585 stream << "\"\n\t nsamp_pix \"";
586 stream.write(p->htab[i].nsamp_pix, 8);
587 stream << "\"\n\t min_smp \"";
588 stream.write(p->htab[i].min_smp, 16);
589 stream << "\"\n\t max_smp \"";
590 stream.write(p->htab[i].max_smp, 16);
591 stream << "\"\n\t mean_smp \"";
592 stream.write(p->htab[i].mean_smp, 16);
593 stream << "\"\n\t std_smp \"";
594 stream.write(p->htab[i].std_smp, 16);
595 stream << "\"\n\t smp_inc \"";
596 stream.write(p->htab[i].smp_inc, 16);
597 stream << "\"\n\t min_hist \"";
598 stream.write(p->htab[i].min_hist, 16);
599 stream << "\"\n\t max_hist \"";
600 stream.write(p->htab[i].max_hist, 16);
601 stream << "\"\n\t mean_hist \"";
602 stream.write(p->htab[i].mean_hist, 16);
603 stream << "\"\n\t std_hist \"";
604 stream.write(p->htab[i].std_hist, 16);
605 stream << "\"\n\t nhist \"";
606 stream.write(p->htab[i].nhist, 8);
607 stream << "\n\t [Use debugger to view histogram]";
608 }
609 stream << "\"" << endl;
610 }
611
612 //******************************************************************************
613 // PRIVATE METHOD: ossimCeosData::dumpPdr8HistRec()
614 //
615 //******************************************************************************
dumpPdr8HistRec(ostream & stream) const616 void ossimCeosData::dumpPdr8HistRec(ostream& stream) const
617 {
618 const pdr8_hist_rec* p = thePdr8HistRec;
619
620 stream << "\n\n\tContents of pdr18hist_rec:\n\t";
621 stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4);
622 stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4);
623 stream << "\"\n\t ntab \""; stream.write(p->ntab, 8);
624 stream << "\"\n\t ltab \""; stream.write(p->ltab, 8);
625 stream << "\"\n\t htab[0] (only one sdr_htab_rec declared in data struct):";
626 stream << "\n\t hist_desc \"";
627 stream.write(p->htab.hist_desc, 32);
628 stream << "\"\n\t nrec \""; stream.write(p->htab.nrec, 4);
629 stream << "\"\n\t tab_seq \""; stream.write(p->htab.tab_seq, 4);
630 stream << "\"\n\t nbin \""; stream.write(p->htab.nbin, 8);
631 stream << "\"\n\t ns_lin \""; stream.write(p->htab.ns_lin, 8);
632 stream << "\"\n\t ns_pix \""; stream.write(p->htab.ns_pix, 8);
633 stream << "\"\n\t ngrp_lin \""; stream.write(p->htab.ngrp_lin, 8);
634 stream << "\"\n\t ngrp_pix \""; stream.write(p->htab.ngrp_pix, 8);
635 stream << "\"\n\t nsamp_lin \""; stream.write(p->htab.nsamp_lin,8);
636 stream << "\"\n\t nsamp_pix \""; stream.write(p->htab.nsamp_pix,8);
637 stream << "\"\n\t min_smp \""; stream.write(p->htab.min_smp, 16);
638 stream << "\"\n\t max_smp \""; stream.write(p->htab.max_smp, 16);
639 stream << "\"\n\t mean_smp \""; stream.write(p->htab.mean_smp,16);
640 stream << "\"\n\t std_smp \""; stream.write(p->htab.std_smp, 16);
641 stream << "\"\n\t smp_inc \""; stream.write(p->htab.smp_inc, 16);
642 stream << "\"\n\t min_hist \""; stream.write(p->htab.min_hist,16);
643 stream << "\"\n\t max_hist \""; stream.write(p->htab.max_hist,16);
644 stream << "\"\n\t mean_hist \"";
645 stream.write(p->htab.mean_hist, 16);
646 stream << "\"\n\t std_hist \""; stream.write(p->htab.std_hist,16);
647 stream << "\"\n\t nhist \""; stream.write(p->htab.nhist, 16);
648 stream << "\"\n\t [Use debugger to view histogram]";
649 stream << endl;
650 }
651
652 //******************************************************************************
653 // PRIVATE METHOD: ossimCeosData::dumpProcParmRec()
654 //
655 //******************************************************************************
dumpProcParmRec(ostream & stream) const656 void ossimCeosData::dumpProcParmRec(ostream& stream) const
657 {
658 const proc_parm_rec* p = theProcParmRec;
659
660 stream << "\n\n\tContents of proc_parm_rec:\n\t";
661 stream << "\n\t slow_time_coef[1] \"";
662 stream.write(p->slow_time_coef[1], 22);
663 stream << "\"\n\t rec_seq \""; stream.write(p->rec_seq, 4);
664 stream << "\"\n\t spare1 \""; stream.write(p->spare1, 4);
665 stream << "\"\n\t inp_media \""; stream.write(p->inp_media, 3);
666 stream << "\"\n\t n_tape_id \""; stream.write(p->n_tape_id, 4);
667 stream << "\"\n\t tape_id[0] \""; stream.write(p->tape_id[0], 8);
668 stream << "\"\n\t exp_ing_start \""; stream.write(p->exp_ing_start,21);
669 stream << "\"\n\t exp_ing_stop \""; stream.write(p->exp_ing_stop, 21);
670 stream << "\"\n\t act_ing_start \""; stream.write(p->act_ing_start,21);
671 stream << "\"\n\t act_ing_stop \""; stream.write(p->act_ing_stop, 21);
672 stream << "\"\n\t proc_start \""; stream.write(p->proc_start, 21);
673 stream << "\"\n\t proc_stop \""; stream.write(p->proc_stop, 21);
674 stream << "\"\n\t mn_sig_lev[0] \""; stream.write(p->mn_sig_lev[0],16);
675 stream << "\"\n\t mn_sig_lev[1] \""; stream.write(p->mn_sig_lev[1],16);
676 stream << "\"\n\t mn_sig_lev[2] \""; stream.write(p->mn_sig_lev[2],16);
677 stream << "\"\n\t mn_sig_lev[3] \""; stream.write(p->mn_sig_lev[3],16);
678 stream << "\"\n\t mn_sig_lev[4] \""; stream.write(p->mn_sig_lev[4],16);
679 stream << "\"\n\t mn_sig_lev[5] \""; stream.write(p->mn_sig_lev[5],16);
680 stream << "\"\n\t mn_sig_lev[6] \""; stream.write(p->mn_sig_lev[6],16);
681 stream << "\"\n\t mn_sig_lev[7] \""; stream.write(p->mn_sig_lev[7],16);
682 stream << "\"\n\t mn_sig_lev[8] \""; stream.write(p->mn_sig_lev[8],16);
683 stream << "\"\n\t mn_sig_lev[9] \""; stream.write(p->mn_sig_lev[9],16);
684 stream << "\"\n\t scr_data_ind \""; stream.write(p->scr_data_ind, 4);
685 stream << "\"\n\t miss_ln \""; stream.write(p->miss_ln, 8);
686 stream << "\"\n\t rej_ln \""; stream.write(p->rej_ln, 8);
687 stream << "\"\n\t large_gap \""; stream.write(p->large_gap, 8);
688 stream << "\"\n\t bit_err_rate \""; stream.write(p->bit_err_rate, 16);
689 stream << "\"\n\t fm_crc_err \""; stream.write(p->fm_crc_err, 16);
690 stream << "\"\n\t date_incons \""; stream.write(p->date_incons, 8);
691 stream << "\"\n\t prf_changes \""; stream.write(p->prf_changes, 8);
692 stream << "\"\n\t delay_changes \""; stream.write(p->delay_changes, 8);
693 stream << "\"\n\t skipd_frams \""; stream.write(p->skipd_frams, 8);
694 stream << "\"\n\t rej_bf_start \""; stream.write(p->rej_bf_start, 8);
695 stream << "\"\n\t rej_few_fram \""; stream.write(p->rej_few_fram, 8);
696 stream << "\"\n\t rej_many_fram \""; stream.write(p->rej_many_fram, 8);
697 stream << "\"\n\t rej_mchn_err \""; stream.write(p->rej_mchn_err, 8);
698 stream << "\"\n\t rej_vchn_err \""; stream.write(p->rej_vchn_err, 8);
699 stream << "\"\n\t rej_rec_type \""; stream.write(p->rej_rec_type, 8);
700 stream << "\"\n\t sens_config \""; stream.write(p->sens_config, 10);
701 stream << "\"\n\t sens_orient \""; stream.write(p->sens_orient, 9);
702 stream << "\"\n\t sych_marker \""; stream.write(p->sych_marker, 8);
703 stream << "\"\n\t rng_ref_src \""; stream.write(p->rng_ref_src, 12);
704 stream << "\"\n\t rng_amp_coef[0] \"";
705 stream.write(p->rng_amp_coef[0],16);
706 stream << "\"\n\t rng_amp_coef[1] \"";
707 stream.write(p->rng_amp_coef[1],16);
708 stream << "\"\n\t rng_amp_coef[2] \"";
709 stream.write(p->rng_amp_coef[2],16);
710 stream << "\"\n\t rng_amp_coef[3] \"";
711 stream.write(p->rng_amp_coef[3],16);
712 stream << "\"\n\t rng_phas_coef[0] \"";
713 stream.write(p->rng_phas_coef[0], 16);
714 stream << "\"\n\t rng_phas_coef[1] \"";
715 stream.write(p->rng_phas_coef[1], 16);
716 stream << "\"\n\t rng_phas_coef[2] \"";
717 stream.write(p->rng_phas_coef[2], 16);
718 stream << "\"\n\t rng_phas_coef[3] \"";
719 stream.write(p->rng_phas_coef[3], 16);
720 stream << "\"\n\t err_amp_coef[0] \"";
721 stream.write(p->err_amp_coef[0],16);
722 stream << "\"\n\t err_amp_coef[1] \"";
723 stream.write(p->err_amp_coef[1],16);
724 stream << "\"\n\t err_amp_coef[2] \"";
725 stream.write(p->err_amp_coef[2],16);
726 stream << "\"\n\t err_amp_coef[3] \"";
727 stream.write(p->err_amp_coef[3],16);
728 stream << "\"\n\t err_phas_coef[0] \"";
729 stream.write(p->err_phas_coef[0], 16);
730 stream << "\"\n\t err_phas_coef[1] \"";
731 stream.write(p->err_phas_coef[1], 16);
732 stream << "\"\n\t err_phas_coef[2] \"";
733 stream.write(p->err_phas_coef[2], 16);
734 stream << "\"\n\t err_phas_coef[3] \"";
735 stream.write(p->err_phas_coef[3], 16);
736 stream << "\"\n\t pulse_bandw \""; stream.write(p->pulse_bandw, 4);
737 stream << "\"\n\t adc_samp_rate \""; stream.write(p->adc_samp_rate, 5);
738 stream << "\"\n\t rep_agc_attn \""; stream.write(p->rep_agc_attn, 16);
739 stream << "\"\n\t gn_corctn_fctr \"";
740 stream.write(p->gn_corctn_fctr, 16);
741 stream << "\"\n\t rep_energy_gn \""; stream.write(p->rep_energy_gn,16);
742 stream << "\"\n\t orb_data_src \""; stream.write(p->orb_data_src, 11);
743 stream << "\"\n\t pulse_cnt_1 \""; stream.write(p->pulse_cnt_1, 4);
744 stream << "\"\n\t pulse_cnt_2 \""; stream.write(p->pulse_cnt_2, 4);
745 stream << "\"\n\t beam_edge_rqd \""; stream.write(p->beam_edge_rqd, 3);
746 stream << "\"\n\t beam_edge_conf \"";
747 stream.write(p->beam_edge_conf, 16);
748 stream << "\"\n\t pix_overlap \""; stream.write(p->pix_overlap, 4);
749 stream << "\"\n\t n_beams \""; stream.write(p->n_beams, 4);
750 stream << "\"\n\t [Use debugger to view contents of beam_info record] ";
751 stream << "\n\t n_pix_updates \""; stream.write(p->n_pix_updates, 4);
752 stream << "\"\n\t [Use debugger to view contents of pix_count record] ";
753 stream << "\n\t pwin_start \""; stream.write(p->pwin_start, 16);
754 stream << "\"\n\t pwin_end \""; stream.write(p->pwin_end, 16);
755 stream << "\"\n\t recd_type \""; stream.write(p->recd_type, 9);
756 stream << "\"\n\t temp_set_inc \""; stream.write(p->temp_set_inc, 16);
757 stream << "\"\n\t n_temp_set \""; stream.write(p->n_temp_set, 4);
758 stream << "\"\n\t [Use debugger to view contents of temp record] ";
759 stream << "\n\t n_image_pix \""; stream.write(p->n_image_pix, 8);
760 stream << "\"\n\t prc_zero_pix \""; stream.write(p->prc_zero_pix, 16);
761 stream << "\"\n\t prc_satur_pix \""; stream.write(p->prc_satur_pix,16);
762 stream << "\"\n\t img_hist_mean \""; stream.write(p->img_hist_mean,16);
763 stream << "\"\n\t img_cumu_dist[0] \"";
764 stream.write(p->img_cumu_dist[0], 16);
765 stream << "\"\n\t img_cumu_dist[1] \"";
766 stream.write(p->img_cumu_dist[1], 16);
767 stream << "\"\n\t img_cumu_dist[2] \"";
768 stream.write(p->img_cumu_dist[2], 16);
769 stream << "\"\n\t pre_img_gn \""; stream.write(p->pre_img_gn, 16);
770 stream << "\"\n\t post_img_gn \""; stream.write(p->post_img_gn, 16);
771 stream << "\"\n\t dopcen_inc \""; stream.write(p->dopcen_inc, 16);
772 stream << "\"\n\t n_dopcen \""; stream.write(p->n_dopcen, 4);
773 stream << "\"\n\t [Use debugger to view contents of dopcen_est record] ";
774 stream << "\n\t dop_amb_err \""; stream.write(p->dop_amb_err, 4);
775 stream << "\"\n\t dopamb_conf \""; stream.write(p->dopamb_conf, 16);
776 stream << "\"\n\t eph_orb_data[0] \"";
777 stream.write(p->eph_orb_data[0],16);
778 stream << "\"\n\t eph_orb_data[1] \"";
779 stream.write(p->eph_orb_data[1],16);
780 stream << "\"\n\t eph_orb_data[2] \"";
781 stream.write(p->eph_orb_data[2],16);
782 stream << "\"\n\t eph_orb_data[3] \"";
783 stream.write(p->eph_orb_data[3],16);
784 stream << "\"\n\t eph_orb_data[4] \"";
785 stream.write(p->eph_orb_data[4],16);
786 stream << "\"\n\t eph_orb_data[5] \"";
787 stream.write(p->eph_orb_data[5],16);
788 stream << "\"\n\t eph_orb_data[6] \"";
789 stream.write(p->eph_orb_data[6],16);
790 stream << "\"\n\t appl_type \""; stream.write(p->appl_type, 12);
791 stream << "\"\n\t slow_time_coef[1] \"";
792 stream.write(p->slow_time_coef[1], 22);
793 stream << "\"\n\t slow_time_coef[2] \"";
794 stream.write(p->slow_time_coef[2], 22);
795 stream << "\"\n\t slow_time_coef[3] \"";
796 stream.write(p->slow_time_coef[3], 22);
797 stream << "\"\n\t slow_time_coef[4] \"";
798 stream.write(p->slow_time_coef[4], 22);
799 stream << "\"\n\t n_srgr \""; stream.write(p->n_srgr, 4);
800 stream << "\"\n\t [Use debugger to view contents of srgr_coefset record]";
801 stream << "\n\t pixel_spacing \""; stream.write(p->pixel_spacing,16);
802 stream << "\"\n\t gics_reqd \""; stream.write(p->gics_reqd, 3);
803 stream << "\"\n\t wo_number \""; stream.write(p->wo_number, 8);
804 stream << "\"\n\t wo_date \""; stream.write(p->wo_date, 20);
805 stream << "\"\n\t satellite_id \""; stream.write(p->satellite_id, 10);
806 stream << "\"\n\t user_id \""; stream.write(p->user_id, 20);
807 stream << "\"\n\t complete_msg \""; stream.write(p->complete_msg, 3);
808 stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 5);
809 stream << "\"\n\t density_in \""; stream.write(p->density_in, 4);
810 stream << "\"\n\t media_id \""; stream.write(p->media_id, 8);
811 stream << "\"\n\t angle_first \""; stream.write(p->angle_first, 16);
812 stream << "\"\n\t angle_last \""; stream.write(p->angle_last, 16);
813 stream << "\"\n\t prod_type \""; stream.write(p->prod_type, 3);
814 stream << "\"\n\t map_system \""; stream.write(p->map_system, 16);
815 stream << "\"\n\t centre_lat \""; stream.write(p->centre_lat, 22);
816 stream << "\"\n\t centre_long \""; stream.write(p->centre_long, 22);
817 stream << "\"\n\t span_x \""; stream.write(p->span_x, 22);
818 stream << "\"\n\t span_y \""; stream.write(p->span_y, 22);
819 stream << "\"\n\t apply_dtm \""; stream.write(p->apply_dtm, 3);
820 stream << "\"\n\t density_out \""; stream.write(p->density_out, 4);
821 stream << "\"\n\t state_time \""; stream.write(p->state_time, 21);
822 stream << "\"\n\t num_state_vectors \"";
823 stream.write(p->num_state_vectors, 4);
824 stream << "\"\n\t state_time_inc \"";
825 stream.write(p->state_time_inc, 16);
826 stream << "\"" << endl;
827 }
828
829 //******************************************************************************
830 // PRIVATE METHOD: ossimCeosData::dumpMapProjRec()
831 //
832 //******************************************************************************
dumpMapProjRec(ostream & stream) const833 void ossimCeosData::dumpMapProjRec(ostream& stream) const
834 {
835 const map_proj_rec* p = theMapProjRec;
836
837 stream << "\n\n\tContents of map_proj_rec:\n\t";
838 stream << "\n\t spare1 \""; stream.write(p->spare1, 16);
839 stream << "\"\n\t map_desc \""; stream.write(p->map_desc, 32);
840 stream << "\"\n\t n_pixel \""; stream.write(p->n_pixel, 16);
841 stream << "\"\n\t n_line \""; stream.write(p->n_line, 16);
842 stream << "\"\n\t pixel_spacing \""; stream.write(p->pixel_spacing,16);
843 stream << "\"\n\t line_spacing \""; stream.write(p->line_spacing, 16);
844 stream << "\"\n\t osc_orient \""; stream.write(p->osc_orient, 16);
845 stream << "\"\n\t orb_incl \""; stream.write(p->orb_incl, 16);
846 stream << "\"\n\t asc_node \""; stream.write(p->asc_node, 16);
847 stream << "\"\n\t isc_dist \""; stream.write(p->isc_dist, 16);
848 stream << "\"\n\t geo_alt \""; stream.write(p->geo_alt, 16);
849 stream << "\"\n\t isc_vel \""; stream.write(p->isc_vel, 16);
850 stream << "\"\n\t plat_head \""; stream.write(p->plat_head, 16);
851 stream << "\"\n\t ref_ellip \""; stream.write(p->ref_ellip, 32);
852 stream << "\"\n\t semi_major \""; stream.write(p->semi_major, 16);
853 stream << "\"\n\t semi_minor \""; stream.write(p->semi_minor, 16);
854 stream << "\"\n\t datum_shift[0] \"";
855 stream.write(p->datum_shift[0], 16);
856 stream << "\"\n\t datum_shift[1] \"";
857 stream.write(p->datum_shift[1], 16);
858 stream << "\"\n\t datum_shift[2] \"";
859 stream.write(p->datum_shift[2], 16);
860 stream << "\"\n\t aux_datum_shift[0] \"";
861 stream.write(p->aux_datum_shift[0], 16);
862 stream << "\"\n\t aux_datum_shift[1] \"";
863 stream.write(p->aux_datum_shift[1], 16);
864 stream << "\"\n\t aux_datum_shift[2] \"";
865 stream.write(p->aux_datum_shift[2], 16);
866 stream << "\"\n\t scal_ellip \""; stream.write(p->scal_ellip, 16);
867 stream << "\"\n\t proj_desc \""; stream.write(p->proj_desc, 32);
868 stream << "\"\n\t utm_desc \""; stream.write(p->utm_desc, 32);
869 stream << "\"\n\t utm_zone_sig \""; stream.write(p->utm_zone_sig, 4);
870 stream << "\"\n\t utm_east_orig \""; stream.write(p->utm_east_orig,16);
871 stream << "\"\n\t utm_north_orig \"";
872 stream.write(p->utm_north_orig, 16);
873 stream << "\"\n\t utm_cent_long \""; stream.write(p->utm_cent_long,16);
874 stream << "\"\n\t utm_cent_lat \""; stream.write(p->utm_cent_lat, 16);
875 stream << "\"\n\t utm_stand_par[0] \"";
876 stream.write(p->utm_stand_par[0], 16);
877 stream << "\"\n\t utm_stand_par[1] \"";
878 stream.write(p->utm_stand_par[1], 16);
879 stream << "\"\n\t utm_scale \""; stream.write(p->utm_scale, 16);
880 stream << "\"\n\t ups_desc \""; stream.write(p->ups_desc, 32);
881 stream << "\"\n\t ups_cent_long \""; stream.write(p->ups_cent_long,16);
882 stream << "\"\n\t ups_cent_lat \""; stream.write(p->ups_cent_lat, 16);
883 stream << "\"\n\t ups_scale \""; stream.write(p->ups_scale, 16);
884 stream << "\"\n\t nsp_desc \""; stream.write(p->nsp_desc, 32);
885 stream << "\"\n\t nsp_east_orig \""; stream.write(p->nsp_east_orig,16);
886 stream << "\"\n\t nsp_north_orig \"";
887 stream.write(p->nsp_north_orig,16);
888 stream << "\"\n\t nsp_cent_long \""; stream.write(p->nsp_cent_long,16);
889 stream << "\"\n\t nsp_cent_lat \""; stream.write(p->nsp_cent_lat, 16);
890 stream << "\"\n\t nsp_stand_par[0] \"";
891 stream.write(p->nsp_stand_par[0], 16);
892 stream << "\"\n\t nsp_stand_par[1] \"";
893 stream.write(p->nsp_stand_par[1], 16);
894 stream << "\"\n\t nsp_stand_par[2] \"";
895 stream.write(p->nsp_stand_par[2], 16);
896 stream << "\"\n\t nsp_stand_par[3] \"";
897 stream.write(p->nsp_stand_par[3], 16);
898 stream << "\"\n\t nsp_stand_mer[0] \"";
899 stream.write(p->nsp_stand_mer[0], 16);
900 stream << "\"\n\t nsp_stand_mer[1] \"";
901 stream.write(p->nsp_stand_mer[1], 16);
902 stream << "\"\n\t nsp_stand_mer[2] \"";
903 stream.write(p->nsp_stand_mer[2], 16);
904 stream << "\"\n\t nsp_spare[0] \""; stream.write(p->nsp_spare[0], 16);
905 stream << "\"\n\t nsp_spare[1] \""; stream.write(p->nsp_spare[1], 16);
906 stream << "\"\n\t nsp_spare[2] \""; stream.write(p->nsp_spare[2], 16);
907 stream << "\"\n\t nsp_spare[3] \""; stream.write(p->nsp_spare[3], 16);
908 stream << "\"\n\t corner_ne[0] \""; stream.write(p->corner_ne[0], 16);
909 stream << "\"\n\t corner_ne[1] \""; stream.write(p->corner_ne[1], 16);
910 stream << "\"\n\t corner_ne[2] \""; stream.write(p->corner_ne[2], 16);
911 stream << "\"\n\t corner_ne[3] \""; stream.write(p->corner_ne[3], 16);
912 stream << "\"\n\t corner_ne[4] \""; stream.write(p->corner_ne[4], 16);
913 stream << "\"\n\t corner_ne[5] \""; stream.write(p->corner_ne[5], 16);
914 stream << "\"\n\t corner_ne[6] \""; stream.write(p->corner_ne[6], 16);
915 stream << "\"\n\t corner_ne[7] \""; stream.write(p->corner_ne[7], 16);
916 stream << "\"\n\t corner_ll[0] \""; stream.write(p->corner_ll[0], 16);
917 stream << "\"\n\t corner_ll[1] \""; stream.write(p->corner_ll[1], 16);
918 stream << "\"\n\t corner_ll[2] \""; stream.write(p->corner_ll[2], 16);
919 stream << "\"\n\t corner_ll[3] \""; stream.write(p->corner_ll[3], 16);
920 stream << "\"\n\t corner_ll[4] \""; stream.write(p->corner_ll[4], 16);
921 stream << "\"\n\t corner_ll[5] \""; stream.write(p->corner_ll[5], 16);
922 stream << "\"\n\t corner_ll[6] \""; stream.write(p->corner_ll[6], 16);
923 stream << "\"\n\t corner_ll[7] \""; stream.write(p->corner_ll[7], 16);
924 stream << "\"\n\t terr_height[0] \"";
925 stream.write(p->terr_height[0], 16);
926 stream << "\"\n\t terr_height[1] \"";
927 stream.write(p->terr_height[1], 16);
928 stream << "\"\n\t terr_height[2] \"";
929 stream.write(p->terr_height[2], 16);
930 stream << "\"\n\t terr_height[3] \"";
931 stream.write(p->terr_height[3], 16);
932 stream << "\"\n\t lp_conv_coef[0] \"";
933 stream.write(p->lp_conv_coef[0],20);
934 stream << "\"\n\t lp_conv_coef[1] \"";
935 stream.write(p->lp_conv_coef[1],20);
936 stream << "\"\n\t lp_conv_coef[2] \"";
937 stream.write(p->lp_conv_coef[2],20);
938 stream << "\"\n\t lp_conv_coef[3] \"";
939 stream.write(p->lp_conv_coef[3],20);
940 stream << "\"\n\t lp_conv_coef[4] \"";
941 stream.write(p->lp_conv_coef[4],20);
942 stream << "\"\n\t lp_conv_coef[5] \"";
943 stream.write(p->lp_conv_coef[5],20);
944 stream << "\"\n\t lp_conv_coef[6] \"";
945 stream.write(p->lp_conv_coef[6],20);
946 stream << "\"\n\t lp_conv_coef[7] \"";
947 stream.write(p->lp_conv_coef[7],20);
948 stream << "\"\n\t mp_conv_coef[0] \"";
949 stream.write(p->mp_conv_coef[0],20);
950 stream << "\"\n\t mp_conv_coef[1] \"";
951 stream.write(p->mp_conv_coef[1],20);
952 stream << "\"\n\t mp_conv_coef[2] \"";
953 stream.write(p->mp_conv_coef[2],20);
954 stream << "\"\n\t mp_conv_coef[3] \"";
955 stream.write(p->mp_conv_coef[3],20);
956 stream << "\"\n\t mp_conv_coef[4] \"";
957 stream.write(p->mp_conv_coef[4],20);
958 stream << "\"\n\t mp_conv_coef[5] \"";
959 stream.write(p->mp_conv_coef[5],20);
960 stream << "\"\n\t mp_conv_coef[6] \"";
961 stream.write(p->mp_conv_coef[6],20);
962 stream << "\"\n\t mp_conv_coef[7] \"";
963 stream.write(p->mp_conv_coef[7],20);
964 stream << "\"\n\t dem_type \""; stream.write(p->dem_type, 4);
965 stream << "\"\n\t spare3 \""; stream.write(p->spare3, 32);
966 stream << "\"" << endl;
967 }
968
969 //******************************************************************************
970 // PRIVATE METHOD: ossimCeosData::dumpPosDataRec()
971 //
972 //******************************************************************************
dumpPosDataRec(ostream & stream) const973 void ossimCeosData::dumpPosDataRec(ostream& stream) const
974 {
975 const pos_data_rec* p = thePosDataRec;
976
977 stream << "\n\n\tContents of pos_data_rec:\n\t";
978 stream << "\n\t orbit_ele_desg \""; stream.write(p->orbit_ele_desg, 32);
979 stream << "\"\n\t orbit_ele[0] \""; stream.write(p->orbit_ele[0], 16);
980 stream << "\"\n\t orbit_ele[1] \""; stream.write(p->orbit_ele[1], 16);
981 stream << "\"\n\t orbit_ele[2] \""; stream.write(p->orbit_ele[2], 16);
982 stream << "\"\n\t orbit_ele[3] \""; stream.write(p->orbit_ele[3], 16);
983 stream << "\"\n\t orbit_ele[4] \""; stream.write(p->orbit_ele[4], 16);
984 stream << "\"\n\t orbit_ele[5] \""; stream.write(p->orbit_ele[5], 16);
985 stream << "\"\n\t ndata \""; stream.write(p->ndata, 4);
986 stream << "\"\n\t year \""; stream.write(p->year, 4);
987 stream << "\"\n\t month \""; stream.write(p->month, 4);
988 stream << "\"\n\t day \""; stream.write(p->day, 4);
989 stream << "\"\n\t gmt_day \""; stream.write(p->gmt_day, 4);
990 stream << "\"\n\t gmt_sec \""; stream.write(p->gmt_sec, 22);
991 stream << "\"\n\t data_int \""; stream.write(p->data_int, 22);
992 stream << "\"\n\t ref_coord \""; stream.write(p->ref_coord, 64);
993 stream << "\"\n\t hr_angle \""; stream.write(p->hr_angle, 22);
994 stream << "\"\n\t alt_poserr \""; stream.write(p->alt_poserr, 16);
995 stream << "\"\n\t crt_poserr \""; stream.write(p->crt_poserr, 16);
996 stream << "\"\n\t rad_poserr \""; stream.write(p->rad_poserr, 16);
997 stream << "\"\n\t alt_velerr \""; stream.write(p->alt_velerr, 16);
998 stream << "\"\n\t crt_velerr \""; stream.write(p->crt_velerr, 16);
999 stream << "\"\n\t rad_velerr \""; stream.write(p->rad_velerr, 16);
1000 stream << "\"\n\t [Use debugger to view contents of pos_vect record]";
1001 stream << endl;
1002 }
1003
1004 //******************************************************************************
1005 // PRIVATE METHOD: ossimCeosData::dumpAttDataRec()
1006 //
1007 //******************************************************************************
dumpAttDataRec(ostream & stream) const1008 void ossimCeosData::dumpAttDataRec(ostream& stream) const
1009 {
1010 const att_data_rec* p = theAttDataRec;
1011
1012 stream << "\n\n\tContents of att_data_rec:\n\t";
1013 stream << "\n\t npoint \""; stream.write(p->npoint, 4);
1014 stream << "\"\n\t [Use debugger to view contents of att_vect record]";
1015 stream << "\n\t pitch_bias \""; stream.write(p->pitch_bias, 14);
1016 stream << "\"\n\t roll_bias \""; stream.write(p->roll_bias, 14);
1017 stream << "\"\n\t yaw_bias \""; stream.write(p->yaw_bias, 14);
1018 stream << "\"" << endl;
1019 }
1020
1021 //******************************************************************************
1022 // PRIVATE METHOD: ossimCeosData::dumpRadiDataRec()
1023 //
1024 //******************************************************************************
dumpRadiDataRec(ostream & stream) const1025 void ossimCeosData::dumpRadiDataRec(ostream& stream) const
1026 {
1027 const radi_data_rec* p = theRadiDataRec;
1028
1029 stream << "\n\n\tContents of radi_data_rec:\n\t";
1030 stream << "\n\t seq_num \""; stream.write(p->seq_num, 4);
1031 stream << "\"\n\t n_data \""; stream.write(p->n_data, 4);
1032 stream << "\"\n\t field_size \""; stream.write(p->field_size, 8);
1033 stream << "\"\n\t [Use debugger to view contents of dset record]";
1034 stream << endl;
1035 }
1036
1037 //******************************************************************************
1038 // PRIVATE METHOD: ossimCeosData::dumpRadiCompRec()
1039 //
1040 //******************************************************************************
dumpRadiCompRec(ostream & stream) const1041 void ossimCeosData::dumpRadiCompRec(ostream& stream) const
1042 {
1043 const radi_comp_rec* p = theRadiCompRec;
1044
1045 stream << "\n\n\tContents of radi_comp_rec:\n\t";
1046 stream << "\n\t seq_num \""; stream.write(p->seq_num, 4);
1047 stream << "\"\n\t chan_ind \""; stream.write(p->chan_ind, 4);
1048 stream << "\"\n\t n_dset \""; stream.write(p->n_dset, 8);
1049 stream << "\"\n\t dset_size \""; stream.write(p->dset_size, 8);
1050 stream << "\"\n\t [Use debugger to view contents of dset record]";
1051 stream << endl;
1052 }
1053
1054
1055 //*****************************************************************************
1056 // PRIVATE METHOD: ossimCeosData::loadCeosRecords()
1057 //
1058 // Reads the data files and initializes the data members.
1059 //
1060 //*****************************************************************************
loadCeosRecords()1061 void ossimCeosData::loadCeosRecords()
1062 {
1063 static const char MODULE[] = "ossimCeosData::loadCeosFile()";
1064 if (traceExec()) CLOG << " Entered method." << endl;
1065
1066 int sizeOfRec;
1067 char bufI6[] = "123456";
1068 int numRecords;
1069
1070 //***
1071 // Open Volume Directory File and parse:
1072 //***
1073 FILE* fptr = fopen(theVolDirFileName.chars(), "r");
1074 if (!fptr)
1075 {
1076 if(traceDebug())
1077 {
1078 CLOG << " ERROR:\n\tCannot open CEOS Volume Directory file: "
1079 << theVolDirFileName << endl;
1080 }
1081 theErrorStatus = ERROR;
1082 return;
1083 }
1084 sizeOfRec = sizeof(theVolumeDirectory);
1085 fread(&theVolumeDirectory, sizeOfRec, 1, fptr);
1086 fclose(fptr);
1087 theVolDescRec = &theVolumeDirectory.volDescRec;
1088 theTextRec = &theVolumeDirectory.textRec;
1089
1090 if (traceDebug())
1091 {
1092 CLOG << "DEBUG\n -- List of Records Present ---" << endl;
1093 }
1094
1095 //***
1096 // Open and parse Leader File:
1097 //***
1098 if (!theLeaderFileName.empty())
1099 {
1100 fptr = fopen(theLeaderFileName.chars(), "r");
1101 if (!fptr)
1102 {
1103 if(traceDebug())
1104 {
1105 CLOG << " ERROR:\n\tCannot open CEOS Leader file: "
1106 << theLeaderFileName << endl;
1107 }
1108 theErrorStatus = ERROR;
1109 return;
1110 }
1111 fread(&(theSarLeaderFile.sarDescRec), 720, 1, fptr);
1112
1113 //***
1114 // Establish which CEOS records are in the leader file, and read them.
1115 // First the dataset summary record:
1116 //***
1117 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_dataset, 6);
1118 numRecords = atoi(bufI6);
1119 if (numRecords)
1120 {
1121 fread(&theSarLeaderFile.dataSetSumRec, sizeOfNextRec(fptr), 1, fptr);
1122 theDataSetSumRec = &(theSarLeaderFile.dataSetSumRec);
1123 if (traceDebug()) clog << "\t Leader: dataSetSumRec" << endl;
1124 }
1125
1126 //***
1127 // Data quality summary record:
1128 //***
1129 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_qual_sum, 6);
1130 numRecords = atoi(bufI6);
1131 if (numRecords)
1132 {
1133 fread(&(theSarLeaderFile.qualSumRec), sizeOfNextRec(fptr), 1, fptr);
1134 theQualSumRec = &(theSarLeaderFile.qualSumRec);
1135 if (traceDebug()) clog << "\t Leader: qualSumRec" << endl;
1136 }
1137
1138 //***
1139 // Histogram records:
1140 //***
1141 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_data_hist, 6);
1142 numRecords = atoi(bufI6);
1143 if (numRecords)
1144 {
1145 fread(&(theSarLeaderFile.sdrHistRec), sizeOfNextRec(fptr), 1, fptr);
1146 theSdrHistRec = &(theSarLeaderFile.sdrHistRec);
1147 fread(&(theSarLeaderFile.pdr16HistRec), sizeOfNextRec(fptr), 1, fptr);
1148 thePdr16HistRec = &(theSarLeaderFile.pdr16HistRec);
1149 if (traceDebug()) clog << "\t Leader: sdrHistRec & pdr16HistRec"
1150 << endl;
1151 }
1152
1153 //***
1154 // Processing parameter record:
1155 //***
1156 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_det_proc, 6);
1157 numRecords = atoi(bufI6);
1158 if (numRecords)
1159 {
1160 fread(&(theSarLeaderFile.procParmRec), sizeOfNextRec(fptr), 1, fptr);
1161 theProcParmRec = &(theSarLeaderFile.procParmRec);
1162 if (traceDebug()) clog << "\t Leader: procParmRec" << endl;
1163 }
1164
1165 //***
1166 // Map projection record:
1167 //***
1168 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_map_proj, 6);
1169 numRecords = atoi(bufI6);
1170 if (numRecords)
1171 {
1172 fread(&(theSarLeaderFile.mapProjRec), sizeOfNextRec(fptr), 1, fptr);
1173 theMapProjRec = &(theSarLeaderFile.mapProjRec);
1174 if (traceDebug()) clog << "\t Leader: mapProjRec" << endl;
1175 }
1176
1177 //***
1178 // Position data record:
1179 //***
1180 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_plat_pos, 6);
1181 numRecords = atoi(bufI6);
1182 if (numRecords)
1183 {
1184 fread(&(theSarLeaderFile.posDataRec), sizeOfNextRec(fptr), 1, fptr);
1185 thePosDataRec = &(theSarLeaderFile.posDataRec);
1186 if (traceDebug()) clog << "\t Leader: posDataRec" << endl;
1187 }
1188
1189 //***
1190 // Attitude data record:
1191 //***
1192 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_att_data, 6);
1193 numRecords = atoi(bufI6);
1194 if (numRecords)
1195 {
1196 fread(&(theSarLeaderFile.attDataRec), sizeOfNextRec(fptr), 1, fptr);
1197 theAttDataRec = &(theSarLeaderFile.attDataRec);
1198 if (traceDebug()) clog << "\t Leader: attDataRec" << endl;
1199 }
1200
1201 //***
1202 // Radiometric data record:
1203 //***
1204 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_radi_data, 6);
1205 numRecords = atoi(bufI6);
1206 if (numRecords)
1207 {
1208 fread(&(theSarLeaderFile.radiDataRec), sizeOfNextRec(fptr), 1, fptr);
1209 theRadiDataRec = &(theSarLeaderFile.radiDataRec);
1210 if (traceDebug()) clog << "\t Leader: radiDataRec" << endl;
1211 }
1212
1213 //***
1214 // Radiometric compensation data record:
1215 //***
1216 strncpy(bufI6, theSarLeaderFile.sarDescRec.n_radi_comp, 6);
1217 numRecords = atoi(bufI6);
1218 if (numRecords)
1219 {
1220 fread(&(theSarLeaderFile.radiCompRec), sizeOfNextRec(fptr), 1, fptr);
1221 theRadiCompRec = &(theSarLeaderFile.radiCompRec);
1222 if (traceDebug()) clog << "\t Leader: radiCompRec" << endl;
1223 }
1224
1225 fclose(fptr);
1226 }
1227
1228 //***
1229 // Open and parse CEOS SAR data File to read the image options:
1230 //***
1231 fptr = fopen(theImageFileName.chars(), "r");
1232 if (!fptr)
1233 {
1234 CLOG << " ERROR:\n\tCannot open CEOS image file: " << theImageFileName
1235 << endl;
1236 theErrorStatus = ERROR;
1237 return;
1238 }
1239 sizeOfRec = sizeof(theImopDescRec);
1240 fread(&theImopDescRec, sizeOfRec, 1, fptr);
1241 fclose(fptr);
1242
1243 //***
1244 // Open and parse trailer file:
1245 //***
1246 if (!theTrailerFileName.empty())
1247 {
1248 fptr = fopen(theTrailerFileName.chars(), "r");
1249 if (!fptr)
1250 {
1251 CLOG << " ERROR:\n\tCannot open CEOS Trailer file: "
1252 << theTrailerFileName << endl;
1253 theErrorStatus = ERROR;
1254 return;
1255 }
1256 fread(&(theSarTrailerFile.sarDescRec), 720, 1, fptr);
1257
1258 //***
1259 // Establish which CEOS records are in the Trailer file, and read them.
1260 // First the dataset summary record:
1261 //***
1262 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_dataset, 6);
1263 numRecords = atoi(bufI6);
1264 if (numRecords)
1265 {
1266 fread(&(theSarTrailerFile.dataSetSumRec), sizeOfNextRec(fptr),1, fptr);
1267 theDataSetSumRec = &(theSarTrailerFile.dataSetSumRec);
1268 if (traceDebug()) clog << "\t Trailer: dataSetSumRec" << endl;
1269 }
1270
1271 //***
1272 // Data quality summary record:
1273 //***
1274 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_qual_sum, 6);
1275 numRecords = atoi(bufI6);
1276 if (numRecords)
1277 {
1278 fread(&(theSarTrailerFile.qualSumRec), sizeOfNextRec(fptr), 1, fptr);
1279 theQualSumRec = &(theSarTrailerFile.qualSumRec);
1280 if (traceDebug()) clog << "\t Trailer: qualSumRec" << endl;
1281 }
1282
1283 //***
1284 // Histogram records:
1285 //***
1286 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_data_hist, 6);
1287 numRecords = atoi(bufI6);
1288 if (numRecords)
1289 {
1290 fread(&(theSarTrailerFile.sdrHistRec), sizeOfNextRec(fptr), 1, fptr);
1291 theSdrHistRec = &(theSarTrailerFile.sdrHistRec);
1292 fread(&(theSarTrailerFile.pdr8HistRec), 16920, 1, fptr);
1293 thePdr8HistRec = &(theSarTrailerFile.pdr8HistRec);
1294 if (traceDebug()) clog << "\t Trailer: sdrHistRec & pdr8HistRec"
1295 << endl;
1296 }
1297
1298 //***
1299 // Processing parameter record:
1300 //***
1301 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_det_proc, 6);
1302 numRecords = atoi(bufI6);
1303 if (numRecords)
1304 {
1305 fread(&(theSarTrailerFile.procParmRec), sizeOfNextRec(fptr), 1, fptr);
1306 theProcParmRec = &(theSarTrailerFile.procParmRec);
1307 if (traceDebug()) clog << "\t Trailer: procParmRec" << endl;
1308 }
1309
1310 //***
1311 // Attitude data record:
1312 //***
1313 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_att_data, 6);
1314 numRecords = atoi(bufI6);
1315 if (numRecords)
1316 {
1317 fread(&(theSarTrailerFile.attDataRec), sizeOfNextRec(fptr), 1, fptr);
1318 theAttDataRec = &(theSarTrailerFile.attDataRec);
1319 if (traceDebug()) clog << "\t Trailer: attDataRec" << endl;
1320 }
1321
1322 //***
1323 // Radiometric data record:
1324 //***
1325 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_radi_data, 6);
1326 numRecords = atoi(bufI6);
1327 if (numRecords)
1328 {
1329 fread(&(theSarTrailerFile.radiDataRec), sizeOfNextRec(fptr), 1, fptr);
1330 theRadiDataRec = &(theSarTrailerFile.radiDataRec);
1331 if (traceDebug()) clog << "\t Trailer: radiDataRec" << endl;
1332 }
1333
1334 //***
1335 // Radiometric compensation data record:
1336 //***
1337 strncpy(bufI6, theSarTrailerFile.sarDescRec.n_radi_comp, 6);
1338 numRecords = atoi(bufI6);
1339 if (numRecords)
1340 {
1341 fread(&(theSarTrailerFile.radiCompRec), sizeOfNextRec(fptr), 1, fptr);
1342 theRadiCompRec = &(theSarTrailerFile.radiCompRec);
1343 if (traceDebug()) clog << "\t Trailer: radiCompRec" << endl;
1344 }
1345
1346 fclose(fptr);
1347 }
1348
1349 if (traceExec()) CLOG << " Exiting method." << endl;
1350 }
1351
1352
1353 //******************************************************************************
1354 // PRIVATE METHOD: ossimCeosData::sizeOfNextRec(FILE*)
1355 //
1356 // Reads the descriptor record pointed to by the file ptr and returns the
1357 // size of the following record in bytes.
1358 //
1359 //******************************************************************************
sizeOfNextRec(FILE * fptr)1360 int ossimCeosData::sizeOfNextRec(FILE* fptr)
1361 {
1362 static const char MODULE[] = "ossimCeosData::sizeOfNextRec(FILE* fptr)";
1363 if (traceExec()) CLOG << "entering..." << endl;
1364
1365 static desc_rec descRec;
1366 static int DESC_REC_SIZE = 12;
1367
1368 fread(&descRec, DESC_REC_SIZE, 1, fptr);
1369 fseek(fptr, (long) -DESC_REC_SIZE, SEEK_CUR);
1370
1371 if (traceDebug())
1372 {
1373 CLOG << "DEBUG -- "
1374 << "\n\t length = " << descRec.length << endl;
1375 }
1376
1377 if (traceExec()) CLOG << "returning..." << endl;
1378 return descRec.length;
1379 }
1380