OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGeometricSarSensorModel.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 
13 
14 #include <otb/Ephemeris.h>
15 #include <otb/PlatformPosition.h>
16 #include <otb/SensorParams.h>
17 #include <otb/RefPoint.h>
18 #include <otb/SarSensor.h>
19 #include <ossim/base/ossimTrace.h>
23 #include <cmath>
24 #include <string>
25 
26 namespace ossimplugins
27 {
28 
29 
30  static const char PRODUCT_GEOREFERENCED_FLAG_KW[] = "product_georeferenced_flag";
31  static const char OPTIMIZATION_FACTOR_X_KW[] = "optimization_factor_x";
32  static const char OPTIMIZATION_FACTOR_Y_KW[] = "optimization_factor_y";
33  static const char OPTIMIZATION_BIAS_X_KW[] = "optimization_bias_x";
34  static const char OPTIMIZATION_BIAS_Y_KW[] = "optimization_bias_y";
35 
36  const char* ossimGeometricSarSensorModel::CREATE_OCG_PREF_KW = "geometric_sar_sensor_model.create_ocg";
37 
38  RTTI_DEF1(ossimGeometricSarSensorModel, "ossimGeometricSarSensorModel", ossimSensorModel);
39 
40  static ossimTrace traceDebug("ossimGeometricSarSensorModel:debug");
41 
43  :
45  _platformPosition(0),
46  _sensor(0),
47  _refPoint(0),
48  _sarSensor(0),
49  _isProductGeoreferenced(false),
50  _optimizationFactorX(0.0),
51  _optimizationFactorY(0.0),
52  _optimizationBiasX(0.0),
53  _optimizationBiasY(0.0)
54  {
55  }
56 
59  :
60  ossimSensorModel(rhs),
61  _platformPosition(rhs._platformPosition?rhs._platformPosition->Clone():(PlatformPosition*)0),
62  _sensor(rhs._sensor?rhs._sensor->Clone():(SensorParams*)0),
63  _refPoint(rhs._refPoint?rhs._refPoint->Clone():( RefPoint *)0),
64  _isProductGeoreferenced(rhs._isProductGeoreferenced),
65  _optimizationFactorX(rhs._optimizationFactorX),
66  _optimizationFactorY(rhs._optimizationFactorY),
67  _optimizationBiasX(rhs._optimizationBiasX),
68  _optimizationBiasY(rhs._optimizationBiasY),
69  _imageFilename(rhs._imageFilename),
70  _productXmlFile(rhs._productXmlFile)
71  {
73  }
74 
76  {
77  if (_platformPosition != 0)
78  {
79  delete _platformPosition;
81  }
82 
83  if(_sensor != 0)
84  {
85  delete _sensor;
86  _sensor = 0;
87  }
88 
89  if (_sarSensor != 0)
90  {
91  delete _sarSensor;
92  _sarSensor = 0;
93  }
94 
95  if(_refPoint != 0)
96  {
97  delete _refPoint;
98  _refPoint = 0;
99  }
100  }
101 
103  {
104  const double CLUM = 2.99792458e+8 ;
105 
106  double dist = _refPoint->get_distance()
107  + _sensor->get_col_direction() * (col - (_refPoint->get_pix_col())) * ((CLUM / 2.0) * _sensor->get_nRangeLook() / _sensor->get_sf()) ;
108 
109  return dist;
110  }
111 
113  {
114  double dt = _sensor->get_lin_direction() * (line - _refPoint->get_pix_line()) * _sensor->get_nAzimuthLook() / _sensor->get_prf() ;
116  time.set_second(time.get_second() + dt);
117  time.NormDate();
118 
119  return time;
120  }
121 
122  bool ossimGeometricSarSensorModel::getPlatformPositionAtLine(double line, vector<double>& position, vector<double>& speed)
123  {
124  JSDDateTime time = getTime(line);
125  return _platformPosition->getPlatformPositionAtTime(time,position,speed);
126  }
127 
129  const ossimDpt& image_point,
130  const double& heightEllipsoid,
131  ossimGpt& worldPoint) const
132  {
133 
134  if (!_sarSensor)
135  {
136  // bad design consequence, should be fixed.
138  }
139  double lon, lat;
140  // const double CLUM = 2.99792458e+8 ;
141 
142  // optimization
143  double col = image_point.x - (image_point.x * _optimizationFactorX + _optimizationBiasX) ;
144  double line = image_point.y - (image_point.y * _optimizationFactorY + _optimizationBiasY) ;
145 
146  JSDDateTime azimuthTime = getTime(line) ;
147 
148  // Slant range computation, depending on the product type
149  double slantRange;
151  {
152  slantRange = getSlantRangeFromGeoreferenced(col) ;
153  }
154  else
155  {
156  slantRange = getSlantRange(col) ;
157  }
158 
159  int etatLoc = _sarSensor->ImageToWorld(slantRange, azimuthTime, heightEllipsoid, lon, lat);
160 
161  if(traceDebug())
162  {
163  switch (etatLoc)
164  {
165  case 0:
166  ossimNotify(ossimNotifyLevel_DEBUG) << "successful call to lineSampleHeightToWorld" << std::endl;
167  break;
168  case 1:
169  ossimNotify(ossimNotifyLevel_DEBUG) << "lineSampleHeightToWorld : no real root to the equation belongs to the imaging ray" << std::endl;
170  break;
171  case 2:
172  ossimNotify(ossimNotifyLevel_DEBUG) << "lineSampleHeightToWorld : no real root to the equation" << std::endl;
173  break;
174  default :
175  ossimNotify(ossimNotifyLevel_DEBUG) << "lineSampleHeightToWorld : unknown error case" << std::endl;
176  break;
177  }
178  }
179 
180  worldPoint.lat = lat;
181  worldPoint.lon = lon;
182  worldPoint.hgt = heightEllipsoid ;
183  }
184 
188 
189  // optimization model update
191  }
192 
193  void ossimGeometricSarSensorModel::getGCPlist(std::list<ossimGpt> & groundCoordinates, std::list<ossimDpt> & imageCoordinates) {
194  groundCoordinates = _optimizationGCPsGroundCoordinates ;
195  imageCoordinates = _optimizationGCPsImageCoordinates ;
196  }
197 
198  bool ossimGeometricSarSensorModel::optimizeModel(const std::list<ossimGpt> & groundCoordinates, const std::list<ossimDpt> & imageCoordinates)
199  {
200  if (groundCoordinates.size() != imageCoordinates.size()) return false ;
201 
202  // no optimization is used during the GCP localization error computation
203  _optimizationFactorX = 0.0 ;
204  _optimizationFactorY = 0.0 ;
205  _optimizationBiasX = 0.0 ;
206  _optimizationBiasY = 0.0 ;
207 
208  // appends the user input GCPs to the GCPs already present
209  _optimizationGCPsGroundCoordinates.insert(_optimizationGCPsGroundCoordinates.end(), groundCoordinates.begin(), groundCoordinates.end()) ;
210  _optimizationGCPsImageCoordinates.insert(_optimizationGCPsImageCoordinates.end(), imageCoordinates.begin(), imageCoordinates.end()) ;
211 
212  // no GCP : no optimization
213  if (groundCoordinates.size() == 0) return true ;
214 
215  // Inverse projection of each Ground Control Point
216  std::list<ossimGpt>::iterator itGround = _optimizationGCPsGroundCoordinates.begin() ;
217  std::list<ossimDpt> inverseLocResults ;
218  while (itGround != _optimizationGCPsGroundCoordinates.end())
219  {
220  ossimDpt itLoc ;
221  this->worldToLineSample(*itGround,itLoc);
222  inverseLocResults.push_back(itLoc) ;
223  itGround++;
224  }
225 
226  // error computation
227  int nbPoints = _optimizationGCPsGroundCoordinates.size() ;
228  double xErrorMean = 0.0, yErrorMean = 0.0, xActualPow = 0.0, yActualPow = 0.0, xActualMean = 0.0, yActualMean = 0.0,
229  xErrorByActualMean = 0.0, yErrorByActualMean = 0.0 ;
230  double xLocalError, yLocalError ;
231 
232  std::list<ossimDpt>::iterator itActualCoords = _optimizationGCPsImageCoordinates.begin() ;
233  std::list<ossimDpt>::iterator itEstimatedCoords = inverseLocResults.begin() ;
234  while ((itActualCoords != _optimizationGCPsImageCoordinates.end())&&(itEstimatedCoords != inverseLocResults.end())) {
235  xLocalError = itActualCoords->x - itEstimatedCoords->x ;
236  yLocalError = itActualCoords->y - itEstimatedCoords->y ;
237 
238  xErrorMean += xLocalError ;
239  yErrorMean += yLocalError ;
240  xActualMean += itActualCoords->x ;
241  yActualMean += itActualCoords->y ;
242  xActualPow += itActualCoords->x * itActualCoords->x ;
243  yActualPow += itActualCoords->y * itActualCoords->y ;
244  xErrorByActualMean += xLocalError * itActualCoords->x ;
245  yErrorByActualMean += yLocalError * itActualCoords->y ;
246 
247  ++itActualCoords;
248  ++itEstimatedCoords;
249  }
250 
251  xErrorMean /= nbPoints ;
252  yErrorMean /= nbPoints ;
253  xActualMean /= nbPoints ;
254  yActualMean /= nbPoints ;
255  xActualPow /= nbPoints ;
256  yActualPow /= nbPoints ;
257  xErrorByActualMean /= nbPoints ;
258  yErrorByActualMean /= nbPoints ;
259 
260  // linear regression
261  if (fabs(xActualPow - xActualMean*xActualMean) > FLT_EPSILON)
262  _optimizationFactorX = (xErrorByActualMean - xErrorMean * xActualMean) / (xActualPow - xActualMean*xActualMean) ;
263  if (fabs(yActualPow - yActualMean*yActualMean) > FLT_EPSILON)
264  _optimizationFactorY = (yErrorByActualMean - yErrorMean * yActualMean) / (yActualPow - yActualMean*yActualMean) ;
265  _optimizationBiasX = xErrorMean - _optimizationFactorX * xActualMean ;
266  _optimizationBiasY = yErrorMean - _optimizationFactorY * yActualMean ;
267 
269  //double lineBias = 0.0, columnBias = 0.0 ;
270  //int nbPtsUsed = 0;
271 
272  //std::list<ossimDpt>::iterator itActualCoords = imageCoordinates.begin() ;
273  //std::list<ossimDpt>::iterator itEstimatedCoords = inverseLocResults.begin() ;
274  //while ((itActualCoords != imageCoordinates.end())&&(itEstimatedCoords != inverseLocResults.end())) {
275  //
276  // columnBias += (itActualCoords->x - itEstimatedCoords->x ) ;
277  // lineBias += (itActualCoords->y - itEstimatedCoords->y ) ;
278  //
279  // nbPtsUsed++;
280  // itActualCoords++;
281  // itEstimatedCoords++;
282  //}
283 
285  //lineBias /= nbPtsUsed ;
286  //columnBias /= nbPtsUsed ;
287 
289  //_refPoint->set_pix_col(_refPoint->get_pix_col() - columnBias);
290  //_refPoint->set_pix_line(_refPoint->get_pix_line() - lineBias);
291 
292  return true ;
293  }
294 
296  const char* prefix) const
297 
298  {
299  static const char MODULE[] = "ossimGeometricSarSensorModel::saveState";
300 
301  bool result = false;
302 
303  if (traceDebug())
304  {
305  ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
306  }
307 
309  {
310  if ( _platformPosition->saveState(kwl, prefix) )
311  {
312  if ( _sensor->saveState(kwl, prefix) )
313  {
314  result = _refPoint->saveState(kwl, prefix);
315 
316  if (result)
317  {
318  kwl.add(prefix,
319  PRODUCT_GEOREFERENCED_FLAG_KW,
320  (_isProductGeoreferenced?"true":"false"));
321  kwl.add(prefix,
322  OPTIMIZATION_FACTOR_X_KW,
324  kwl.add(prefix,
325  OPTIMIZATION_FACTOR_Y_KW,
327  kwl.add(prefix,
328  OPTIMIZATION_BIAS_X_KW,
330  kwl.add(prefix,
331  OPTIMIZATION_BIAS_Y_KW,
333 
334  result = ossimSensorModel::saveState(kwl, prefix);
335  }
336  }
337  }
338  }
339 
340  if (traceDebug())
341  {
343  << MODULE << " exit status = " << (result?"true":"false\n")
344  << std::endl;
345  }
346 
347  return result;
348  }
349 
351  const char *prefix)
352  {
353  static const char MODULE[] = "ossimGeometricSarSensorModel::loadState";
354 
355  if (traceDebug())
356  {
357  ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
358  }
359 
360  bool result = true;
361 
362  // Load the base class;
363  if ( ossimSensorModel::loadState(kwl, prefix) == false )
364  {
365  if (traceDebug())
366  {
368  << MODULE
369  << "\nossimSensorModel::loadState failed!\n";
370  }
371  result = false;
372  }
373 
374  // Load the platform position state.
375  if ( !_platformPosition)
376  {
378  }
379  if ( _platformPosition->loadState(kwl, prefix) == false )
380  {
381  if (traceDebug())
382  {
384  << MODULE
385  << "\n_platformPosition->loadState failed!\n";
386  }
387  result = false;
388  }
389 
390  // Load the sensor position state.
391  if ( !_sensor)
392  {
393  _sensor = new SensorParams();
394  }
395  if ( _sensor->loadState(kwl, prefix) == false )
396  {
397  if (traceDebug())
398  {
400  << MODULE
401  << "\n_sensor->loadState failed!\n";
402  }
403  result = false;
404  }
405 
407 
408  // Load the ref point.
409  if ( !_refPoint)
410  {
411  _refPoint = new RefPoint();
412  }
413  if ( _refPoint->loadState(kwl, prefix) == false )
414  {
415  if (traceDebug())
416  {
418  << MODULE
419  << "\n_refPoint->loadState failed!\n";
420  }
421  result = false;
422  }
423 
424  const char* lookup = 0;
425  ossimString s;
426 
427  lookup = kwl.find(prefix, PRODUCT_GEOREFERENCED_FLAG_KW);
428  if (lookup)
429  {
430  s = lookup;
432  }
433  else
434  {
435  if (traceDebug())
436  {
438  << MODULE
439  << "\nRequired keyword not found: "
440  << PRODUCT_GEOREFERENCED_FLAG_KW << "\n";
441  }
442  result = false;
443  }
444 
445  lookup = kwl.find(prefix, OPTIMIZATION_FACTOR_X_KW);
446  if (lookup)
447  {
448  s = lookup;
450  }
451  else
452  {
453  if (traceDebug())
454  {
456  << MODULE
457  << "\nRequired keyword not found: "
458  << OPTIMIZATION_FACTOR_X_KW << "\n";
459  }
460  result = false;
461  }
462 
463  lookup = kwl.find(prefix, OPTIMIZATION_FACTOR_Y_KW);
464  if (lookup)
465  {
466  s = lookup;
468  }
469  else
470  {
471  if (traceDebug())
472  {
474  << MODULE
475  << "\nRequired keyword not found: "
476  << OPTIMIZATION_FACTOR_Y_KW << "\n";
477  }
478  result = false;
479  }
480 
481  lookup = kwl.find(prefix,OPTIMIZATION_BIAS_X_KW);
482  if (lookup)
483  {
484  s = lookup;
486  }
487  else
488  {
489  if (traceDebug())
490  {
492  << MODULE
493  << "\nRequired keyword not found: "
494  << OPTIMIZATION_BIAS_X_KW << "\n";
495  }
496  result = false;
497  }
498 
499  lookup = kwl.find(prefix,OPTIMIZATION_BIAS_Y_KW);
500  if (lookup)
501  {
502  s = lookup;
504  }
505  else
506  {
507  if (traceDebug())
508  {
510  << MODULE
511  << "\nRequired keyword not found: "
512  << OPTIMIZATION_BIAS_X_KW << "\n";
513  }
514  result = false;
515  }
516 
517  // if (result && traceDebug())
518 // if (result)
519 // {
520 // ossimNotify(ossimNotifyLevel_DEBUG)
521 // << "calling saveState to verify loadState..." << endl;
522 
523 // ossimKeywordlist kwl2;
524 // saveState(kwl2, 0);
525 
526 // ossimNotify(ossimNotifyLevel_DEBUG)
527 // << "saveState result after loadState:" << kwl2 << endl;
528 // }
529 
530  if (traceDebug())
531  {
533  << MODULE << " exit status = " << (result?"true":"false\n")
534  << std::endl;
535  }
536 
537  return result;
538  }
539 
540 #if 0
541  if(!InitSRGR(kwl, prefix))
542  {
543  return false;
544  }
545  if(!InitPlatformPosition(kwl, prefix))
546  {
547  return false;
548  }
549  if(!InitSensorParams(kwl, prefix))
550  {
551  return false;
552  }
553  if(!InitRefPoint(kwl, prefix))
554  {
555  return false;
556  }
557  return true;
558 }
559 #endif
560 
562 {
563  out << setprecision(15) << setiosflags(ios::fixed)
564  << "\nossimGeometricSarSensorModel class data members:\n";
565 
566  const char* prefix = 0;
567  ossimKeywordlist kwl;
568  if (_platformPosition)
569  {
570  _platformPosition->saveState(kwl, prefix);
571  }
572  if (_sensor)
573  {
574  _sensor->saveState(kwl, prefix);
575  }
576  if (_refPoint)
577  {
578  _refPoint->saveState(kwl, prefix);
579  }
580 
581  kwl.add(prefix,
582  PRODUCT_GEOREFERENCED_FLAG_KW,
583  (_isProductGeoreferenced?"true":"false"));
584  kwl.add(prefix,
585  OPTIMIZATION_FACTOR_X_KW,
586  _optimizationFactorX);
587  kwl.add(prefix,
588  OPTIMIZATION_FACTOR_Y_KW,
589  _optimizationFactorY);
590  kwl.add(prefix,
591  OPTIMIZATION_BIAS_X_KW,
592  _optimizationBiasX);
593  kwl.add(prefix,
594  OPTIMIZATION_BIAS_Y_KW,
595  _optimizationBiasY);
596 
597  out << kwl;
598 
599  return ossimSensorModel::print(out);
600 }
601 
602 //*************************************************************************************************
603 // Creates replacement coarse grid model if user requested via ossim preferences keyword.
604 // Returns true if load OK, false on error
605 //*************************************************************************************************
606 bool ossimGeometricSarSensorModel::createReplacementOCG()
607 {
608  // Read the preferences to determine if we need to do this:
609  ossimString str (ossimPreferences::instance()->findPreference(CREATE_OCG_PREF_KW));
610  if (!str.toBool())
611  return true; // this is not an error condition
612 
613  // Compute the coarse grid:
614  _replacementOcgModel = new ossimCoarseGridModel;
615  _replacementOcgModel->setInterpolationError(0.1);
616  _replacementOcgModel->setMinGridSpacing(50);
617 
618  if (traceDebug())
619  {
620  ossimNotify(ossimNotifyLevel_NOTICE)<<"\nComputing coarse grid..."<<endl;
621  }
622  _replacementOcgModel->buildGrid(theImageClipRect, this, 500.00, true, false);
623 
624  // Save the coarse grid to appropriate location given image filename:
625  bool status = _replacementOcgModel->saveCoarseGrid(_imageFilename); // this saves geom file as well
626 
627  return status;
628 }
629 
630 //*****************************************************************************
631 // METHOD: ossimGeometricSarSensorModel::lineSampleToWorld(image_pt, &gpt)
632 //
633 // Intersects the ray associated with image_pt with the available elevation
634 // model. Returns ground point
635 //
636 //*****************************************************************************
637 void ossimGeometricSarSensorModel::lineSampleToWorld(const ossimDpt& image_point,
638  ossimGpt& gpt) const
639 {
640  bool debug = false; // setable via interactive debugger
641  if (traceDebug() || debug) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimSensorModel::lineSampleToWorld:entering..." << std::endl;
642 
643  if(image_point.hasNans())
644  {
645  gpt.makeNan();
646  return;
647  }
648  //***
649  // Extrapolate if image point is outside image:
650  //***
651  if (!insideImage(image_point)&&(!theExtrapolateImageFlag))
652  {
653  gpt = extrapolate(image_point);
654  return;
655  }
656 
657  //***
658  // Determine imaging ray and invoke elevation source object's services to
659  // intersect ray with terrain model:
660  //***
661  // ossimEcefRay ray; In the case of SAR sensors, ray intersection does not have meaning anymore...
662  // imagingRay(image_point, ray);
663  // ossimElevManager::instance()->intersectRay(ray, gpt);
664 
665  static const double LON_LAT_THRESHOLD = .00001; // acceptable lon lat error (degrees)
666  static const int MAX_NUM_ITERATIONS = 30;
667  static const double LON_LAT_STEP = .00001;
668  int iters = 0;
669 
670  //
671  // Utilize iterative scheme for arriving at ground point. Begin with guess
672  // at RefGndPt:
673  //
674  gpt.lond(theRefGndPt.lond());
675  gpt.latd(theRefGndPt.latd());
676  gpt.height(ossimElevManager::instance()->getHeightAboveEllipsoid(gpt));
677 
678  ossimGpt gpt_dlat;
679  ossimGpt gpt_dlon;
680 
681  ossimDpt ip, ip_dlat, ip_dlon;
682  double du_dlat, du_dlon, dv_dlat, dv_dlon;
683  double delta_lat, delta_lon, delta_u, delta_v;
684  double inverse_norm;
685  bool done = false;
686 
687  //***
688  // Begin iterations:
689  //***
690  do
691  {
692  //***
693  // establish perturbed ground points about the guessed point:
694  //***
695  gpt_dlat.latd(gpt.latd() + LON_LAT_STEP);
696  gpt_dlat.lond(gpt.lond());
697  gpt_dlat.height(ossimElevManager::instance()->getHeightAboveEllipsoid(gpt_dlat));
698  gpt_dlon.latd(gpt.latd());
699  gpt_dlon.lond(gpt.lond() + LON_LAT_STEP);
700  gpt_dlon.height(ossimElevManager::instance()->getHeightAboveEllipsoid(gpt_dlon));
701 
702  //***
703  // Compute numerical partials at current guessed point:
704  //***
705  worldToLineSample(gpt, ip);
706  worldToLineSample(gpt_dlat, ip_dlat);
707  worldToLineSample(gpt_dlon, ip_dlon);
708 
709  if(ip.hasNans() || ip_dlat.hasNans() || ip_dlon.hasNans())
710  {
711  gpt.makeNan();
712  return;
713  }
714 
715  du_dlat = (ip_dlat.u - ip.u) / LON_LAT_STEP;
716  du_dlon = (ip_dlon.u - ip.u) / LON_LAT_STEP;
717  dv_dlat = (ip_dlat.v - ip.v) / LON_LAT_STEP;
718  dv_dlon = (ip_dlon.v - ip.v) / LON_LAT_STEP;
719 
720  //
721  // Test for convergence:
722  //
723  delta_u = image_point.u - ip.u;
724  delta_v = image_point.v - ip.v;
725 
726  //
727  // Compute linearized estimate of ground point given ip delta:
728  //
729  inverse_norm = du_dlon*dv_dlat - dv_dlon*du_dlat; // fg-eh
730 
731  if (!ossim::almostEqual(inverse_norm, 0.0, DBL_EPSILON))
732  {
733  delta_lon = (delta_u*dv_dlat - delta_v*du_dlat)/inverse_norm;
734  delta_lat = (delta_v*du_dlon - delta_u*dv_dlon)/inverse_norm;
735  gpt.latd(gpt.latd() + delta_lat);
736  gpt.lond(gpt.lond() + delta_lon);
737  gpt.height(ossimElevManager::instance()->getHeightAboveEllipsoid(gpt));
738  }
739  else
740  {
741  delta_lon = 0;
742  delta_lat = 0;
743  }
744  done = ((fabs(delta_lon) < LON_LAT_THRESHOLD) && (fabs(delta_lat) < LON_LAT_THRESHOLD));
745  iters++;
746  } while ((!done) && (iters < MAX_NUM_ITERATIONS));
747 
748  if (traceDebug() || debug)
749  {
750  ossimNotify(ossimNotifyLevel_DEBUG) << "image_point = " << image_point << std::endl;
751  // ossimNotify(ossimNotifyLevel_DEBUG) << "ray = " << ray << std::endl;
752  ossimNotify(ossimNotifyLevel_DEBUG) << "gpt = " << gpt << std::endl;
753  }
754 
755  if (traceDebug() || debug) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG ossimSensorModel::lineSampleToWorld: returning..." << std::endl;
756  return;
757 }
758 
759 
760 void ossimGeometricSarSensorModel::set_platformPosition(PlatformPosition* platformPosition)
761 {
762  if(_platformPosition != 0)
763  {
764  delete _platformPosition;
765  _platformPosition = 0;
766  }
767  _platformPosition = platformPosition->Clone();
768 }
769 
770 void ossimGeometricSarSensorModel::set_sensorParams(SensorParams* sensorParams)
771 {
772  if(_sensor != 0)
773  {
774  delete _sensor;
775  _sensor = 0;
776  }
777  _sensor = sensorParams->Clone();
778 }
779 
780 void ossimGeometricSarSensorModel::set_refPoint(RefPoint* refPoint)
781 {
782  if(_refPoint != 0)
783  {
784  delete _refPoint;
785  _refPoint = 0;
786  }
787  _refPoint = refPoint->Clone();
788 }
789 
790 
791 PlatformPosition* ossimGeometricSarSensorModel::get_platformPosition() const
792 {
793  return _platformPosition;
794 }
795 
796 
797 SensorParams* ossimGeometricSarSensorModel::get_sensorParams() const
798 {
799  return _sensor;
800 }
801 
802 
803 RefPoint* ossimGeometricSarSensorModel::get_refPoint() const
804 {
805  return _refPoint;
806 }
807 
808 
809 
810 }
std::list< ossimGpt > _optimizationGCPsGroundCoordinates
List Ground Control Points used by the optimization.
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
This function is able to convert image coordinates into world coordinates the geometric model of SAR ...
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
Definition: RefPoint.cpp:110
double lond() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:97
This class handles the platform position.
RefPoint * Clone()
Definition: RefPoint.h:59
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
RTTI_DEF1(ossimAlosPalsarModel, "ossimAlosPalsarModel", ossimGeometricSarSensorModel)
Represents serializable keyword/value map.
double u
Definition: ossimDpt.h:164
Ephemeris * get_ephemeris()
Definition: RefPoint.cpp:90
const char * find(const char *key) const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
Definition: ossimCommon.h:53
double y
Definition: ossimDpt.h:165
This class handles the referential point.
Definition: RefPoint.h:29
double get_distance() const
Definition: RefPoint.cpp:95
virtual int ImageToWorld(double distance, JSDDateTime time, double height, double &lon, double &lat) const
This function is able to convert image coordinates into geodetic world coordinates using a geometric ...
Definition: SarSensor.cpp:37
void makeNan()
Definition: ossimGpt.h:130
virtual bool getPlatformPositionAtLine(double line, vector< double > &position, vector< double > &speed)
This function associates an image line number to a platform position and speed.
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
double get_nRangeLook() const
Definition: SensorParams.h:118
static ossimElevManager * instance()
METHOD: instance() Implements singelton pattern.
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
This class handles the sensor parameters.
Definition: SensorParams.h:29
virtual void clearGCPlist()
Clears _optimizationGCPsGroundCoordinates and _optimizationGCPsImageCoordinates attributes Updates th...
This class provides basic location services for SAR sensors.
Definition: SarSensor.h:31
virtual JSDDateTime getTime(double line) const
This function associates an image line number to an azimuth time.
double latd() const
Will convert the radian measure to degrees.
Definition: ossimGpt.h:87
bool _isProductGeoreferenced
True iff the product is ground range.
This class allows for direct localisation and indirect localisation using the geometric model of SAR ...
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
Definition: RefPoint.cpp:137
void set_second(double second)
Definition: JSDDateTime.h:91
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
double get_nAzimuthLook() const
Definition: SensorParams.h:113
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
ossim_float64 lon
Definition: ossimGpt.h:266
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
#define FLT_EPSILON
static void setInterpolationError(double error=.1)
This is used when building a grid from a projector.
bool toBool() const
String to numeric methods.
PlatformPosition * Clone() const
virtual void getGCPlist(std::list< ossimGpt > &groundCoordinates, std::list< ossimDpt > &imageCoordinates)
Returns _optimizationGCPsGroundCoordinates and _optimizationGCPsImageCoordinates attributes.
double height() const
Definition: ossimGpt.h:107
double toDouble() const
double get_second() const
Definition: JSDDateTime.h:76
double get_pix_col() const
Definition: RefPoint.cpp:105
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual std::ostream & print(std::ostream &out) const
#define DBL_EPSILON
virtual SensorParams * Clone()
Definition: SensorParams.h:98
bool hasNans() const
Definition: ossimDpt.h:67
static ossimPreferences * instance()
double get_pix_line() const
Definition: RefPoint.cpp:100
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
return status
virtual void worldToLineSample(const ossimGpt &world_point, ossimDpt &image_point) const
PlatformPosition * _platformPosition
Handle the position of the platform.
JSDDateTime get_date() const
Definition: Ephemeris.h:63
virtual double getSlantRangeFromGeoreferenced(double col) const =0
This function associates an image column number to a slant range when the image is georeferenced (gro...
double _optimizationFactorX
Optimization result : linear error correction in both dimensions.
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
double x
Definition: ossimDpt.h:164
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.
ossim_float64 lat
Definition: ossimGpt.h:265
bool getPlatformPositionAtTime(JSDDateTime time, std::vector< double > &position, std::vector< double > &speed)
This function interpolates its ephemeris to create and extract platform&#39;s position and speed...
This class represents a date.
Definition: JSDDateTime.h:30
virtual double getSlantRange(double col) const
This function associates an image column number to a slant range.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
double v
Definition: ossimDpt.h:165