OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimRadarSat2Model.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 <ossimRadarSat2Model.h>
16 #include <ossimPluginCommon.h>
18 #include <ossim/base/ossimCommon.h>
21 #include <ossim/base/ossimNotify.h>
22 #include <ossim/base/ossimRefPtr.h>
23 #include <ossim/base/ossimString.h>
24 #include <ossim/base/ossimTrace.h>
28 #include <otb/GalileanEphemeris.h>
30 #include <otb/GMSTDateTime.h>
31 #include <otb/PlatformPosition.h>
32 #include <otb/SensorParams.h>
33 #include <otb/RefPoint.h>
34 #include <otb/SarSensor.h>
35 
36 namespace ossimplugins
37 {
38 // Keyword constants:
39 static const char NUMBER_SRGR_COEFFICIENTS_KW[] = "sr_gr_coeffs_count";
40 static const char LOAD_FROM_PRODUCT_FILE_KW[] = "load_from_product_file_flag";
41 static const char PRODUCT_XML_FILE_KW[] = "product_xml_filename";
42 
43 // Static trace for debugging
44 static ossimTrace traceDebug("ossimRadarSat2Model:debug");
45 
46 RTTI_DEF1(ossimRadarSat2Model, "ossimRadarSat2Model", ossimGeometricSarSensorModel);
47 
48 
50  :
52  _n_srgr(0),
53  _srgr_update(),
54  _SrGr_R0()
55 {
56 }
57 
59  :
61  _n_srgr(rhs._n_srgr),
62  _srgr_update(rhs._srgr_update),
63  _SrGr_R0(rhs._SrGr_R0)
64 {
65 }
66 
68 {
69 }
70 
72 {
73  return ossimString("ossimRadarSat2Model");
74 }
75 
77 {
78  return new ossimRadarSat2Model(*this);
79 }
80 
82 {
83  if (_n_srgr==0) return(-1) ;
84 
85  double relativeGroundRange, slantRange = 0.0 ;
86 
87  // in the case of Georeferenced images, _refPoint->get_distance()
88  // contains the ground range
89  relativeGroundRange = _refPoint->get_distance() + _sensor->get_col_direction() * (col-_refPoint->get_pix_col())* theGSD.x;
90  //relativeGroundRange = 1 + _sensor->get_col_direction() * (col-_refPoint->get_pix_col())* theGSD.x;
91  //relativeGroundRange = (8.78400000e+03)*theGSD.x;
92 
93  if ( traceDebug() )
94  {
96  << "_refPoint->get_distance(): " << _refPoint->get_distance()
97  << "\n_sensor->get_col_direction() " << _sensor->get_col_direction()
98  << "\n(col-_refPoint->get_pix_col()) "
99  << (col-_refPoint->get_pix_col())
100  << "\n_refPoint->get_pix_col() : " << _refPoint->get_pix_col()
101  << "\n relativeGroundRange : " << relativeGroundRange << endl;
102  }
103 
104  int numSet = FindSRGRSetNumber((_refPoint->get_ephemeris())->get_date()) ;
109  for (int i=0 ; i < static_cast<int>(_SrGr_coeffs[numSet].size()); i++)
110  {
111 
112  slantRange += _SrGr_coeffs[numSet][i]*pow(relativeGroundRange,i) ;
113  }
114 
115  return slantRange ;
116 }
117 
119 {
120  static const char MODULE[] = "ossimRadarSat2Model::open";
121 
122  if (traceDebug())
123  {
124  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
125  }
126 
127  bool result = false;
128 
129  // Get the xml file.
130  ossimFilename xmlFile;
131  _imageFilename = file.expand();
132 
133  if (file.ext().downcase() == "xml")
134  {
135  xmlFile = file;
136  }
137  else if (file.isFile())
138  {
139  xmlFile = file.expand().path().dirCat("product.xml");
140  }
141 
142  if (traceDebug())
143  {
145  << "product xml file: " << xmlFile << "\n";
146  }
147 
148  if ( xmlFile.exists() )
149  {
150 
151  //---
152  // Instantiate the XML parser:
153  //---
154  ossimXmlDocument* xdoc = new ossimXmlDocument();
155  if ( xdoc->openFile(xmlFile) )
156  {
158 
159  result = rsDoc.isRadarSat2(xdoc);
160 
161  if (result)
162  {
163  if (traceDebug())
164  {
166  << "isRadarSat2...\n";
167  ossimString s;
168  if ( rsDoc.getBeamModeMnemonic(xdoc, s) )
169  {
171  << "beam_mode_mnemonic: " << s << "\n";
172  }
173  if ( rsDoc.getAcquisitionType(xdoc, s) )
174  {
176  << "acquisition_type: " << s << "\n";
177  }
178  }
179 
180  // Set the base class number of lines and samples
181  result = rsDoc.initImageSize(xdoc, theImageSize);
182 
183  if (result)
184  {
185  // Set the base class clip rect.
187  0, 0,
189  }
190 
191  // Set the sub image offset. tmp hard coded (drb).
192  theSubImageOffset.x = 0.0;
193  theSubImageOffset.y = 0.0;
194 
195  // Set the image id.
196  if (result)
197  {
198  result = rsDoc.getImageId(xdoc, theImageID);
199  }
200 
201  // Set the sensor ID.
202  if (result)
203  {
204  result = rsDoc.getSatellite(xdoc, theSensorID);
205  }
206 
207  // Set the base class gsd:
208  result = rsDoc.initGsd(xdoc, theGSD);
209  if (result)
210  {
211  theMeanGSD = (theGSD.x + theGSD.y)/2.0;
212  }
213 
214  if (result)
215  {
216  result = initSRGR(xdoc, rsDoc);
217 
218  if (result)
219  {
220  result = initPlatformPosition(xdoc, rsDoc);
221 
222  if (result)
223  {
224  result = initSensorParams(xdoc, rsDoc);
225 
226  if (result)
227  {
228  result = initRefPoint(xdoc, rsDoc);
229 
230  if (result)
231  {
232  result = InitRefNoiseLevel(xdoc);
233  }
234  }
235  }
236  }
237  }
238  }
239 
240  } // matches: if ( xdoc->openFile(xmlFile) )
241 
242  delete xdoc;
243  xdoc = 0;
244 
245  } // matches: if ( xmlFile.exists() )
246 
247  if (result)
248  {
249  _productXmlFile = xmlFile;
251  }
252  else
253  {
255  }
256 
257  if (result)
258  {
259  // Assign the ossimSensorModel::theBoundGndPolygon
260  ossimGpt ul;
261  ossimGpt ur;
262  ossimGpt lr;
263  ossimGpt ll;
268 
269  if (traceDebug())
270  {
272  << "theImageClipRect : " << theImageClipRect
273  << "ul, ur, lr, ll " << ul << ", " << ur
274  << ", " << lr << " , " << ll << endl;
275  }
276 
277  setGroundRect(ul, ur, lr, ll); // ossimSensorModel method.
278 
279  // OSSIM preferences specifies whether a coarse grid needs to be generated:
280  if (!createReplacementOCG())
281  result = false;
282  }
283 
284  if (traceDebug())
285  {
287  << MODULE << " exit status = " << (result?"true":"false\n")
288  << std::endl;
289  }
290 
291  return result;
292 }
293 
295 {
296  // Capture the original flags.
297  std::ios_base::fmtflags f = out.flags();
298 
299  out << setprecision(15) << setiosflags(ios::fixed)
300  << "\nossimRadarSat2Model class data members:\n"
301  << "_n_srgr: " << _n_srgr << "\n";
302 
303  ossim_uint32 idx = 0;
304  std::vector<double>::const_iterator i = _srgr_update.begin();
305  while ( i != _srgr_update.end() )
306  {
307  out << "sr_gr_update_" << idx << ": " << (*i) << "\n";
308  ++i;
309  ++idx;
310  }
311 
312  idx = 0;
313  i = _SrGr_R0.begin();
314  while ( i != _SrGr_R0.end() )
315  {
316  out << "sr_gr_r0_" << idx << ": " << (*i) << "\n";
317  ++i;
318  ++idx;
319  }
320 
321  idx = 0;
322  std::vector< std::vector<double> >::const_iterator i2 =
323  _SrGr_coeffs.begin();
324  while ( i2 != _SrGr_coeffs.end() )
325  {
326  ossim_uint32 idx2 = 0;
327  i = (*i2).begin();
328  while ( i != (*i2).end() )
329  {
330  out << "sr_gr_coeffs_" << idx << "_" << idx2 << ": " << (*i) << "\n";
331  ++i;
332  ++idx2;
333  }
334  ++i2;
335  ++idx;
336  }
337 
339 
340 
341  // Reset flags.
342  out.setf(f);
343 
344  return out;
345 }
346 
348  const char *prefix)
349 {
350 
351  // sensor frequencies
352  const char* central_freq_str = kwl.find(prefix,"central_freq");
353  double central_freq = atof(central_freq_str);
354  const char* fr_str = kwl.find(prefix,"fr");
355  double fr = atof(fr_str);
356  const char* fa_str = kwl.find(prefix,"fa");
357  double fa = atof(fa_str);
358 
359  //number of different looks
360  const char* n_azilok_str = kwl.find(prefix,"n_azilok");
361  double n_azilok = atof(n_azilok_str);
362  const char* n_rnglok_str = kwl.find(prefix,"n_rnglok");
363  double n_rnglok = atof(n_rnglok_str);
364 
365  //ellipsoid parameters
366  const char* ellip_maj_str = kwl.find(prefix,"ellip_maj");
367  double ellip_maj = atof(ellip_maj_str) * 1000.0; // km -> m
368  const char* ellip_min_str = kwl.find(prefix,"ellip_min");
369  double ellip_min = atof(ellip_min_str) * 1000.0; // km -> m
370 
371  if(_sensor != 0)
372  {
373  delete _sensor;
374  }
375 
376  _sensor = new SensorParams();
377 
378  const char* lineTimeOrdering_str = kwl.find(prefix,"lineTimeOrdering");
379  std::string lineTimeOrdering(lineTimeOrdering_str) ;
380  const char* pixelTimeOrdering_str = kwl.find(prefix,"pixelTimeOrdering");
381  std::string pixelTimeOrdering(pixelTimeOrdering_str) ;
382  if (pixelTimeOrdering == "Increasing") _sensor->set_col_direction(1);
383  else _sensor->set_col_direction(- 1);
384  if (lineTimeOrdering == "Increasing") _sensor->set_lin_direction(1);
385  else _sensor->set_lin_direction(- 1);
386 
387  const char* lookDirection_str = kwl.find(prefix,"lookDirection");
388  std::string lookDirection(lookDirection_str) ;
389  if ((lookDirection == "Right")||(lookDirection == "RIGHT")) _sensor->set_sightDirection(SensorParams::Right) ;
391 
392  _sensor->set_sf(fr);
393  const double CLUM = 2.99792458e+8 ;
394  double wave_length = CLUM / central_freq ;
395  _sensor->set_rwl(wave_length);
396  _sensor->set_nAzimuthLook(n_azilok);
397  _sensor->set_nRangeLook(n_rnglok);
398 
399  // fa is the processing PRF
400  _sensor->set_prf(fa * n_azilok);
401 
402  _sensor->set_semiMajorAxis(ellip_maj) ;
403  _sensor->set_semiMinorAxis(ellip_min) ;
404 
405  return true;
406 }
407 
409 {
410  /*
411  * Retrieval of ephemerisis number
412  */
413  const char* neph_str = kwl.find(prefix,"neph");
414  int neph = atoi(neph_str);
415 
416  Ephemeris** ephemeris = new Ephemeris*[neph];
417  for (int i = 0; i < neph; ++i)
418  {
419  ephemeris[i] = 0; // In case of early termination, for delete block.
420  }
421 
422  /*
423  * Retrieval of ephemerisis
424  */
425  for (int i=0;i<neph;i++)
426  {
427  double pos[3];
428  double vit[3];
429  char name[64];
430 
431 
432  sprintf(name,"eph%i_date",i);
433  const char* date_str = kwl.find(prefix,name);
434 
435  sprintf(name,"eph%i_posX",i);
436  const char* px_str = kwl.find(prefix,name);
437  pos[0] = atof(px_str);
438 
439  sprintf(name,"eph%i_posY",i);
440  const char* py_str = kwl.find(prefix,name);
441  pos[1] = atof(py_str);
442 
443  sprintf(name,"eph%i_posZ",i);
444  const char* pz_str = kwl.find(prefix,name);
445  pos[2] = atof(pz_str);
446 
447 
448  sprintf(name,"eph%i_velX",i);
449  const char* vx_str = kwl.find(prefix,name);
450  vit[0] = atof(vx_str) ;
451 
452  sprintf(name,"eph%i_velY",i);
453  const char* vy_str = kwl.find(prefix,name);
454  vit[1] = atof(vy_str) ;
455 
456  sprintf(name,"eph%i_velZ",i);
457  const char* vz_str = kwl.find(prefix,name);
458  vit[2] = atof(vz_str) ;
459 
460  /*
461  * Conversion to JSD Date
462  */
463  std::string utcString(date_str);
464  CivilDateTime eph_civil_date;
465 
466  if (! ossim::iso8601TimeStringToCivilDate(utcString, eph_civil_date))
467  {
468  for (i=0;i<neph;++i)
469  {
470  delete ephemeris[i];
471  }
472  delete[] ephemeris;
473  ephemeris = 0;
474 
475  return false;
476  }
477 
478  JSDDateTime eph_jsd_date(eph_civil_date);
479 
480  GeographicEphemeris* eph = new GeographicEphemeris(eph_jsd_date,pos,vit);
481 
482  ephemeris[i] = eph;
483  }
484 
485  /*
486  * Creation of the platform position interpolator
487  */
488  if (_platformPosition != 0)
489  {
490  delete _platformPosition;
491  }
492  _platformPosition = new PlatformPosition(ephemeris,neph);
493 
494  /*
495  * Free of memory used by ephemerisis list : the constructor copies the ephemerisis
496  */
497  for (int i=0;i<neph;i++)
498  {
499  delete ephemeris[i];
500  }
501  delete[] ephemeris;
502  ephemeris = 0;
503 
504  return true;
505 }
506 
508  const char *prefix)
509 {
510  // in order to use ossimSensorModel::lineSampleToWorld
511  const char* nbCol_str = kwl.find(prefix,"nbCol");
512  const char* nbLin_str = kwl.find(prefix,"nbLin");
513  theImageSize.x = atoi(nbCol_str);
514  theImageSize.y = atoi(nbLin_str);
516 
517  // no reference point (e.g. scene center) is given in the annotation file
518  // we choose to use the upper left corner as reference point
519  if(_refPoint == 0)
520  {
521  _refPoint = new RefPoint();
522  }
523 
524  _refPoint->set_pix_col(0); // upper left corner
525  _refPoint->set_pix_line(0); // upper left corner
526 
527  const char* zeroDopplerTimeFirstLine_str = kwl.find(prefix,"zeroDopplerTimeFirstLine");
528  std::string zeroDopplerTimeFirstLine(zeroDopplerTimeFirstLine_str);
529 
530  if(_platformPosition != 0)
531  {
532  CivilDateTime * date = new CivilDateTime() ;
533  if (! ossim::iso8601TimeStringToCivilDate(zeroDopplerTimeFirstLine, *date)) return false ;
534 
535  if (_sensor->get_lin_direction() == -1) {
536  double time = (double) date->get_second() + date->get_decimal() ; // upper left corner
537  time += theImageSize.y / _sensor->get_prf() ;
538  date->set_second((int) floor(time)) ;
539  date->set_decimal(time - floor(time)) ;
540  }
541 
542  Ephemeris* ephemeris = _platformPosition->Interpolate((JSDDateTime)*date);
543  if (ephemeris == 0) return false ;
544  _refPoint->set_ephemeris(ephemeris);
545 
546  delete ephemeris;
547  ephemeris = 0;
548  delete date;
549  date = 0;
550  }
551  else
552  {
553  return false;
554  }
555 
556  const char* slantRangeNearEdge_str = kwl.find(prefix,"slantRangeNearEdge");
557  double distance = atof(slantRangeNearEdge_str);
558 
559  //---
560  // NOTE: initSRGR method must be called before this method.
561  // in the case of Georeferenced images, the ground range is stored in
562  // place of the slant range
563  // (used for SlantRange computation relative to reference point, necessary
564  // for optimization)
565  //---
567  {
568  if (_sensor->get_col_direction() == 1)
569  {
570  distance += 0.0; // upper left corner
571  }
572  else
573  {
575  }
576  }
577 
579 
580  // Ground Control Points extracted from the model
581  std::list<ossimGpt> groundGcpCoordinates ;
582  std::list<ossimDpt> imageGcpCoordinates ;
583  const char* nTiePoints_str = kwl.find(prefix,"nTiePoints");
584  int nTiePoints = atoi(nTiePoints_str);
585  char name[64];
586  for (int k=0 ; k<nTiePoints ; k++) {
587  sprintf(name,"cornersCol%i",k);
588  const char* i_str = kwl.find(name);
589  int i = atoi(i_str);
590  sprintf(name,"cornersLin%i",k);
591  const char* j_str = kwl.find(name);
592  int j = atoi(j_str);
593  sprintf(name,"cornersLon%i",k);
594  const char* lon_str = kwl.find(name);
595  double lon = atof(lon_str);
596  sprintf(name,"cornersLat%i",k);
597  const char* lat_str = kwl.find(name);
598  double lat = atof(lat_str);
599  sprintf(name,"cornersHeight%i",k);
600  const char* height_str = kwl.find(name);
601  double height = atof(height_str);
602 
603  ossimDpt imageGCP(i,j);
604  ossimGpt groundGCP(lat ,lon , height);
605  groundGcpCoordinates.push_back(groundGCP) ;
606  imageGcpCoordinates.push_back(imageGCP) ;
607  }
608 
609  // Default optimization
610  optimizeModel(groundGcpCoordinates, imageGcpCoordinates) ;
611 
612  return true;
613 }
614 
616  const char *prefix)
617 {
618  const char* productType_str = kwl.find(prefix,"productType");
619  ossimString productType(productType_str);
620 
621  _isProductGeoreferenced = (productType != "SLC") ;
622 
623 // // Pixel spacing
624 // const char* pixel_spacing_str = kwl.find(prefix,"pixel_spacing_mean");
625 // _pixel_spacing = atof(pixel_spacing_str);
626 
627 // // Number of columns
628 // const char* nbCol_str = kwl.find(prefix,"nbCol");
629 // _nbCol = atoi(nbCol_str);
630 
631  // number of SRGR coefficient sets
632  const char* SrGr_coeffs_number_str = kwl.find(prefix,"SrGr_coeffs_number");
633  _n_srgr = atoi(SrGr_coeffs_number_str);
634 
635  // SRGR coefficients and exponents
636  char name[64];
637  for(int i=0;i<_n_srgr;i++)
638  {
639  std::vector<double> srgr_set ;
640  for(int j=0;j<4;j++)
641  {
642  sprintf(name,"SrGr_coeffs_%i_%i",i,j);
643  const char* coeff_str = kwl.find(prefix,name);
644  double coeff = atof(coeff_str);
645  srgr_set.push_back(coeff);
646  }
647  _SrGr_coeffs.push_back(srgr_set);
648  // SRGR polynomial reference
649  sprintf(name,"SrGr_R0_%i",i);
650  const char* SrGr_R0_str = kwl.find(prefix,name);
651  _SrGr_R0.push_back(atof(SrGr_R0_str));
652  // SRGR update time
653  sprintf(name,"SrGr_update_%i",i);
654  const char* SrGr_update_str = kwl.find(prefix,name);
655  CivilDateTime SrGr_update_date ;
656  ossim::iso8601TimeStringToCivilDate(std::string(SrGr_update_str), SrGr_update_date) ;
657  _srgr_update.push_back((double) SrGr_update_date.get_second()+ SrGr_update_date.get_decimal());
658  }
659 
660  return true;
661 }
662 
664 {
665  if (_n_srgr==0) return(-1) ;
666 
667  double delays[20];
668  for (int i=0;i<_n_srgr;i++)
669  {
670  delays[i] = fabs(date.get_second()+date.get_decimal()-_srgr_update[i]) ;
671  }
672 
673  int setNumber = 0 ;
674  double min_delay = delays[0] ;
675  for (int i=1;i<_n_srgr;i++)
676  {
677  if (delays[i]<min_delay) {
678  setNumber = i ;
679  min_delay = delays[i] ;
680  }
681  }
682  return setNumber ;
683 }
684 
686  const ossimRadarSat2ProductDoc& rsDoc)
687 {
688  static const char MODULE[] = "ossimRadarSat2Model::initSRGR";
689 
690  if (traceDebug())
691  {
692  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
693  }
694 
695  bool result = true;
696 
697  ossimString s;
698 
699  // Get the product type.
700  if ( rsDoc.getProductType(xdoc, s) )
701  {
702  _isProductGeoreferenced = (s != "SLC");
703  }
704  else
705  {
706  result = false;
707  }
708 
709  ossimString path =
710  "/product/imageGenerationParameters/slantRangeToGroundRange";
711  std::vector<ossimRefPtr<ossimXmlNode> > xnodes;
712  xdoc->findNodes(path, xnodes);
713  if ( xnodes.size() )
714  {
715  //---
716  // Set the number of slant range for each ground range (srgs)
717  // coefficients.
718  //---
719  _n_srgr = static_cast<int>(xnodes.size());
720 
721  for (ossim_uint32 i = 0; i < xnodes.size(); ++i)
722  {
723  if (xnodes[i].valid())
724  {
725  ossimRefPtr<ossimXmlNode> node = 0;
726  node = xnodes[i]->findFirstNode(
727  ossimString("zeroDopplerAzimuthTime"));
728  if (node.valid())
729  {
730  CivilDateTime date;
732  _srgr_update.push_back((double) date.get_second()+
733  date.get_decimal());
734  }
735 
736  node = xnodes[i]->findFirstNode(
737  ossimString("groundRangeOrigin"));
738  if (node.valid())
739  {
740  _SrGr_R0.push_back(node->getText().toDouble());
741  }
742 
743  node = xnodes[i]->findFirstNode(
744  ossimString("groundToSlantRangeCoefficients"));
745  if (node.valid())
746  {
747  std::vector<ossimString> vs;
748  node->getText().split(vs, ' ');
749  std::vector<double> vd;
750  for (ossim_uint32 idx = 0; idx < vs.size(); ++idx)
751  {
752  vd.push_back(vs[idx].toDouble());
753  }
754  _SrGr_coeffs.push_back(vd);
755  }
756  }
757  }
758  }
759 
760  if (traceDebug())
761  {
763  << MODULE << " exit status = " << (result?"true":"false\n")
764  << std::endl;
765  }
766 
767  return result;
768 }
769 
771  const ossimXmlDocument* xdoc, const ossimRadarSat2ProductDoc& rsDoc)
772 {
773  static const char MODULE[] = "ossimRadarSat2Model::initPlatformPosition";
774 
775  if (traceDebug())
776  {
777  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
778  }
779 
780  // Initialize the platform position interpolator.
781  if (_platformPosition)
782  {
783  delete _platformPosition;
784  }
785 
787 
788  bool result = rsDoc.initPlatformPosition(xdoc, _platformPosition);
789 
790  if (!result)
791  {
792  delete _platformPosition;
793  _platformPosition = 0;
794  }
795 
796  if (traceDebug())
797  {
799  << MODULE << " exit status = " << (result?"true":"false\n")
800  << std::endl;
801  }
802 
803  return result;
804 }
805 
807  const ossimXmlDocument* xdoc, const ossimRadarSat2ProductDoc& rsDoc)
808 {
809  static const char MODULE[] = "ossimRadarSat2Model::initSensorParams";
810 
811  if (traceDebug())
812  {
813  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
814  }
815 
816  if (_sensor )
817  {
818  delete _sensor;
819  }
820  _sensor = new SensorParams();
821 
822  bool result = rsDoc.initSensorParams(xdoc, _sensor);
823 
824  if (!result)
825  {
826  delete _sensor;
827  _sensor = 0;
828  }
829 
830  if (traceDebug())
831  {
833  << MODULE << " exit status = " << (result?"true":"false\n")
834  << std::endl;
835  }
836 
837  return result;
838 }
839 
840 
842  const ossimRadarSat2ProductDoc& rsDoc)
843 {
844  static const char MODULE[] = "ossimRadarSat2Model::initRefPoint";
845 
846  if (traceDebug())
847  {
848  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
849  }
850 
851  if ( !_sensor || !_platformPosition )
852  {
853  if (traceDebug())
854  {
856  << MODULE << "null pointer error! exiting\n";
857  }
858  return false;
859  }
860 
861  // Reference point.
862  if (_refPoint)
863  {
864  delete _refPoint;
865  }
866  _refPoint = new RefPoint();
867 
868  // Ground Control Points extracted from the model.
869  std::list<ossimGpt> groundGcpCoordinates;
870  std::list<ossimDpt> imageGcpCoordinates;
871  if ( rsDoc.initTiePoints(xdoc,
872  groundGcpCoordinates,
873  imageGcpCoordinates) == false )
874  {
875  if (traceDebug())
876  {
878  << MODULE << "initTiePoint error! exiting\n";
879  }
880  return false;
881  }
882 
883  if ( setModelRefPoint(groundGcpCoordinates, imageGcpCoordinates) )
884  {
887  }
888  else
889  {
890  // no reference point (e.g. scene center) is given in the annotation file
891  // we choose to use the upper left corner as reference point
892  _refPoint->set_pix_col(0); // upper left corner
893  _refPoint->set_pix_line(0); // upper left corner
894  }
895 
896  ossimString s;
897  CivilDateTime date;
898  if ( rsDoc.getZeroDopplerTimeFirstLine(xdoc, s) )
899  {
901  {
902  if (traceDebug())
903  {
905  << MODULE << "getZeroDopplerTimeFirstLine error! exiting\n";
906  }
907  return false;
908  }
909  }
910 
911  if (_sensor->get_lin_direction() == -1)
912  {
913  // upper left corner
914  double time = (double) date.get_second() + date.get_decimal();
915  time += theImageSize.y / _sensor->get_prf() ;
916  date.set_second((int) floor(time)) ;
917  date.set_decimal(time - floor(time));
918  }
919 
920  if (traceDebug())
921  {
923  << "date:\n"
924  << date
925  << "\n";
926  }
927 
928  JSDDateTime jsdate(date);
929 
930  // Ephemeris * ephemeris = _platformPosition->Interpolate((JSDDateTime)date);
931  Ephemeris * ephemeris = _platformPosition->Interpolate(jsdate);
932  if (ephemeris == 0)
933  {
934  if (traceDebug())
935  {
937  << MODULE << " Interpolate error! exiting\n";
938  }
939  return false;
940  }
941  _refPoint->set_ephemeris(ephemeris);
942  delete ephemeris;
943  ephemeris = 0;
944 
945  double distance = 1;
946 
947  // Only set distance to
949  {
950  if ( !rsDoc.getSlantRangeNearEdge(xdoc, s) )
951  {
952  if (traceDebug())
953  {
955 
956  << MODULE << "getSlantRangeNearEdge error! exiting\n";
957  }
958  return false;
959  }
960  distance = s.toDouble();
961  }
962 
963  //---
964  // in the case of Georeferenced images, the ground range is stored in
965  // place of the slant range
966  // (used for SlantRange computation relative to reference point,
967  // necessary for optimization)
968  //---
970  {
971  if (_sensor->get_col_direction() == 1)
972  {
973  distance += 0 ; // upper left corner
974  }
975  else
976  {
978  }
979  }
980 
981 
983 
984  // Default optimization
985  optimizeModel(groundGcpCoordinates, imageGcpCoordinates) ;
986 
987  if (traceDebug())
988  {
990  << MODULE << " exit status = true\n";
991  }
992 
993  return true;
994 }
995 
996 
998  RadarSat2NoiseLevel& noise)
999 {
1000  static const char MODULE[] = "ossimRadarSat2Model::initLut";
1001  if (traceDebug())
1002  {
1003  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
1004  }
1005 
1006  ossimString xpath;
1007  ossimString incidenceAngleCorrectionName;
1008  std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
1009  std::vector<ossimRefPtr<ossimXmlNode> >::iterator node;
1010  ossimFilename lutXmlFile;
1011 
1012  incidenceAngleCorrectionName = noise.get_incidenceAngleCorrectionName();
1013 
1014  xpath = "/product/imageAttributes/lookupTable";
1015  xml_nodes.clear();
1016  xmlDocument->findNodes(xpath, xml_nodes);
1017  if(xml_nodes.size() == 0)
1018  {
1019  setErrorStatus();
1020  if(traceDebug())
1021  {
1023  << MODULE << " DEBUG:"
1024  << "\nCould not find: " << xpath
1025  << std::endl;
1026  }
1027  return false;
1028  }
1029 
1030  node = xml_nodes.begin();
1031  while (node != xml_nodes.end())
1032  {
1033  if( (*node)->getAttributeValue("incidenceAngleCorrection") == incidenceAngleCorrectionName )
1034  {
1035  // Get the xml file.
1036  lutXmlFile = _productXmlFile.expand().path().dirCat((*node)->getText());
1037 
1038  if ( lutXmlFile.exists() )
1039  {
1040  //---
1041  // Instantiate the XML parser:
1042  //---
1043  ossimXmlDocument* xmlLutDocument = new ossimXmlDocument();
1044  if ( xmlLutDocument->openFile(lutXmlFile) )
1045  {
1046  std::vector<ossimRefPtr<ossimXmlNode> > xml_lutNodes;
1047  ossimString s;
1048 
1049  xpath = "/lut/offset";
1050  xml_lutNodes.clear();
1051  xmlLutDocument->findNodes(xpath, xml_lutNodes);
1052  if(xml_lutNodes.size() == 0)
1053  {
1054  setErrorStatus();
1055  if(traceDebug())
1056  {
1058  << MODULE << " DEBUG:"
1059  << "\nCould not find: " << xpath
1060  << std::endl;
1061  }
1062  return false;
1063  }
1064  ossim_float64 offset = xml_lutNodes[0]->getText().toFloat64();
1065  noise.set_offset(offset);
1066 
1067  xpath = "/lut/gains";
1068  xml_lutNodes.clear();
1069  xmlLutDocument->findNodes(xpath, xml_lutNodes);
1070  if(xml_lutNodes.size() == 0)
1071  {
1072  setErrorStatus();
1073  if(traceDebug())
1074  {
1076  << MODULE << " DEBUG:"
1077  << "\nCould not find: " << xpath
1078  << std::endl;
1079  }
1080  return false;
1081  }
1082  noise.set_gain(xml_lutNodes[0]->getText());
1083  }
1084  }
1085  }
1086  ++node;
1087  }
1088 
1089  if (traceDebug())
1090  {
1091  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " leaving...\n";
1092  }
1093 
1094  return true;
1095 }
1096 
1098  const ossimXmlDocument* xmlDocument)
1099 {
1100  static const char MODULE[] = "ossimRadarSat2Model::initRefNoiseLevel";
1101 
1102  ossimString xpath;
1103  std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
1104  std::vector<ossimRefPtr<ossimXmlNode> > sub_nodes;
1105  std::vector<ossimRefPtr<ossimXmlNode> >::iterator node;
1107 
1108  if (traceDebug())
1109  {
1110  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
1111  }
1112 
1113  _noiseLevel.clear();
1114 
1115 
1116  xpath = "/product/sourceAttributes/radarParameters/referenceNoiseLevel";
1117  xml_nodes.clear();
1118  xmlDocument->findNodes(xpath, xml_nodes);
1119  if(xml_nodes.size() == 0)
1120  {
1121  setErrorStatus();
1122  if(traceDebug())
1123  {
1125  << MODULE << " DEBUG:"
1126  << "\nCould not find: " << xpath
1127  << std::endl;
1128  }
1129  return false;
1130  }
1131 
1132  node = xml_nodes.begin();
1133  while (node != xml_nodes.end())
1134  {
1135 
1136  ev.set_incidenceAngleCorrectionName( (*node)->getAttributeValue("incidenceAngleCorrection") );
1137 
1138  sub_nodes.clear();
1139  xpath = "pixelFirstNoiseValue";
1140  (*node)->findChildNodes(xpath, sub_nodes);
1141  if (sub_nodes.size() == 0)
1142  {
1143  setErrorStatus();
1144  if(traceDebug())
1145  {
1147  << MODULE << " DEBUG:"
1148  << "\nCould not find: " << xpath
1149  << std::endl;
1150  }
1151  return false;
1152  }
1153  ev.set_pixelFirstNoiseValue(sub_nodes[0]->getText().toUInt32());
1154 
1155  sub_nodes.clear();
1156  xpath = "stepSize";
1157  (*node)->findChildNodes(xpath, sub_nodes);
1158  if (sub_nodes.size() == 0)
1159  {
1160  setErrorStatus();
1161  if(traceDebug())
1162  {
1164  << MODULE << " DEBUG:"
1165  << "\nCould not find: " << xpath
1166  << std::endl;
1167  }
1168  return false;
1169  }
1170  ev.set_stepSize(sub_nodes[0]->getText().toUInt32());
1171 
1172  sub_nodes.clear();
1173  xpath = "numberOfNoiseLevelValues";
1174  (*node)->findChildNodes(xpath, sub_nodes);
1175  if (sub_nodes.size() == 0)
1176  {
1177  setErrorStatus();
1178  if(traceDebug())
1179  {
1181  << MODULE << " DEBUG:"
1182  << "\nCould not find: " << xpath
1183  << std::endl;
1184  }
1185  return false;
1186  }
1187  ev.set_numberOfNoiseLevelValues(sub_nodes[0]->getText().toUInt32());
1188 
1189  sub_nodes.clear();
1190  xpath = "noiseLevelValues";
1191  (*node)->findChildNodes(xpath, sub_nodes);
1192  if (sub_nodes.size() == 0)
1193  {
1194  setErrorStatus();
1195  if(traceDebug())
1196  {
1198  << MODULE << " DEBUG:"
1199  << "\nCould not find: " << xpath
1200  << std::endl;
1201  }
1202  return false;
1203  }
1204  ev.set_units( sub_nodes[0]->getAttributeValue("units") );
1205 
1206 
1207  std::vector<ossimString> s2;
1208  std::vector<ossim_float64> noiseLevelValues;
1209  s2.clear();
1210  noiseLevelValues.clear();
1211  s2 = sub_nodes[0]->getText().split(" ");
1212  for(ossim_uint32 i = 0; i < s2.size(); ++i)
1213  {
1214  noiseLevelValues.push_back( s2[i].toFloat64() );
1215  }
1216  ev.set_noiseLevelValues( noiseLevelValues );
1217 
1218  InitLut(xmlDocument, ev);
1219 
1220 
1221  _noiseLevel.push_back(ev);
1222 
1223  ++node;
1224  }
1225 
1226  if (traceDebug())
1227  {
1228  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " leaving...\n";
1229  }
1230 
1231  return true;
1232 }
1233 
1234 
1235 
1236 
1238  const char* prefix) const
1239 {
1240  static const char MODULE[] = "ossimRadarSat2Model::saveState";
1241 
1242  if (traceDebug())
1243  {
1244  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
1245  }
1246 
1247  bool result = true;
1248 
1249  // Save our state:
1250  kwl.add(prefix, PRODUCT_XML_FILE_KW, _productXmlFile.c_str());
1251  kwl.add(prefix, NUMBER_SRGR_COEFFICIENTS_KW, _n_srgr);
1252 
1253  // Make sure all the arrays are equal in size.
1254  const ossim_uint32 COUNT = static_cast<ossim_uint32>(_n_srgr);
1255 
1256  if ( (_srgr_update.size() == COUNT) &&
1257  (_SrGr_R0.size() == COUNT) &&
1258  (_SrGr_coeffs.size() == COUNT) )
1259  {
1260  ossimString kw1 = "sr_gr_update_";
1261  ossimString kw2 = "sr_gr_r0_";
1262  ossimString kw3 = "sr_gr_coeffs_";
1263 
1264  for(ossim_uint32 i = 0; i < COUNT; ++i)
1265  {
1267 
1268  ossimString kw = kw1;
1269  kw += iStr;
1270  kwl.add(prefix, kw, _srgr_update[i]);
1271 
1272  kw = kw2;
1273  kw += iStr;
1274  kwl.add(prefix, kw, _SrGr_R0[i]);
1275 
1276  for (ossim_uint32 j = 0; j < _SrGr_coeffs[i].size(); ++j)
1277  {
1279  kw = kw3;
1280  kw += iStr;
1281  kw += "_";
1282  kw += jStr;
1283  kwl.add(prefix, kw,_SrGr_coeffs[i][j]);
1284  }
1285  }
1286  }
1287  else
1288  {
1289  result = false;
1290  }
1291 
1292  if (result)
1293  {
1294  // Call base save state:
1295  result = ossimGeometricSarSensorModel::saveState(kwl, prefix);
1296  }
1297 
1298  if (result)
1299  {
1300  for(ossim_uint32 i = 0; i < _noiseLevel.size(); ++i)
1301  {
1302  _noiseLevel[i].saveState(kwl, prefix);
1303  }
1304 
1305  }
1306 
1307  //---
1308  // Uncomment to force load from product file instead of loadState.
1309  //---
1310  //if (result)
1311  //{
1312  // kwl.add(prefix, LOAD_FROM_PRODUCT_FILE_KW, "true");
1313  //}
1314 
1315  if (traceDebug())
1316  {
1318  << MODULE << " exit status = " << (result?"true":"false\n")
1319  << std::endl;
1320  }
1321 
1322  return result;
1323 }
1324 
1326  const char *prefix)
1327 {
1328  static const char MODULE[] = "ossimRadarSat2Model::loadState";
1329 
1330  if (traceDebug())
1331  {
1332  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
1333  }
1334 
1335  const char* lookup = 0;
1336  ossimString s;
1337 
1338  // Check the type first.
1339  lookup = kwl.find(prefix, ossimKeywordNames::TYPE_KW);
1340  if (lookup)
1341  {
1342  s = lookup;
1343  if (s != getClassName())
1344  {
1345  return false;
1346  }
1347  }
1348 
1349  // Get the product.xml file name.
1350  lookup = kwl.find(prefix, PRODUCT_XML_FILE_KW);
1351  if (lookup)
1352  {
1353  _productXmlFile = lookup;
1354 
1355  // See if caller wants to load from xml vice keyword list.
1356  lookup = kwl.find(prefix, LOAD_FROM_PRODUCT_FILE_KW);
1357  if (lookup)
1358  {
1359  s = lookup;
1360  if ( s.toBool() )
1361  {
1362  // Loading from product.xml file.
1363  return open(_productXmlFile);
1364  }
1365  }
1366  }
1367 
1368  //---
1369  // Temp: This must be cleared or you end up with a bounding rect of all
1370  // zero's.
1371  //---
1373 
1374  // Load the base class.
1375  bool result = ossimGeometricSarSensorModel::loadState(kwl, prefix);
1376 
1377 
1378  if (result)
1379  {
1380  lookup = kwl.find(prefix, NUMBER_SRGR_COEFFICIENTS_KW);
1381  if (lookup)
1382  {
1383  s = lookup;
1384  _n_srgr = s.toInt();
1385  }
1386  else
1387  {
1388  if (traceDebug())
1389  {
1391  << MODULE
1392  << "\nRequired keyword not found: "
1393  << NUMBER_SRGR_COEFFICIENTS_KW << "\n";
1394  }
1395  result = false;
1396  }
1397 
1398  if (result && _n_srgr)
1399  {
1400  const ossim_uint32 COUNT = static_cast<ossim_uint32>(_n_srgr);
1401 
1402  _srgr_update.resize(COUNT);
1403  _SrGr_R0.resize(COUNT);
1404  _SrGr_coeffs.resize(COUNT);
1405 
1406  ossimString kw1 = "sr_gr_update_";
1407  ossimString kw2 = "sr_gr_r0_";
1408  ossimString kw3 = "sr_gr_coeffs_";
1409 
1410  for(ossim_uint32 i = 0; i < COUNT; ++i)
1411  {
1412  ossimString kw;
1414 
1415  // Get the _srgr_update's.
1416  kw = kw1;
1417  kw += iStr;
1418 
1419  lookup = kwl.find(prefix, kw);
1420  if (lookup)
1421  {
1422  s = lookup;
1423  _srgr_update[i] = s.toDouble();
1424  }
1425  else
1426  {
1427  if (traceDebug())
1428  {
1430  << MODULE
1431  << "\nRequired keyword not found: "
1432  << kw << "\n";
1433  }
1434  result = false;
1435  }
1436 
1437  // Get the sr_gr_r0_'s.
1438  kw = kw2;
1439  kw += iStr;
1440  lookup = kwl.find(prefix, kw);
1441  if (lookup)
1442  {
1443  s = lookup;
1444  _SrGr_R0[i] = s.toDouble();
1445  }
1446  else
1447  {
1448  if (traceDebug())
1449  {
1451  << MODULE
1452  << "\nRequired keyword not found: "
1453  << kw << "\n";
1454  }
1455  result = false;
1456  }
1457 
1458  //---
1459  // Get the _SrGr_coeffs.
1460  // Note we are assuming a count of 6.
1461  //---
1462  const ossim_uint32 COEFFS_COUNT = 6;
1463  _SrGr_coeffs[i].resize(COEFFS_COUNT);
1464 
1465  for (ossim_uint32 j = 0; j < COEFFS_COUNT; ++j)
1466  {
1468  kw = kw3;
1469  kw += iStr;
1470  kw += "_";
1471  kw += jStr;
1472  lookup = kwl.find(prefix, kw);
1473  if (lookup)
1474  {
1475  s = lookup;
1476  _SrGr_coeffs[i][j] = s.toDouble();
1477  }
1478  else
1479  {
1480  if (traceDebug())
1481  {
1483  << MODULE
1484  << "\nRequired keyword not found: "
1485  << kw << "\n";
1486  }
1487  result = false;
1488  }
1489  }
1490 
1491  } // matches: for(ossim_uint32 i = 0; i < COUNT; ++i)
1492 
1493  } // matches: if (_n_srgr)
1494  else
1495  {
1496  result = false;
1497  }
1498 
1499  } // matches: if (result)
1500 
1501  if(result)
1502  {
1503  for(ossim_uint32 i = 0; i < _noiseLevel.size(); ++i)
1504  {
1505  _noiseLevel[i].loadState(kwl, prefix);
1506  }
1507  }
1508 
1509  if (traceDebug())
1510  {
1512  << MODULE << " exit status = " << (result?"true":"false\n")
1513  << std::endl;
1514  }
1515 
1516  return result;
1517 }
1518 
1520  const std::list<ossimGpt>& groundGcpCoordinates,
1521  const std::list<ossimDpt>& imageGcpCoordinates)
1522 {
1523  static const char MODULE[] = "ossimRadarSat2Model::setModelRefPoint";
1524  if (traceDebug())
1525  {
1526  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
1527  }
1528 
1529  bool result = false;
1530 
1531  if ( !theImageSize.hasNans() &&
1532  (groundGcpCoordinates.size() == imageGcpCoordinates.size()) )
1533  {
1534  const ossim_float64 THRESHOLD = 1.0;
1535  ossimDpt center;
1536  center.x = theImageSize.x / 2.0;
1537  center.y = theImageSize.y / 2.0;
1538  std::list<ossimGpt>::const_iterator gi = groundGcpCoordinates.begin();
1539  std::list<ossimDpt>::const_iterator di = imageGcpCoordinates.begin();
1540 
1541  result = true;
1542 
1543  // Set the first point to reference for starters:
1544  theRefImgPt = (*di);
1545  theRefGndPt = (*gi);
1546  ++gi;
1547  ++di;
1548 
1549  // Loop to find the image point closest to center.
1550  while( gi != groundGcpCoordinates.end() )
1551  {
1552  ossim_float64 deltaX = std::fabs( (*di).x - center.x);
1553  ossim_float64 deltaY = std::fabs( (*di).y - center.y);
1554  ossim_float64 deltaX2 = std::fabs( theRefImgPt.x - center.x);
1555  ossim_float64 deltaY2 = std::fabs( theRefImgPt.y - center.y);
1556 
1557  if ( (deltaX <= deltaX2) && (deltaY <= deltaY2) )
1558  {
1559  // Closer to center than previous:
1560  theRefImgPt = (*di);
1561  theRefGndPt = (*gi);
1562 
1563  // If threshold is met get out of loop:
1564  if ( (deltaX <= THRESHOLD) && (deltaY <= THRESHOLD) )
1565  {
1566  break;
1567  }
1568  }
1569 
1570  ++gi;
1571  ++di;
1572 
1573  } // matches: while( gi != groundGcpCoordinates.end() )
1574  }
1575 
1576  if (traceDebug())
1577  {
1578  if ( result )
1579  {
1581  << "image reference point: " << theRefImgPt
1582  << "\nground reference point: " << theRefGndPt
1583  << "\n";
1584  }
1586  << MODULE << " exit status = " << (result?"true":"false\n")
1587  << std::endl;
1588  }
1589 
1590  return result;
1591 
1592 } // End: bool ossimRadarSat2Model::setModelRefPoint( ... )
1593 
1594 } // End: namespace ossimplugins
bool getZeroDopplerTimeFirstLine(const ossimXmlDocument *xdoc, ossimString &s) const
ossimString theSensorID
This class represent an ephemeris in Geographic coordinates system.
void clear()
Erases the entire container.
Definition: ossimString.h:432
bool initPlatformPosition(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
bool open(const ossimFilename &file)
Method to intantial model from a file.
void set_sightDirection(SightDirection sight)
Definition: SensorParams.h:93
This class represents a date and time in the civil format.
Definition: CivilDateTime.h:30
bool createReplacementOCG()
Creates replacement coarse grid model if user requested via ossim preferences keyword "geometric_sar_...
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
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.
bool valid() const
Definition: ossimRefPtr.h:75
Ephemeris * get_ephemeris()
Definition: RefPoint.cpp:90
const char * find(const char *key) const
ossimString theImageID
ossimFilename expand() const
Method to do file name expansion.
bool initSensorParams(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
std::vector< RadarSat2NoiseLevel > _noiseLevel
noise level values
const ossimDpt & ul() const
Definition: ossimDrect.h:339
double y
Definition: ossimDpt.h:165
This class handles the referential point.
Definition: RefPoint.h:29
virtual bool InitSensorParams(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Sensor Params from a projection keywordlist.
double get_distance() const
Definition: RefPoint.cpp:95
void set_lin_direction(int dir)
Definition: SensorParams.h:128
const ossimString & get_incidenceAngleCorrectionName() const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual bool InitLut(const ossimXmlDocument *xmlDocument, RadarSat2NoiseLevel &noise)
int FindSRGRSetNumber(JSDDateTime date) const
Finds the SRGR data set which update time is the closest to the center scene time.
void set_incidenceAngleCorrectionName(const ossimString &value)
bool initTiePoints(const ossimXmlDocument *xdoc, std::list< ossimGpt > &gcp, std::list< ossimDpt > &icp) const
Method to initialize image tie points from RadarSat "product.xml" file.
Class to encapsulate parsing RadarSat2 product.xml file.
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
void set_second(int second)
bool getSatellite(const ossimXmlDocument *xdoc, ossimString &s) const
bool iso8601TimeStringToCivilDate(const std::string &dataString, CivilDateTime &outputDate)
Converts date string from ISO 8601 format to CivilDateTime.
This class handles the sensor parameters.
Definition: SensorParams.h:29
const ossimRefPtr< ossimXmlNode > & findFirstNode(const ossimString &rel_xpath) const
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
static const char * TYPE_KW
void set_offset(const ossim_float64 &value)
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 allows for direct localisation and indirect localisation using the geometric model of SAR ...
double ossim_float64
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossimObject * dup() const
Returns pointer to a new instance, copy of this.
ossimDpt theSubImageOffset
void add(const ossimFilename &f)
Add support data filename to the list:
const ossimString & getText() const
Definition: ossimXmlNode.h:92
This class represents an ephemeris.
Definition: Ephemeris.h:28
bool getAcquisitionType(const ossimXmlDocument *xdoc, ossimString &s) const
/product/sourceAttributes/radarParameters/acquisitionType
void set_decimal(double decimal)
bool isRadarSat2(const ossimXmlDocument *xdoc) const
Checks for node /product/sourceAttributes/satellite containing RADARSAT-2.
int _n_srgr
Slant Range FOR EACH Ground Range (SRGR) number of coefficients sets.
bool openFile(const ossimFilename &filename)
bool initSensorParams(const ossimXmlDocument *xdoc, SensorParams *sp) const
Method to initialize SensorParams object from RadarSat "product.xml" file.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
void set_pixelFirstNoiseValue(const ossim_uint32 &value)
bool exists() const
bool toBool() const
String to numeric methods.
std::string::iterator begin()
Definition: ossimString.h:420
bool initGsd(const ossimXmlDocument *xdoc, ossimDpt &gsd) const
Method to initialize gsd from RadarSat "product.xml" file.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
unsigned int ossim_uint32
ossimPolygon theBoundGndPolygon
virtual bool InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Platform Position from a projection keywordlist.
double toDouble() const
ossim_float64 toFloat64() const
bool isFile() const
void set_semiMajorAxis(double value)
Definition: SensorParams.h:153
virtual bool InitRefPoint(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Reference Point from a projection keywordlist.
std::vector< double > _SrGr_R0
Slant Range FOR EACH Ground Range Projection reference point.
double get_second() const
Definition: JSDDateTime.h:76
virtual double getSlantRangeFromGeoreferenced(double col) const
This function associates an image column number to a slant range when the image is georeferenced (gro...
void set_gain(const ossimString &value)
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
void set_numberOfNoiseLevelValues(const ossim_uint32 &value)
double get_pix_col() const
Definition: RefPoint.cpp:105
This class represents an Noise.
void set_nRangeLook(double look)
Definition: SensorParams.h:138
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
virtual bool InitSRGR(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Slant Range to Ground Range data sets : _srgr_update,_SrGr_R0,_SrGr_coeffs_number,_SrGr_coeffs,_nbCol, _pixel_spacing.
void set_noiseLevelValues(const std::vector< ossim_float64 > &value)
virtual std::ostream & print(std::ostream &out) const
ossimDrect theImageClipRect
PlatformPosition * _platformPosition
Handle the position of the platform.
if(yy_init)
bool getBeamModeMnemonic(const ossimXmlDocument *xdoc, ossimString &s) const
/product/sourceAttributes/beamModeMnemonic
virtual std::ostream & print(std::ostream &out) const
ossim_int32 y
Definition: ossimIpt.h:142
bool getSlantRangeNearEdge(const ossimXmlDocument *xdoc, ossimString &s) const
bool getProductType(const ossimXmlDocument *xdoc, ossimString &s) const
bool initImageSize(const ossimXmlDocument *xdoc, ossimIpt &imageSize) const
Method to initialize image size from RadarSat "product.xml" file.
double get_decimal() const
Definition: JSDDateTime.h:81
This class allows for direct localisation and indirect localisation using the RadarSat2 sensor model...
void setGroundRect(const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
const ossimDpt & ur() const
Definition: ossimDrect.h:340
bool initPlatformPosition(const ossimXmlDocument *xdoc, PlatformPosition *pos) const
Method to initialize PlatformPosition object from RadarSat "product.xml" file.
bool initSRGR(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
virtual void lineSampleToWorld(const ossimDpt &image_point, ossimGpt &gpt) const
double x
Definition: ossimDpt.h:164
ossimFilename dirCat(const ossimFilename &file) const
void set_units(const ossimString &value)
bool initRefPoint(const ossimXmlDocument *xdoc, const ossimRadarSat2ProductDoc &rsDoc)
Method to initialize RefPoint object from RadarSat "product.xml" file.
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
std::vector< double > _srgr_update
Slant Range FOR EACH Ground Range coefficient sets update times.
void set_nAzimuthLook(double look)
Definition: SensorParams.h:133
ossimString ext() const
ossim_int32 x
Definition: ossimIpt.h:141
virtual ~ossimRadarSat2Model()
Destructor.
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.
const ossimDpt & ll() const
Definition: ossimDrect.h:342
static ossimSupportFilesList * instance()
std::vector< std::vector< double > > _SrGr_coeffs
Slant Range FOR EACH Ground Range Projection coefficients.
void set_prf(double prf)
Definition: SensorParams.h:73
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
virtual ossimString getClassName() const
Method to return the class name.
bool hasNans() const
Definition: ossimIpt.h:58
void set_ephemeris(Ephemeris *ephemeris)
Definition: RefPoint.cpp:65
void set_col_direction(int dir)
Definition: SensorParams.h:123
bool setModelRefPoint(const std::list< ossimGpt > &groundGcpCoordinates, const std::list< ossimDpt > &imageGcpCoordinates)
Sets ossimSensorModel members theRefImgPt and theRefGndPt from tie points.
This class represents a date.
Definition: JSDDateTime.h:30
float distance(double lat1, double lon1, double lat2, double lon2, int units)
const ossimDpt & lr() const
Definition: ossimDrect.h:341
void set_distance(double distance)
Definition: RefPoint.cpp:75
void set_sf(double sf)
Definition: SensorParams.h:78
virtual bool InitRefNoiseLevel(const ossimXmlDocument *xmlDocument)
ossimFilename path() const
bool getImageId(const ossimXmlDocument *xdoc, ossimString &s) const
int toInt() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theMeanGSD
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void set_stepSize(const ossim_uint32 &value)