OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRadarSatModel.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // "Copyright Centre National d'Etudes Spatiales"
4 //
5 // License: LGPL
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
12 #include <cmath>
13 #include <cstdio>
14 
15 #include <ossim/base/ossimTrace.h>
17 
18 #include <ossimRadarSatModel.h>
19 #include <otb/GalileanEphemeris.h>
21 
22 #include <otb/JSDDateTime.h>
23 #include <otb/GMSTDateTime.h>
24 #include <otb/CivilDateTime.h>
25 
26 #include <otb/PlatformPosition.h>
27 #include <otb/SensorParams.h>
28 #include <otb/RefPoint.h>
29 #include <otb/SarSensor.h>
30 
33 
36 
40 
41 namespace ossimplugins
42 {
43 RTTI_DEF1(ossimRadarSatModel, "ossimRadarSatModel", ossimGeometricSarSensorModel);
44 
45 // Static trace for debugging
46 static ossimTrace traceDebug("ossimRadarSatModel:debug");
47 
50  _n_srgr(0),
51  _pixel_spacing(0),
52  _data(NULL),
53  _leader(NULL),
54  _trailer(NULL),
55  _volumeDir(NULL)
56 {
57 }
58 
61  _n_srgr(rhs._n_srgr),
62  _pixel_spacing(rhs._pixel_spacing),
63  _data(new Data(*(rhs._data))),
64  _leader(new Leader(*(rhs._leader))),
65  _trailer(new Trailer(*(rhs._trailer))),
66  _volumeDir(new VolumeDir(*(rhs._volumeDir)))
67 {
68 }
69 
71 {
72  if (_data != 0)
73  {
74  delete _data;
75  }
76 
77  if (_leader != 0)
78  {
79  delete _leader;
80  }
81 
82  if (_trailer != 0)
83  {
84  delete _trailer;
85  }
86 
87  if (_volumeDir != 0)
88  {
89  delete _volumeDir;
90  }
91 }
92 
94 {
95  return new ossimRadarSatModel(*this);
96 }
97 
99 {
100  return ossimString("ossimRadarSatModel");
101 }
102 
104 {
105  if (_n_srgr==0) return(-1) ;
106 
107  double relativeGroundRange ;
108 
109  // in the case of Georeferenced images, _refPoint->get_distance() contains the ground range
110  relativeGroundRange = _refPoint->get_distance() + _sensor->get_col_direction() * (col-_refPoint->get_pix_col())* _pixel_spacing ;
111 
112  int numSet = FindSRGRSetNumber((_refPoint->get_ephemeris())->get_date()) ;
117  double slantRange = _srgr_coefset[numSet][0]
118  + _srgr_coefset[numSet][1]*relativeGroundRange
119  + _srgr_coefset[numSet][2]*pow(relativeGroundRange,2)
120  + _srgr_coefset[numSet][3]*pow(relativeGroundRange,3)
121  + _srgr_coefset[numSet][4]*pow(relativeGroundRange,4)
122  + _srgr_coefset[numSet][5]*pow(relativeGroundRange,5);
123 
124  return slantRange ;
125 }
126 
128 {
129  //traceDebug.setTraceFlag(true);
130  if(traceDebug())
131  {
133  << "ossimRadarSatTileSource::open(filename) DEBUG: entered..."
134  << std::endl
135  << "Attempting to open file " << file << std::endl;
136  }
137 
138  bool retValue = true;
139  ossimFilename tempFilename = file;
140 
141  /*
142  * Detect if we use vdf file or dat file
143  */
144  ossimFilename dataFilePath;
145  ossimFilename volumeDirectoryFilePath;
146  std::string input_file = file;
147  string::size_type loc_DAT = input_file.find( "DAT_01", 0 );
148  string::size_type loc_dat = input_file.find( "dat_01", 0 );
149  if ( (loc_DAT != string::npos ) || ( loc_dat != string::npos ) )
150  {
151  dataFilePath = input_file.c_str();
152  if (loc_DAT != string::npos ) input_file.replace(loc_DAT, 6, "VDF_DAT");
153  if (loc_dat != string::npos ) input_file.replace(loc_dat, 6, "vdf_dat");
154  volumeDirectoryFilePath = input_file.c_str();
155  }
156  else
157  {
158  string::size_type loc_VDF = input_file.find( "VDF_DAT", 0 );
159  string::size_type loc_vdf = input_file.find( "vdf_dat", 0 );
160  if ( (loc_VDF != string::npos ) || ( loc_vdf != string::npos ) )
161  {
162  volumeDirectoryFilePath = input_file.c_str();
163  if (loc_VDF != string::npos ) input_file.replace(loc_VDF, 7, "DAT_01");
164  if (loc_vdf != string::npos ) input_file.replace(loc_vdf, 7, "dat_01");
165  dataFilePath = input_file.c_str();
166  }
167  else
168  {
169  if(traceDebug())
170  {
172  << "File Name not coherent (searching for *DAT_01* or *dat_01* or *vdf_dat* or *VDF_DAT* ) : " << file << std::endl;
173  }
174  return false;
175  }
176  }
177 
178  //Creation of the class allowing to store the metadata from the Volume Directory File
179  if (_volumeDir != NULL)
180  {
181  delete _volumeDir;
182  _volumeDir = NULL;
183  }
184  _volumeDir = new VolumeDir();
185 
186  //Creation of the class allowing to store the metadata from the Data file
187  if (_data != NULL)
188  {
189  delete _data;
190  _data = NULL;
191  }
192  _data = new Data();
193 
194  //Creation of the class allowing to store the metadata from the Leader file
195  if(_leader != NULL)
196  {
197  delete _leader;
198  _leader = NULL;
199  }
200  _leader = new Leader();
201 
202  // Creation of the class allowing to store the metadata from the Trailer file
203  if(_trailer != NULL)
204  {
205  delete _trailer;
206  _trailer = NULL;
207  }
208  _trailer = new Trailer();
209 
210 
211  RadarSatRecordHeader headerVDF;
212  VolumeDirFactory factoryVDF;
213  ifstream volumeDirFile (volumeDirectoryFilePath.c_str(), ios::in|ios::binary);
214  volumeDirFile>>headerVDF;
215  if(volumeDirFile.eof())
216  {
217  volumeDirFile.close();
218  retValue = false;
219  }
220  else
221  {
222  if(traceDebug())
223  {
224  ossimNotify(ossimNotifyLevel_DEBUG) << "Begin reading VDF file" << std::endl;
225  }
226 
227  RadarSatRecord* recordVDF = factoryVDF.Instanciate(headerVDF.get_rec_seq());
228  if (recordVDF != NULL && headerVDF.get_rec_seq() == 1)
229  {
230  recordVDF->Read(volumeDirFile);
231 
232  //Test if the input File is a valid Radarsat VDF file
233  if ((((VolumeDescriptorRecord*) recordVDF)->get_logvol_id()).substr(0, 10) == "RSAT-1-SAR")
234  {
235  std::string subProduct = (((VolumeDescriptorRecord*) recordVDF)->get_logvol_id()).substr(11, 3);
236  if ( (subProduct == "RAW") || (subProduct == "SPG") || (subProduct == "SSG") )
237  {
238  if(traceDebug())
239  ossimNotify(ossimNotifyLevel_DEBUG) << "RAW, SPG and SSG format are not supported" <<std::endl;
240 
241  volumeDirFile.close();
242  return false;
243  }
244  else if ( (subProduct == "SCN") || (subProduct == "SGX") || (subProduct == "SLC") )
245  {
246  if(traceDebug())
247  ossimNotify(ossimNotifyLevel_DEBUG) << "SCN, SGX and SLC format are supported but not tested" <<std::endl;
248  }
249  else if ( (subProduct == "SCW") || (subProduct == "SGF") )
250  {
251  if(traceDebug())
252  ossimNotify(ossimNotifyLevel_DEBUG) << "SCW and SGF format are supported and tested" <<std::endl;
253  }
254 
255  //Reading of the remaining of the volume directory file
256 
257  volumeDirFile.close();
258  volumeDirFile.open(volumeDirectoryFilePath.c_str(), ios::in | ios::binary);
259  volumeDirFile >> *_volumeDir;
260  volumeDirFile.close();
261 
262  if (traceDebug())
263  {
264  ossimNotify(ossimNotifyLevel_DEBUG) << "End reading VDF file" << std::endl;
265  }
266 
267  RadarSatRecordHeader headerDAT;
268  DataFactory factoryDAT;
269  ifstream dataFile (dataFilePath.c_str(), ios::in|ios::binary);
270  dataFile>>headerDAT;
271  if(dataFile.eof())
272  {
273  dataFile.close();
274  retValue = false;
275  }
276  else
277  {
278  if(traceDebug())
279  {
280  ossimNotify(ossimNotifyLevel_DEBUG)<< "Begin reading DAT file" << std::endl;
281  }
282 
283  RadarSatRecord* recordDAT = factoryDAT.Instanciate(headerDAT.get_rec_seq());
284  if (recordDAT != NULL && headerDAT.get_rec_seq() == 1)
285  {
286  recordDAT->Read(dataFile);
287  dataFile.close();
288  /*
289  * Reading the remaining of the data file
290  */
291  dataFile.open(dataFilePath.c_str(), ios::in|ios::binary);
292  dataFile>>*_data;
293  dataFile.close();
294 
295  /*
296  * Commenting this line :
297  * With SARDEGNA file (a corrupted file without number of lines)
298  * this line makes disappear the auto-computation of number of lines
299  * by file seeking.
300  * It does not seem to add any information either (same keywordlist)
301  *
302  * TODO : investigate : what is it supposed to do ?
303  */
304  //_data->InsertRecord(headerDAT.get_rec_seq(), recordDAT);
305 
306  if(traceDebug())
307  {
308  ossimNotify(ossimNotifyLevel_DEBUG) << "End reading DAT file" << std::endl;
309  }
310  } // TODO move to end
311  }// TODO move to end
312 
313  /*
314  * Leader file path construction from the DAT file path
315  * Warning : the filename case has to be homogenous
316  */
317  std::string leader_file = dataFilePath;
318  string::size_type loc = leader_file.find( "DAT_01", 0 );
319  if( loc != string::npos ) leader_file.replace(loc, 6, "LEA_01" ); // upper case test
320  else
321  {
322  loc = leader_file.find( "dat_01", 0 );
323  if( loc != string::npos ) leader_file.replace(loc, 6, "lea_01" ); // lower case test
324  else
325  {
326  ossimNotify(ossimNotifyLevel_DEBUG) << "File Name not coherent (searching for *DAT_01* or *dat_01*) : " << file << std::endl;
327  }
328  }
329  ossimFilename leaderFilePath(leader_file);
330  if (!leaderFilePath.exists())
331  {
332  ossimNotify(ossimNotifyLevel_DEBUG) << "Leader file not found (searching for *lea_01* coherent with *dat_01*) : " << file << std::endl;
333  retValue = false;
334  }
335  else
336  {
337  if(traceDebug())
338  {
339  ossimNotify(ossimNotifyLevel_DEBUG) << "Begin reading Leader file" << std::endl;
340  }
341  /*
342  * Leader file data reading
343  */
344  ifstream leaderFile (leaderFilePath.c_str(), ios::in|ios::binary);
345  leaderFile>>*_leader;
346  leaderFile.close();
347  if(traceDebug())
348  {
349  ossimNotify(ossimNotifyLevel_DEBUG) << "End reading Leader file" << std::endl;
350  }
351  }
352 
353  /*
354  * Trailer file path construction from the DAT file path
355  * Warning : the filename case has to be homogenous
356  */
357  std::string trailer_file = dataFilePath;
358  loc = trailer_file.find( "DAT_01", 0 );
359  if( loc != string::npos ) trailer_file.replace(loc, 6, "TRA_01" ); // upper case test
360  else
361  {
362  loc = trailer_file.find( "dat_01", 0 );
363  if( loc != string::npos ) trailer_file.replace(loc, 6, "tra_01" ); // lower case test
364  else
365  {
366  ossimNotify(ossimNotifyLevel_DEBUG) << "File Name not coherent (searching for *DAT_01* or *dat_01*) : " << file << std::endl;
367  }
368  }
369  ossimFilename trailerFilePath(trailer_file);
370  if (!trailerFilePath.exists())
371  {
372  ossimNotify(ossimNotifyLevel_DEBUG) << "Trailer file not found (searching for *tra_01* coherent with *dat_01*) : " << file << std::endl;
373  retValue = false;
374  }
375  else
376  {
377  if(traceDebug())
378  {
379  ossimNotify(ossimNotifyLevel_DEBUG) << "Begin reading Trailer file" << std::endl;
380  }
381  /*
382  * Trailer file data reading
383  */
384  ifstream trailerFile (trailerFilePath.c_str(), ios::in|ios::binary);
385  trailerFile>>*_trailer;
386  trailerFile.close();
387  if(traceDebug())
388  {
389  ossimNotify(ossimNotifyLevel_DEBUG) << "End reading Trailer file" << std::endl;
390  }
391  }
392  }
393  else
394  {
395  volumeDirFile.close();
396  retValue = false;
397  }
398  }
399  else
400  {
401  volumeDirFile.close();
402  retValue = false;
403  }
404  }
405 
406  ossimKeywordlist geom_kwl;
407  this->internalSaveState(geom_kwl);
408  this->internalLoadState(geom_kwl);
409 
410  // Assign the ossimSensorModel::theBoundGndPolygon
411  ossimGpt ul;
412  ossimGpt ur;
413  ossimGpt lr;
414  ossimGpt ll;
419  setGroundRect(ul, ur, lr, ll); // ossimSensorModel method.
420 
421  if(traceDebug())
422  {
423  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimRadarSatModel::open() DEBUG: returning..." << std::endl;
424  }
425 
426  return retValue;
427 }
428 
429 
431  const char* prefix) const
432 {
433  static const char MODULE[] = "ossimRadarSatModel::internalSaveState";
434 
435  if (traceDebug())
436  {
437  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
438  }
439 
440  char name[64];
441 
442  kwl.add(prefix, ossimKeywordNames::TYPE_KW, "ossimRadarSatModel", true);
443 
444  FileDescriptor * fileDescriptor = _leader->get_FileDescriptor() ;
445  if(fileDescriptor != NULL)
446  {
447  kwl.add(prefix, "file_name",fileDescriptor->get_file_name().c_str(),true);
448  }
449  else
450  {
451  return false;
452  }
453 
454  DataSetSummary * datasetSummary = _leader->get_DataSetSummary();
455  if(datasetSummary == NULL)
456  {
457  delete datasetSummary;
458  datasetSummary = _trailer->get_DataSetSummary();
459  }
460 
461  if(datasetSummary != NULL)
462  {
463  kwl.add(prefix, "inp_sctim",datasetSummary->get_inp_sctim().c_str(),true);
464 
465  kwl.add(prefix, "asc_des",datasetSummary->get_asc_des().c_str(),true);
466 
467  kwl.add(prefix, "pro_lat",datasetSummary->get_pro_lat(),true);
468  kwl.add(prefix, "pro_long",datasetSummary->get_pro_long(),true);
469  kwl.add(prefix, "pro_head",datasetSummary->get_pro_head(),true);
470 
471  kwl.add(prefix, "ellip_des",datasetSummary->get_ellip_des().c_str(),true);
472  kwl.add(prefix, "ellip_maj",datasetSummary->get_ellip_maj(),true);
473  kwl.add(prefix, "ellip_min",datasetSummary->get_ellip_min(),true);
474 
475  kwl.add(prefix, "sc_lin",datasetSummary->get_sc_lin(),true);
476  kwl.add(prefix, "sc_pix",datasetSummary->get_sc_pix(),true);
477 
478  kwl.add(prefix, "plat_lat",datasetSummary->get_plat_lat(),true);
479  kwl.add(prefix, "plat_long",datasetSummary->get_plat_long(),true);
480  kwl.add(prefix, "plat_head",datasetSummary->get_plat_head(),true);
481 
482  kwl.add(prefix, "wave_length",datasetSummary->get_wave_length(),true);
483 
484  kwl.add(prefix, "fr",datasetSummary->get_fr(),true);
485 
486  kwl.add(prefix, "rng_gate",datasetSummary->get_rng_gate(),true);
487 
488  kwl.add(prefix, "fa",datasetSummary->get_fa(),true);
489 
490  kwl.add(prefix, "n_azilok",datasetSummary->get_n_azilok(),true);
491  kwl.add(prefix, "n_rnglok",datasetSummary->get_n_rnglok(),true);
492  kwl.add(prefix, "bnd_azilok",datasetSummary->get_bnd_azilok(),true);
493  kwl.add(prefix, "bnd_rnglok",datasetSummary->get_bnd_rnglok(),true);
494  kwl.add(prefix, "bnd_azi",datasetSummary->get_bnd_azi(),true);
495  kwl.add(prefix, "bnd_rng",datasetSummary->get_bnd_rng(),true);
496 
497  kwl.add(prefix, "alt_dopcen0",datasetSummary->get_alt_dopcen()[0],true);
498  kwl.add(prefix, "alt_dopcen1",datasetSummary->get_alt_dopcen()[1],true);
499  kwl.add(prefix, "alt_dopcen2",datasetSummary->get_alt_dopcen()[2],true);
500 
501  kwl.add(prefix, "crt_dopcen0",datasetSummary->get_crt_dopcen()[0],true);
502  kwl.add(prefix, "crt_dopcen1",datasetSummary->get_crt_dopcen()[1],true);
503  kwl.add(prefix, "crt_dopcen2",datasetSummary->get_crt_dopcen()[2],true);
504 
505  kwl.add(prefix, "time_dir_pix",datasetSummary->get_time_dir_pix().c_str(),true);
506  kwl.add(prefix, "time_dir_lin",datasetSummary->get_time_dir_lin().c_str(),true);
507 
508  kwl.add(prefix, "terrain_height",datasetSummary->get_terrain_h(),true);
509 
510  kwl.add(prefix, "line_spacing",datasetSummary->get_line_spacing(),true);
511  }
512  else
513  {
514  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add dataSetSummary from _leader or _trailer file" <<std::endl;
515  return false;
516  }
517 
518  ProcessingParameters * processingParameters = _leader->get_ProcessingParameters();
519  if(processingParameters == NULL)
520  {
521  delete processingParameters;
522  processingParameters = _trailer->get_ProcessingParameters();
523  }
524 
525  if(processingParameters != NULL)
526  {
527  kwl.add(prefix, "n_srgr",processingParameters->get_n_srgr(),true);
528 
529  for (int i=0;i<processingParameters->get_n_srgr();i++)
530  {
531  sprintf(name,"srgr_update%i",i);
532  kwl.add(prefix, name,((processingParameters->get_srgr_coefset()[i]).get_srgr_update()).c_str(),true);
533 
534  sprintf(name,"srgr_coef%iA",i);
535  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[0],true);
536  sprintf(name,"srgr_coef%iB",i);
537  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[1],true);
538  sprintf(name,"srgr_coef%iC",i);
539  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[2],true);
540  sprintf(name,"srgr_coef%iD",i);
541  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[3],true);
542  sprintf(name,"srgr_coef%iE",i);
543  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[4],true);
544  sprintf(name,"srgr_coef%iF",i);
545  kwl.add(prefix, name,(processingParameters->get_srgr_coefset()[i]).get_srgr_coef()[5],true);
546  }
547 
548  kwl.add(prefix, "pixel_spacing",processingParameters->get_pixel_spacing(),true);
549 
550  kwl.add(prefix, "lookDirection",(processingParameters->get_sens_orient()).c_str(),true);
551  }
552  else
553  {
554  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add processingParameters from _leader or _trailer file" <<std::endl;
555  return false;
556  }
557 
558  PlatformPositionData * platformPositionData = _leader->get_PlatformPositionData();
559  if(platformPositionData != NULL)
560  {
561  kwl.add(prefix, "neph",platformPositionData->get_ndata(),true);
562  kwl.add(prefix, "eph_int",platformPositionData->get_data_int(),true);
563 
564  kwl.add(prefix, "eph_year",platformPositionData->get_year(),true);
565  kwl.add(prefix, "eph_month",platformPositionData->get_month(),true);
566  kwl.add(prefix, "eph_day",platformPositionData->get_day(),true);
567  kwl.add(prefix, "eph_sec",platformPositionData->get_gmt_sec(),true);
568  kwl.add(prefix, "hr_angle",platformPositionData->get_hr_angle(),true);
569 
570  for(int i=0;i<platformPositionData->get_ndata();i++)
571  {
572  sprintf(name,"eph%i_posX",i);
573  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_pos()[0],true);
574  sprintf(name,"eph%i_posY",i);
575  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_pos()[1],true);
576  sprintf(name,"eph%i_posZ",i);
577  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_pos()[2],true);
578 
579  sprintf(name,"eph%i_velX",i);
580  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_vel()[0],true);
581  sprintf(name,"eph%i_velY",i);
582  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_vel()[1],true);
583  sprintf(name,"eph%i_velZ",i);
584  kwl.add(prefix, name,(platformPositionData->get_pos_vect()[i]).get_vel()[2],true);
585  }
586  }
587  else
588  {
589  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add platformPositionData from _leader file" <<std::endl;
590  return false;
591  }
592 
593  ImageOptionsFileDescriptor * imageOptionsFileDescriptor = _data->get_ImageOptionsFileDescriptor();
594  if(imageOptionsFileDescriptor != NULL)
595  {
596  kwl.add(prefix, "nbLin",imageOptionsFileDescriptor->get_nlin(),true);
597  kwl.add(prefix, "nbCol",imageOptionsFileDescriptor->get_ngrp(),true);
598  }
599  else
600  {
601  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add imageOptionsFileDescriptor from _data file" <<std::endl;
602  return false;
603  }
604 
605  ProcessedDataRecord * firstProcessedDataRecord = _data->get_FirstProcessedDataRecord();
606  if(firstProcessedDataRecord != NULL)
607  {
608  sprintf(name,"cornersLon%i",0);
609  kwl.add(prefix, name,((float) (firstProcessedDataRecord->get_lon_first()))/1000000.0,true);
610  sprintf(name,"cornersLat%i",0);
611  kwl.add(prefix, name,((float) (firstProcessedDataRecord->get_lat_first()))/1000000.0,true);
612  sprintf(name,"cornersLon%i",1);
613  kwl.add(prefix, name,((float) (firstProcessedDataRecord->get_lon_last()))/1000000.0,true);
614  sprintf(name,"cornersLat%i",1);
615  kwl.add(prefix, name,((float) (firstProcessedDataRecord->get_lat_last()))/1000000.0,true);
616  kwl.add(prefix, "acq_msec_first",firstProcessedDataRecord->get_acq_msec(),true);
617  }
618  else
619  {
620  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add firstProcessedDataRecord from _data file" <<std::endl;
621  return false;
622  }
623 
624  ProcessedDataRecord * lastProcessedDataRecord = _data->get_LastProcessedDataRecord();
625  if(lastProcessedDataRecord != NULL)
626  {
627  sprintf(name,"cornersLon%i",2);
628  kwl.add(prefix, name,((float) (lastProcessedDataRecord->get_lon_first()))/1000000.0,true);
629  sprintf(name,"cornersLat%i",2);
630  kwl.add(prefix, name,((float) (lastProcessedDataRecord->get_lat_first()))/1000000.0,true);
631  sprintf(name,"cornersLon%i",3);
632  kwl.add(prefix, name,(((float) lastProcessedDataRecord->get_lon_last()))/1000000.0,true);
633  sprintf(name,"cornersLat%i",3);
634  kwl.add(prefix, name,((float) (lastProcessedDataRecord->get_lat_last()))/1000000.0,true);
635  kwl.add(prefix, "acq_msec_last",lastProcessedDataRecord->get_acq_msec(),true);
636  }
637  else
638  {
639  ossimNotify(ossimNotifyLevel_DEBUG) << "It is not possible to add lastProcessedDataRecord from _data file" <<std::endl;
640  return false;
641  }
642 
643  return true;
644 }
645 
647  const char* prefix) const
648 {
649  bool result = this->internalSaveState(kwl, prefix);
650 
651  if (result)
652  {
653  result = ossimGeometricSarSensorModel::saveState(kwl, prefix);
654  }
655 
656  return result;
657 }
658 
660  const char *prefix)
661 {
662  static const char MODULE[] = "ossimRadarSatModel::internalLoadState";
663  if (traceDebug())
664  {
665  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
666  }
667 
668  this->InitSRGR(kwl, prefix);
669  this->InitSensorParams(kwl, prefix);
670  this->InitPlatformPosition(kwl, prefix);
671  this->InitRefPoint(kwl, prefix);
672 
673  if (traceDebug())
674  {
675  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exit...\n";
676  }
677  return true;
678 }
679 
681  const char *prefix)
682 {
683  static const char MODULE[] = "ossimRadarSatModel::loadState";
684  if (traceDebug())
685  {
686  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
687  }
688 
689  const char* lookup = 0;
690  ossimString s;
691 
692  // Check the type first.
693  lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
694  if (lookup)
695  {
696  s = lookup;
697  if (s != getClassName())
698  {
699  return false;
700  }
701  }
702 
703  //bool result = ossimGeometricSarSensorModel::loadState(kwl, prefix);
704 
705  bool result = true;
706  if (result)
707  {
708  result = this->internalLoadState(kwl, prefix);
709  }
710 
711  if (traceDebug())
712  {
713  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exit...\n";
714  }
715  return result;
716 }
717 
718 bool ossimRadarSatModel::InitSensorParams(const ossimKeywordlist &kwl, const char *prefix)
719 {
720  const char* wave_length_str = kwl.find(prefix,"wave_length");
721  double wave_length = atof(wave_length_str);
722  const char* fr_str = kwl.find(prefix,"fr");
723  double fr = atof(fr_str);
724  const char* fa_str = kwl.find(prefix,"fa");
725  double fa = atof(fa_str);
726 
727  /* //number of different looks
728  const char* n_azilok_str = kwl.find(prefix,"n_azilok");
729  double n_azilok = atof(n_azilok_str);
730  const char* n_rnglok_str = kwl.find(prefix,"n_rnglok");
731  double n_rnglok = atof(n_rnglok_str);
732  */
733 
734  // look bandwidth rate (for localisation purpose)
735  const char* bnd_azilok_str = kwl.find(prefix,"bnd_azilok");
736  double bnd_azilok = atof(bnd_azilok_str);
737  const char* bnd_rnglok_str = kwl.find(prefix,"bnd_rnglok");
738  double bnd_rnglok = atof(bnd_rnglok_str);
739  const char* bnd_azi_str = kwl.find(prefix,"bnd_azi");
740  double bnd_azi = atof(bnd_azi_str);
741  const char* bnd_rng_str = kwl.find(prefix,"bnd_rng");
742  double bnd_rng = atof(bnd_rng_str);
743 
744  double n_azilok = bnd_azi/bnd_azilok;
745  double n_rnglok = bnd_rng/bnd_rnglok;
746 
747  const char* time_dir_pix = kwl.find(prefix,"time_dir_pix");
748  const char* time_dir_lin = kwl.find(prefix,"time_dir_lin");
749 
750  //ellipsoid parameters
751  const char* ellip_maj_str = kwl.find(prefix,"ellip_maj");
752  double ellip_maj = atof(ellip_maj_str) * 1000.0; // km -> m
753  const char* ellip_min_str = kwl.find(prefix,"ellip_min");
754  double ellip_min = atof(ellip_min_str) * 1000.0; // km -> m
755 
756  if(_sensor != NULL)
757  {
758  delete _sensor;
759  }
760 
761  _sensor = new SensorParams();
762 
763  if(strcmp(time_dir_pix, "INCREASE") == 0)
764  {
766  }
767  else
768  {
770  }
771 
772  if(strcmp(time_dir_lin, "INCREASE") == 0)
773  {
775  }
776  else
777  {
779  }
780 
781  const char* lookDirection_str = kwl.find(prefix,"lookDirection");
782  ossimString lookDirection(lookDirection_str) ;
783  lookDirection.trim(" ") ; // eliminates trailing blanks
784  if (lookDirection == "NORMAL") _sensor->set_sightDirection(SensorParams::Right) ;
786 
787  _sensor->set_prf(fa);
788  _sensor->set_sf(fr);
789  _sensor->set_rwl(wave_length);
790  _sensor->set_nAzimuthLook(n_azilok);
791  _sensor->set_nRangeLook(n_rnglok);
792 
793  _sensor->set_semiMajorAxis(ellip_maj) ;
794  _sensor->set_semiMinorAxis(ellip_min) ;
795 
796  return true;
797 }
798 
799 bool ossimRadarSatModel::InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix)
800 {
801  const double _PI = 3.14159265358979323846 ;
802  CivilDateTime ref_civil_date;
803  /*
804  * Ephemerisis reference date retrieval
805  */
806  const char* eph_year_str = kwl.find(prefix,"eph_year");
807  int eph_year = atoi(eph_year_str);
808  const char* eph_month_str = kwl.find(prefix,"eph_month");
809  int eph_month = atoi(eph_month_str);
810  const char* eph_day_str = kwl.find(prefix,"eph_day");
811  int eph_day = atoi(eph_day_str);
812  const char* eph_sec_str = kwl.find(prefix,"eph_sec");
813  double eph_sec = atof(eph_sec_str);
814 
815  ref_civil_date.set_year(eph_year);
816  ref_civil_date.set_month(eph_month);
817  ref_civil_date.set_day(eph_day);
818  ref_civil_date.set_second((int)eph_sec);
819  ref_civil_date.set_decimal( eph_sec-(double)((int)eph_sec));
820 
821 
822  JSDDateTime ref_jsd_date(ref_civil_date);
823 
824  const char* eph_int_str = kwl.find(prefix, "eph_int");
825  double eph_int = atof(eph_int_str);
826  /*
827  * Ephemerisis number retrieval
828  */
829  const char* neph_str = kwl.find(prefix,"neph");
830  int neph = atoi(neph_str);
831 
832  Ephemeris** ephemeris = new Ephemeris*[neph];
833 
834  const char* hr_angle_str = kwl.find(prefix,"hr_angle");
835  double greenwich_mha_ref = atof(hr_angle_str);
836 
837  GMSTDateTime * greenwich_mha_ref2000 = new GMSTDateTime();
838  greenwich_mha_ref2000->set_origine(GMSTDateTime::AN2000);
839  ref_civil_date.AsGMSTDateTime(greenwich_mha_ref2000);
840 
841  /*
842  * Ephemerisis retrieval
843  */
844  for (int i=0;i<neph;i++)
845  {
846  double pos[3];
847  double vit[3];
848  char name[64];
849 
850 
851  sprintf(name,"eph%i_posX",i);
852  const char* px_str = kwl.find(prefix,name);
853  pos[0] = atof(px_str);
854 
855  sprintf(name,"eph%i_posY",i);
856  const char* py_str = kwl.find(prefix,name);
857  pos[1] = atof(py_str);
858 
859  sprintf(name,"eph%i_posZ",i);
860  const char* pz_str = kwl.find(prefix,name);
861  pos[2] = atof(pz_str);
862 
863 
864  sprintf(name,"eph%i_velX",i);
865  const char* vx_str = kwl.find(prefix,name);
866  vit[0] = atof(vx_str) * 1.0e-3;;
867 
868  sprintf(name,"eph%i_velY",i);
869  const char* vy_str = kwl.find(prefix,name);
870  vit[1] = atof(vy_str) * 1.0e-3;;
871 
872  sprintf(name,"eph%i_velZ",i);
873  const char* vz_str = kwl.find(prefix,name);
874  vit[2] = atof(vz_str) * 1.0e-3;;
875 
876  /*
877  * Ephemerisis date
878  */
879  JSDDateTime date(ref_jsd_date);
880  date.set_second(date.get_second() + i * eph_int);
881  date.NormDate();
882 
883  /*
884  * Date creation for referential change
885  */
886  GMSTDateTime * greenwich_mha = new GMSTDateTime();
887  greenwich_mha->set_origine(GMSTDateTime::AN2000);
888  date.AsGMSTDateTime(greenwich_mha);
889 
890  double angle = greenwich_mha_ref+(greenwich_mha->get_tms()-greenwich_mha_ref2000->get_tms())*180.0/_PI;
891  angle = fmod(angle,360.0);
892 
893  /*
894  * Referential change
895  */
896  GalileanEphemeris * tmpEphemeris = new GalileanEphemeris(date,pos,vit);
898 
899  tmpEphemeris->ToGeographic(angle,eph);
900  ephemeris[i] = eph;
901 
902  delete tmpEphemeris;
903  delete greenwich_mha;
904 
905  }
906 
907  delete greenwich_mha_ref2000;
908 
909  /*
910  * Antenna position interpolator creation
911  */
912  if (_platformPosition != NULL)
913  {
914  delete _platformPosition;
915  }
916  _platformPosition = new PlatformPosition(ephemeris,neph);
917 
918  /*
919  * Free of memory used by the ephemerisis list
920  */
921  for (int i=0;i<neph;i++)
922  {
923  delete ephemeris[i];
924  }
925  delete[] ephemeris;
926 
927  return true;
928 }
929 
930 bool ossimRadarSatModel::InitRefPoint(const ossimKeywordlist &kwl, const char *prefix)
931 {
932  const char* sc_lin_str = kwl.find(prefix,"sc_lin");
933  double sc_lin = atof(sc_lin_str);
934 
935  const char* sc_pix_str = kwl.find(prefix,"sc_pix");
936  double sc_pix = atof(sc_pix_str);
937 
938  const char* inp_sctim_str = kwl.find(prefix,"inp_sctim");
939 
940  const char* rng_gate_str = kwl.find(prefix,"rng_gate");
941  double rng_gate = atof(rng_gate_str);
942 
943  if(_refPoint == NULL)
944  {
945  _refPoint = new RefPoint();
946  }
947 
948  _refPoint->set_pix_col(sc_pix);
949  _refPoint->set_pix_line(sc_lin);
950 
951  char year_str[5];
952  for (int i=0;i<4;i++)
953  {
954  year_str[i] = inp_sctim_str[i];
955  }
956  year_str[4] = '\0';
957 
958  char month_str[3];
959  for (int i=4;i<6;i++)
960  {
961  month_str[i-4] = inp_sctim_str[i];
962  }
963  month_str[2] = '\0';
964 
965  char day_str[3];
966  for (int i=6;i<8;i++)
967  {
968  day_str[i-6] = inp_sctim_str[i];
969  }
970  day_str[2] = '\0';
971 
972  char hour_str[3];
973  for (int i=8;i<10;i++)
974  {
975  hour_str[i-8] = inp_sctim_str[i];
976  }
977  hour_str[2] = '\0';
978 
979  char min_str[3];
980  for (int i=10;i<12;i++)
981  {
982  min_str[i-10] = inp_sctim_str[i];
983  }
984  min_str[2] = '\0';
985 
986  char sec_str[3];
987  for (int i=12;i<14;i++)
988  {
989  sec_str[i-12] = inp_sctim_str[i];
990  }
991  sec_str[2] = '\0';
992 
993  char mili_str[4];
994  for (int i=14;i<17;i++)
995  {
996  mili_str[i-14] = inp_sctim_str[i];
997  }
998  mili_str[3] = '\0';
999 
1000  int year = atoi(year_str);
1001  int month = atoi(month_str);
1002  int day = atoi(day_str);
1003  int hour = atoi(hour_str);
1004  int min = atoi(min_str);
1005  int sec = atoi(sec_str);
1006  double mili = atof(mili_str);
1007 
1008 
1009  CivilDateTime date(year, month, day, hour * 3600 + min * 60 + sec, mili/1000.0);
1010 
1011  if(_platformPosition != NULL)
1012  {
1013  Ephemeris * ephemeris = _platformPosition->Interpolate((JSDDateTime)date);
1014  if (ephemeris == NULL) return false ;
1015 
1016  _refPoint->set_ephemeris(ephemeris);
1017 
1018  delete ephemeris;
1019  }
1020  else
1021  {
1022  return false;
1023  }
1024 
1025  double c = 2.99792458e+8;
1026 
1027  double distance = (rng_gate + ((double)sc_pix)*_sensor->get_nRangeLook()/_sensor->get_sf()) * (c/2.0);
1028 
1029  // in the case of Georeferenced images, the "relative" ground range is stored in place of the slant range
1030  // (used for SlantRange computation relative to reference point, necessary for optimization)
1031  // here, the pixelDirection is ignored since the RDS reference point is always at the scene centre
1034  }
1035 
1037 
1038 
1040 // const char* line_spacing_str = kwl.find(prefix,"line_spacing");
1041 // double line_spacing = atof(line_spacing_str);
1042 // Ephemeris * ephemeris = _refPoint->get_ephemeris() ;
1043 // double velSat = sqrt(pow(ephemeris->get_speed()[0], 2)+ pow(ephemeris->get_speed()[1], 2)+ pow(ephemeris->get_speed()[2], 2));
1044 // double prfeq = velSat / line_spacing ;
1045 // _sensor->set_prf(prfeq);
1046 // _sensor->set_nAzimuthLook(1.0);
1048 // * @todo : effacer
1049 // */
1050 
1051  // in order to use ossimSensorModel::lineSampleToWorld
1052  const char* nbCol_str = kwl.find(prefix,"nbCol");
1053  const char* nbLin_str = kwl.find(prefix,"nbLin");
1054 
1055  theImageSize.x = atoi(nbCol_str);
1056  theImageSize.y = atoi(nbLin_str);
1058 
1059  // sensor PRF update in the case of ground projected products
1061  const char* acq_msec_first_str = kwl.find("acq_msec_first");
1062  double acq_msec_first = atof(acq_msec_first_str);
1063  const char* acq_msec_last_str = kwl.find("acq_msec_last");
1064  double acq_msec_last = atof(acq_msec_last_str);
1065 
1066  double actualPRF = 1000.0*theImageSize.y/(acq_msec_last-acq_msec_first) ;
1067  _sensor->set_nAzimuthLook(_sensor->get_prf()/actualPRF);
1068  }
1069 
1070  // Ground Control Points extracted from the model : scene center
1071  std::list<ossimGpt> groundGcpCoordinates ;
1072  std::list<ossimDpt> imageGcpCoordinates ;
1073  const char* lon_str = kwl.find("pro_long");
1074  double lon = atof(lon_str);
1075  const char* lat_str = kwl.find("pro_lat");
1076  double lat = atof(lat_str);
1077  //const char* height_str = kwl.find("terrain_height");
1078  double height = 0 ; //atof(height_str) ;
1079 
1080  ossimDpt imageGCP(sc_pix,sc_lin);
1081  ossimGpt groundGCP(lat, lon, height);
1082  groundGcpCoordinates.push_back(groundGCP) ;
1083  imageGcpCoordinates.push_back(imageGCP) ;
1084 
1085  // Ground Control Points extracted from the model : scene corners
1086  // upper left corner
1087  lon = atof(kwl.find("cornersLon0"));
1088  lat = atof(kwl.find("cornersLat0"));
1089  ossimDpt imageGCP0(0,0);
1090  ossimGpt groundGCP0(lat, lon, height);
1091  groundGcpCoordinates.push_back(groundGCP0) ;
1092  imageGcpCoordinates.push_back(imageGCP0) ;
1093  // upper right corner
1094  lon = atof(kwl.find("cornersLon1"));
1095  lat = atof(kwl.find("cornersLat1"));
1096  ossimDpt imageGCP1(theImageSize.x-1,0);
1097  ossimGpt groundGCP1(lat, lon, height);
1098  groundGcpCoordinates.push_back(groundGCP1) ;
1099  imageGcpCoordinates.push_back(imageGCP1) ;
1100  // lower left corner
1101  lon = atof(kwl.find("cornersLon2"));
1102  lat = atof(kwl.find("cornersLat2"));
1103  ossimDpt imageGCP2(0,theImageSize.y-1);
1104  ossimGpt groundGCP2(lat, lon, height);
1105  groundGcpCoordinates.push_back(groundGCP2) ;
1106  imageGcpCoordinates.push_back(imageGCP2) ;
1107  // lower right corner
1108  lon = atof(kwl.find("cornersLon3"));
1109  lat = atof(kwl.find("cornersLat3"));
1110  ossimDpt imageGCP3(theImageSize.x-1,theImageSize.y-1);
1111  ossimGpt groundGCP3(lat, lon, height);
1112  groundGcpCoordinates.push_back(groundGCP3) ;
1113  imageGcpCoordinates.push_back(imageGCP3) ;
1114 
1115  // Default optimization
1116  optimizeModel(groundGcpCoordinates, imageGcpCoordinates) ;
1117 
1118  return true;
1119 }
1120 
1121 bool ossimRadarSatModel::InitSRGR(const ossimKeywordlist &kwl, const char *prefix)
1122 {
1123  // product type : format "RSAT-1-SAR-{SLC,SGG,SGC,...}-..."
1124  const char* file_name_str = kwl.find(prefix,"file_name");
1125  char format[4] ;
1126  // product type (SLC,SGG,SGC,...) extraction
1127  for (int j=11;j<14;j++)
1128  {
1129  format[j-11] = file_name_str[j];
1130  }
1131  format[3] = '\0';
1132  std::string format_str(format);
1133 
1134  _isProductGeoreferenced = (format_str=="SGX") || (format_str=="SGF") || (format_str=="SCW");
1135 
1136  // pixel spacing
1137  const char* pixel_spacing_str = kwl.find(prefix,"pixel_spacing");
1138  _pixel_spacing = atof(pixel_spacing_str);
1139 
1140  // number of SRGR sets
1141  const char* n_srgr_str = kwl.find(prefix,"n_srgr");
1142  _n_srgr = atoi(n_srgr_str);
1143 
1144  char name[64];
1145  for (int i=0;i<_n_srgr;i++)
1146  {
1147  // SRGR update time, format : YYYY-DDD-HH:MM:SS.SSS
1148  sprintf(name,"srgr_update%i",i);
1149  const char* srgr_update_str = kwl.find(prefix,name);
1150 
1151  // years and days are ignored in the following (conversion from CivilDate to JSDDate requires a YYYY-MM-DD format)
1152  // could be improved
1153  char hour_str[3];
1154  for (int j=9;j<11;j++)
1155  {
1156  hour_str[j-9] = srgr_update_str[j];
1157  }
1158  hour_str[2] = '\0';
1159 
1160  char min_str[3];
1161  for (int j=12;j<14;j++)
1162  {
1163  min_str[j-12] = srgr_update_str[j];
1164  }
1165  min_str[2] = '\0';
1166 
1167  char sec_str[3];
1168  for (int j=15;j<17;j++)
1169  {
1170  sec_str[j-15] = srgr_update_str[j];
1171  }
1172  sec_str[2] = '\0';
1173 
1174  char mili_str[4];
1175  for (int j=18;j<21;j++)
1176  {
1177  mili_str[j-18] = srgr_update_str[j];
1178  }
1179  mili_str[3] = '\0';
1180 
1181  int hour = atoi(hour_str);
1182  int min = atoi(min_str);
1183  int sec = atoi(sec_str);
1184  double mili = atof(mili_str);
1185  _srgr_update[i] = hour * 3600 + min * 60 + sec + mili/1000.0 ;
1186 
1187  // SRGR coefficients
1188  sprintf(name,"srgr_coef%iA",i);
1189  const char* srgr_coef_strA = kwl.find(prefix,name);
1190  _srgr_coefset[i][0] = atof(srgr_coef_strA);
1191  sprintf(name,"srgr_coef%iB",i);
1192  const char* srgr_coef_strB = kwl.find(prefix,name);
1193  _srgr_coefset[i][1] = atof(srgr_coef_strB);
1194  sprintf(name,"srgr_coef%iC",i);
1195  const char* srgr_coef_strC = kwl.find(prefix,name);
1196  _srgr_coefset[i][2] = atof(srgr_coef_strC);
1197  sprintf(name,"srgr_coef%iD",i);
1198  const char* srgr_coef_strD = kwl.find(prefix,name);
1199  _srgr_coefset[i][3] = atof(srgr_coef_strD);
1200  sprintf(name,"srgr_coef%iE",i);
1201  const char* srgr_coef_strE = kwl.find(prefix,name);
1202  _srgr_coefset[i][4] = atof(srgr_coef_strE);
1203  sprintf(name,"srgr_coef%iF",i);
1204  const char* srgr_coef_strF = kwl.find(prefix,name);
1205  _srgr_coefset[i][5] = atof(srgr_coef_strF);
1206  }
1207  return true;
1208 }
1209 
1211 {
1212  if (_n_srgr==0) return(-1) ;
1213 
1214  double delays[20];
1215  for (int i=0;i<_n_srgr;i++)
1216  {
1217  delays[i] = fabs(date.get_second()+date.get_decimal()-_srgr_update[i]) ;
1218  }
1219 
1220  int setNumber = 0 ;
1221  double min_delay = delays[0] ;
1222  for (int i=1;i<_n_srgr;i++)
1223  {
1224  if (delays[i]<min_delay) {
1225  setNumber = i ;
1226  min_delay = delays[i] ;
1227  }
1228  }
1229  return setNumber ;
1230 }
1231 }
This class is able to read the SAR leader file descriptor record of the leader file.
int get_sc_lin()
Scene centre line number
This class represent an ephemeris in Geographic coordinates system.
This class represents a date.
Definition: GMSTDateTime.h:29
double _pixel_spacing
Pixel spacing.
int get_ndata()
Number of data points
FileDescriptor * get_FileDescriptor()
Definition: Leader.cpp:196
void set_sightDirection(SightDirection sight)
Definition: SensorParams.h:93
double get_pro_long()
Processed scene centre longitude
This class represents a date and time in the civil format.
Definition: CivilDateTime.h:30
virtual ossimObject * dup() const
Returns pointer to a new instance, copy of this.
double get_data_int()
Data sampling interval
RadarSatRecord * Instanciate(int id)
Instanciates a new Record.
double * get_crt_dopcen()
Cross track Doppler frequency terms
int get_lon_first()
First pixel longitude, 10e-6 deg.
double get_n_rnglok()
Number of range looks
void set_rwl(double rwl)
Definition: SensorParams.h:83
This class handles the platform position.
RTTI_DEF1(ossimAlosPalsarModel, "ossimAlosPalsarModel", ossimGeometricSarSensorModel)
Represents serializable keyword/value map.
double get_plat_head()
Platform heading
std::string get_ellip_des()
Ellipsoid designator.
double get_pro_lat()
Processed scene centre latitude
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
Ephemeris * get_ephemeris()
Definition: RefPoint.cpp:90
virtual bool InitSRGR(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Slant Range for each Ground Range data sets : _n_srgr,_srgr_coefset,_srgr_update,_pixel_spacing,_isProductGeoreferenced.
const char * find(const char *key) const
This class is able to read the volume directory file of the RadarSat file structure.
Definition: VolumeDir.h:34
virtual double getSlantRangeFromGeoreferenced(double col) const
This function associates an image column number to a slant range when the image is georeferenced (gro...
const ossimDpt & ul() const
Definition: ossimDrect.h:339
This class handles the referential point.
Definition: RefPoint.h:29
double get_distance() const
Definition: RefPoint.cpp:95
double get_bnd_rnglok()
Bandwidth per look in range,Hz
void set_lin_direction(int dir)
Definition: SensorParams.h:128
This class is able to read a Platform position data record.
double get_pro_head()
Processed scene centre headng
int AsGMSTDateTime(GMSTDateTime *GMSTdate)
This function converts the current CivilDateTime into GMSTDateTime.
void set_second(int second)
This class is able to direct localisation and indirect localisation using the RadarSat sensor model...
std::string get_sens_orient()
Sensor orientation
virtual bool internalSaveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
double get_nRangeLook() const
Definition: SensorParams.h:118
Trailer * _trailer
List of metadata contained in the Trailer file.
DataSetSummary * get_DataSetSummary()
Definition: Trailer.cpp:163
double get_line_spacing()
Line spacing, meters
ProcessingParameters * get_ProcessingParameters()
Definition: Trailer.cpp:143
double get_rng_gate()
Range gate start time
This class handles the sensor parameters.
Definition: SensorParams.h:29
ProcessedDataRecord * get_FirstProcessedDataRecord()
Definition: Data.cpp:226
Ephemeris * Interpolate(JSDDateTime date) const
This function interpolates its ephemeris to create a new ephemeris at the given date and time...
void set_pix_line(double pix_line)
Definition: RefPoint.cpp:80
int get_sc_pix()
Scene centre pixel number
This class is able to read the trailer file of the RadarSat file structure.
Definition: Trailer.h:40
static const char * TYPE_KW
void set_pix_col(double pix_col)
Definition: RefPoint.cpp:85
bool _isProductGeoreferenced
True iff the product is ground range.
void set_semiMinorAxis(double value)
Definition: SensorParams.h:158
This class is the base class of all the record classes.
int AsGMSTDateTime(GMSTDateTime *GMST)
This function converts the current JSDDateTime into GMST Date.
This class allows for direct localisation and indirect localisation using the geometric model of SAR ...
std::string get_time_dir_pix()
Pixel time direction indicator
virtual ~ossimRadarSatModel()
Destructor.
virtual ossimString getClassName() const
Method to return the class name.
void set_second(double second)
Definition: JSDDateTime.h:91
virtual void Read(std::istream &is)=0
Reads the class data from a stream.
void ToGeographic(GeographicEphemeris *vGeo)
This fonction converts the current ephemeris in the Geographic coordinates syst�m.
int get_n_srgr()
Number of SRGR coefficient sets
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
int FindSRGRSetNumber(JSDDateTime date) const
Finds the SRGR data set which update time is the closest to the center scene time.
This class represents an ephemeris.
Definition: Ephemeris.h:28
void set_decimal(double decimal)
SRGRCoefficientSetRecord * get_srgr_coefset()
SRGR coefficient sets.
Data * _data
List of metadata contained in the Data file.
This class is able to read the SAR leader file descriptor record of the leader file.
bool exists() const
double get_plat_long()
Platform geodetic longitude
double get_bnd_azi()
Total azimuth look bandwidth
double get_terrain_h()
Average terrain height, km
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
PlatformPositionData * get_PlatformPositionData()
Definition: Leader.cpp:166
double * get_alt_dopcen()
Along track Doppler frequency terms
int get_lon_last()
Last-pixel longitude, 10e-6 deg.
double get_fr()
Range sampling rate
This class is able to read an Processed Data Record.
double get_plat_lat()
Platform geodetic latitude
void set_semiMajorAxis(double value)
Definition: SensorParams.h:153
double get_ellip_min()
Ellipsoid semi_minor axis, km
virtual bool InitRefPoint(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Reference Point from a projection keywordlist.
double get_second() const
Definition: JSDDateTime.h:76
std::string get_file_name()
File name.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
std::string get_asc_des()
Ascending/descending.
ProcessedDataRecord * get_LastProcessedDataRecord()
Definition: Data.cpp:231
double get_pix_col() const
Definition: RefPoint.cpp:105
double get_wave_length()
Radar wave length
void set_origine(Ori_TSM_Green origine)
Definition: GMSTDateTime.h:78
void set_nRangeLook(double look)
Definition: SensorParams.h:138
This class is a factory able to construct Record base classes.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
ProcessingParameters * get_ProcessingParameters()
Definition: Leader.cpp:171
This class is able to read an Image options file descriptor record.
This class is able to read a Detailed processing parameters record.
ossimDrect theImageClipRect
PlatformPosition * _platformPosition
Handle the position of the platform.
int get_lat_last()
Last-pixel latitude, 10e-6 deg.
double get_n_azilok()
Number of azimuth looks
int get_ngrp()
Groups per line per channel
This class is able to read the SAR leader data set summary record of the leader file.
std::string get_inp_sctim()
Input scene centre time.
ossim_int32 y
Definition: ossimIpt.h:142
double get_decimal() const
Definition: JSDDateTime.h:81
This class is able to read a record header.
void setGroundRect(const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
const ossimDpt & ur() const
Definition: ossimDrect.h:340
DataSetSummary * get_DataSetSummary()
Definition: Leader.cpp:191
This class is able to read the data file of the RadarSat file structure.
Definition: Data.h:31
double get_fa()
Nominal PRF, Hz
double get_bnd_rng()
Total range look bandwidth
virtual void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
VolumeDir * _volumeDir
List of metadata contained in the Volume Directory file.
Leader * _leader
List of metadata contained in the Leader file.
virtual bool InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Platform Position from a projection keywordlist.
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
int get_acq_msec()
Acquisition msecs
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.
bool open(const ossimFilename &file)
Method to intantial model from a file.
void set_nAzimuthLook(double look)
Definition: SensorParams.h:133
ossim_int32 x
Definition: ossimIpt.h:141
virtual bool optimizeModel(const std::list< ossimGpt > &groundCoordinates, const std::list< ossimDpt > &imageCoordinates)
This function optimizes the model according to a list of Ground Control Points.
double get_ellip_maj()
Ellipsoid semi-major axis, km
const ossimDpt & ll() const
Definition: ossimDrect.h:342
int get_lat_first()
First pixel latitude, 10e-6 deg
void set_prf(double prf)
Definition: SensorParams.h:73
double get_pixel_spacing()
SGF product pixel spacing
virtual bool internalLoadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
double get_hr_angle()
Greenwich mean hour angle
void set_ephemeris(Ephemeris *ephemeris)
Definition: RefPoint.cpp:65
void set_col_direction(int dir)
Definition: SensorParams.h:123
std::string get_time_dir_lin()
Line time direction indicator
This class is a factory able to construct Record base classes.
Definition: DataFactory.h:25
This class represents a date.
Definition: JSDDateTime.h:30
ImageOptionsFileDescriptor * get_ImageOptionsFileDescriptor()
Definition: Data.cpp:221
PositionVectorRecord * get_pos_vect()
Data point position/velocity
float distance(double lat1, double lon1, double lat2, double lon2, int units)
double _srgr_update[20]
SRGR coefficient sets update times.
const ossimDpt & lr() const
Definition: ossimDrect.h:341
virtual bool InitSensorParams(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Sensor Params from a projection keywordlist.
void set_distance(double distance)
Definition: RefPoint.cpp:75
void set_sf(double sf)
Definition: SensorParams.h:78
int get_month()
Month of data point
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
double _srgr_coefset[20][6]
SRGR coefficient sets.
This class represents an ephemeris in Galilean coordinates system.
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
This class is able to read the leader file of the RadarSat file structure.
Definition: Leader.h:43
#define min(a, b)
Definition: auxiliary.h:75
double get_bnd_azilok()
Bandwidth per look in azimuth,Hz