OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
ossimplugins::ossimRadarSatModel Class Reference

This class is able to direct localisation and indirect localisation using the RadarSat sensor model. More...

#include <ossimRadarSatModel.h>

Inheritance diagram for ossimplugins::ossimRadarSatModel:
ossimplugins::ossimGeometricSarSensorModel ossimSensorModel ossimProjection ossimOptimizableProjection ossimAdjustableParameterInterface ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimRadarSatModel ()
 Constructor. More...
 
 ossimRadarSatModel (const ossimRadarSatModel &rhs)
 copy constructor More...
 
virtual ~ossimRadarSatModel ()
 Destructor. More...
 
virtual ossimString getClassName () const
 Method to return the class name. More...
 
virtual ossimObjectdup () const
 Returns pointer to a new instance, copy of this. More...
 
virtual double getSlantRangeFromGeoreferenced (double col) const
 This function associates an image column number to a slant range when the image is georeferenced (ground projected) More...
 
bool open (const ossimFilename &file)
 Method to intantial model from a file. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save object state to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of the object from a keyword list. More...
 
- Public Member Functions inherited from ossimplugins::ossimGeometricSarSensorModel
 ossimGeometricSarSensorModel ()
 default constructor More...
 
 ossimGeometricSarSensorModel (const ossimGeometricSarSensorModel &rhs)
 copy constructor More...
 
virtual ~ossimGeometricSarSensorModel ()
 Destructor. More...
 
virtual double getSlantRange (double col) const
 This function associates an image column number to a slant range. More...
 
virtual JSDDateTime getTime (double line) const
 This function associates an image line number to an azimuth time. More...
 
virtual bool getPlatformPositionAtLine (double line, vector< double > &position, vector< double > &speed)
 This function associates an image line number to a platform position and speed. More...
 
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 sensors. More...
 
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. More...
 
virtual void clearGCPlist ()
 Clears _optimizationGCPsGroundCoordinates and _optimizationGCPsImageCoordinates attributes Updates the optimisation factors and bias. More...
 
virtual void getGCPlist (std::list< ossimGpt > &groundCoordinates, std::list< ossimDpt > &imageCoordinates)
 Returns _optimizationGCPsGroundCoordinates and _optimizationGCPsImageCoordinates attributes. More...
 
virtual bool useForward () const
 
virtual std::ostream & print (std::ostream &out) const
 
double get_optimizationFactorX () const
 Accessors to the optimization parameters. More...
 
double get_optimizationFactorY () const
 
double get_optimizationBiasX () const
 
double get_optimizationBiasY () const
 
ossimRefPtr< ossimCoarseGridModelgetReplacementOcgModel ()
 
virtual void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &gpt) const
 
void set_platformPosition (PlatformPosition *platformPosition)
 Accessors to the plateform, sensor parameters and reference point. More...
 
void set_sensorParams (SensorParams *sensorParams)
 
void set_refPoint (RefPoint *refPoint)
 
PlatformPositionget_platformPosition () const
 
SensorParamsget_sensorParams () const
 
RefPointget_refPoint () const
 
- Public Member Functions inherited from ossimSensorModel
 ossimSensorModel ()
 
 ossimSensorModel (const ossimSensorModel &copy_this)
 
 ossimSensorModel (const ossimKeywordlist &geom_kwl)
 
const ossimSensorModeloperator= (const ossimSensorModel &rhs)
 assignment operator More...
 
virtual ossimObjectgetBaseObject ()
 
virtual const ossimObjectgetBaseObject () const
 
virtual ossimGpt origin () const
 
virtual ossimDpt getMetersPerPixel () const
 
virtual const double & getNominalPosError () const
 Returns the estimated Absolute horizontal position error (CE90) of the sensor model. More...
 
virtual const double & getRelativePosError () const
 Returns the estimated RELATIVE horizontal position error (CE90) of the sensor model. More...
 
virtual void setNominalPosError (const double &ce90)
 Assigns the absolute image position error uncertainty (abs CE90) More...
 
virtual void setRelativePosError (const double &ce90)
 Assigns the relative image position error uncertainty (rel CE90) More...
 
virtual void worldToLineSample (const ossimGpt &world_point, ossimDpt &image_point) const
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 
void setRefImgPt (const ossimDpt &pt)
 Sets the center line sampe of the image. More...
 
void setRefGndPt (const ossimGpt &pt)
 Sets the center latitude, longitude, height of the image. More...
 
void setImageRect (const ossimDrect &imageRect)
 
void setGroundRect (const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
 
ossimDpt imageSize () const
 
void setImageSize (const ossimDpt &size)
 
virtual void adjustableParametersChanged ()
 
virtual void updateModel ()
 
virtual bool insideImage (const ossimDpt &p) const
 
virtual bool operator== (const ossimProjection &proj) const
 
const ossimStringgetImageID () const
 Access methods: More...
 
const ossimDrectgetImageClipRect () const
 
virtual ossim_uint32 degreesOfFreedom () const
 
virtual bool needsInitialState () const
 needsInitialState() More...
 
virtual double optimizeFit (const ossimTieGptSet &tieSet, double *targetVariance=0)
 
virtual ossimDpt getForwardDeriv (int parmIdx, const ossimGpt &gpos, double hdelta=1e-11)
 
virtual ossimGpt getInverseDeriv (int parmIdx, const ossimDpt &ipos, double hdelta=1e-11)
 
virtual ossimSensorModel::CovMatStatus getObsCovMat (const ossimDpt &ipos, NEWMAT::SymmetricMatrix &Cov, const ossim_float64 defPointingSigma=0.5) const
 Gives 2X2 covariance matrix of observations. More...
 
virtual bool isAffectedByElevation () const
 Implementation of pure virtual ossimProjection::isAffectedByElevation method. More...
 
void computeGsd ()
 This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD by doing a lineSampleHeightToWorld on four points and calculating the distance from them. More...
 
virtual bool getImageGeometry (const ossimString &, const ossimString &, ossimKeywordlist &) const
 Extracts geometry info from a non-ossim key,value pair to an ossim keyword list. More...
 
- Public Member Functions inherited from ossimProjection
 ossimProjection ()
 
virtual ~ossimProjection ()
 
virtual ossimDpt forward (const ossimGpt &wp) const
 
virtual ossimGpt inverse (const ossimDpt &pp) const
 
virtual void getRoundTripError (const ossimDpt &imagePoint, ossimDpt &errorResult) const
 
virtual void getRoundTripError (const ossimGpt &groundPoint, ossimDpt &errorResult) const
 
virtual void getGroundClipPoints (ossimGeoPolygon &gpts) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual bool operator!= (const ossimProjection &projection) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimOptimizableProjection
 ossimOptimizableProjection ()
 
 ossimOptimizableProjection (const ossimOptimizableProjection &source)
 
virtual ~ossimOptimizableProjection ()
 
virtual ossimOptimizableProjectionoperator= (const ossimOptimizableProjection &source)
 
virtual bool setupOptimizer (const ossimString &setup)
 setupFromString() Derived classes should implement as needed. Initialize parameters needed for optimizeFit and degreesOfFreedom More...
 
- Public Member Functions inherited from ossimAdjustableParameterInterface
 ossimAdjustableParameterInterface ()
 
 ossimAdjustableParameterInterface (const ossimAdjustableParameterInterface &rhs)
 
virtual ~ossimAdjustableParameterInterface ()
 
void newAdjustment (ossim_uint32 numberOfParameters=0)
 
void setAdjustmentDescription (const ossimString &description)
 
ossimString getAdjustmentDescription () const
 
ossimString getAdjustmentDescription (ossim_uint32 adjustmentIdx) const
 Returns adjustmentDescription of specific adjustmentInfo. More...
 
void setCurrentAdjustment (ossim_uint32 adjustmentIndex, bool notify=false)
 
bool setCurrentAdjustment (const ossimString &description, bool notify=false)
 Sets the current adjustment to the adjustment with a matching description. More...
 
void eraseAdjustment (bool notify)
 
void eraseAdjustment (ossim_uint32 idx, bool notify)
 
virtual void initAdjustableParameters ()
 
void resetAdjustableParameters (bool notify=false)
 
void copyAdjustment (ossim_uint32 idx, bool notify)
 
void copyAdjustment (bool notify=false)
 
void keepAdjustment (ossim_uint32 idx, bool createCopy)
 
virtual void keepAdjustment (bool createCopy=true)
 
const ossimAdjustableParameterInterfaceoperator= (const ossimAdjustableParameterInterface &rhs)
 
void removeAllAdjustments ()
 
ossim_uint32 getNumberOfAdjustableParameters () const
 
double getAdjustableParameter (ossim_uint32 idx) const
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, bool notify=false)
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, double sigma, bool notify=false)
 
double getParameterSigma (ossim_uint32 idx) const
 
void setParameterSigma (ossim_uint32 idx, double value, bool notify=false)
 
ossimUnitType getParameterUnit (ossim_uint32 idx) const
 
void setParameterUnit (ossim_uint32 idx, ossimUnitType unit)
 
void setParameterUnit (ossim_uint32 idx, const ossimString &unit)
 
void setParameterCenter (ossim_uint32 idx, double center, bool notify=false)
 
double getParameterCenter (ossim_uint32 idx) const
 
double computeParameterOffset (ossim_uint32 idx) const
 
void setParameterOffset (ossim_uint32 idx, ossim_float64 value, bool notify=false)
 
ossimString getParameterDescription (ossim_uint32 idx) const
 
void setParameterDescription (ossim_uint32 idx, const ossimString &descrption)
 
ossim_int32 findParameterIdxGivenDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
ossim_int32 findParameterIdxContainingDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
bool isParameterLocked (ossim_uint32 idx) const
 
void setParameterLockFlag (ossim_uint32 idxParam, bool flag)
 
bool getParameterLockFlag (ossim_uint32 idx) const
 
void lockAllParametersCurrentAdjustment ()
 
void unlockAllParametersCurrentAdjustment ()
 
void lockAllParameters (ossim_uint32 idxAdjustment)
 
void unlockAllParameters (ossim_uint32 idxAdjustment)
 
void resizeAdjustableParameterArray (ossim_uint32 numberOfParameters)
 
void setAdjustment (const ossimAdjustmentInfo &adj, bool notify=false)
 
void setAdjustment (ossim_uint32 idx, const ossimAdjustmentInfo &adj, bool notify=false)
 
void addAdjustment (const ossimAdjustmentInfo &adj, bool notify)
 
void getAdjustment (ossimAdjustmentInfo &adj) const
 
void getAdjustment (ossim_uint32 idx, ossimAdjustmentInfo &adj) const
 
ossim_uint32 getNumberOfAdjustments () const
 
ossim_uint32 getCurrentAdjustmentIdx () const
 
void setDirtyFlag (bool flag=true)
 
void setAllDirtyFlag (bool flag=true)
 
bool hasDirtyAdjustments () const
 
virtual void saveCurrentAdjustmentOnly (ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 Saves the current active adjustment to the KWL file. More...
 
bool saveAdjustments (ossimKeywordlist &kwl, const ossimString &prefix=ossimString("")) const
 Save all adjustments to the KWL file. More...
 
bool loadAdjustments (const ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 
std::ostream & print (std::ostream &out) const
 Dumps the currently active adjustment to ostream. More...
 

Protected Attributes

int _n_srgr
 Slant Range for each Ground Range (SRGR) number of coefficients sets. More...
 
double _srgr_coefset [20][6]
 SRGR coefficient sets. More...
 
double _srgr_update [20]
 SRGR coefficient sets update times. More...
 
double _pixel_spacing
 Pixel spacing. More...
 
Data_data
 List of metadata contained in the Data file. More...
 
Leader_leader
 List of metadata contained in the Leader file. More...
 
Trailer_trailer
 List of metadata contained in the Trailer file. More...
 
VolumeDir_volumeDir
 List of metadata contained in the Volume Directory file. More...
 
- Protected Attributes inherited from ossimplugins::ossimGeometricSarSensorModel
PlatformPosition_platformPosition
 Handle the position of the platform. More...
 
SensorParams_sensor
 
RefPoint_refPoint
 
SarSensor_sarSensor
 
bool _isProductGeoreferenced
 True iff the product is ground range. More...
 
std::list< ossimGpt_optimizationGCPsGroundCoordinates
 List Ground Control Points used by the optimization. More...
 
std::list< ossimDpt_optimizationGCPsImageCoordinates
 
double _optimizationFactorX
 Optimization result : linear error correction in both dimensions. More...
 
double _optimizationFactorY
 
double _optimizationBiasX
 
double _optimizationBiasY
 
ossimFilename _imageFilename
 
ossimFilename _productXmlFile
 
ossimRefPtr< ossimCoarseGridModel_replacementOcgModel
 
- Protected Attributes inherited from ossimSensorModel
ossimIpt theImageSize
 
ossimDpt theSubImageOffset
 
ossimString theImageID
 
ossimString theSensorID
 
ossimDpt theGSD
 
ossim_float64 theMeanGSD
 
ossimGpt theRefGndPt
 
ossimDpt theRefImgPt
 
ossimPolygon theBoundGndPolygon
 
ossimDrect theImageClipRect
 
ossim_float64 theRelPosError
 
ossim_float64 theNominalPosError
 
ossimDpt theParWRTx
 Partials for current point. More...
 
ossimDpt theParWRTy
 
ossimDpt theParWRTz
 
ossimDpt theObs
 Observations & residuals for current point. More...
 
ossimDpt theResid
 
ossimRefPtr< ossimProjectiontheSeedFunction
 Used as an initial guess for iterative solutions and a guess for points outside the support bounds. More...
 
bool theExtrapolateImageFlag
 
bool theExtrapolateGroundFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Private Member Functions

virtual bool InitPlatformPosition (const ossimKeywordlist &kwl, const char *prefix)
 Initializes the Platform Position from a projection keywordlist. More...
 
virtual bool InitSensorParams (const ossimKeywordlist &kwl, const char *prefix)
 Initializes the Sensor Params from a projection keywordlist. More...
 
virtual bool InitRefPoint (const ossimKeywordlist &kwl, const char *prefix)
 Initializes the Reference Point from a projection keywordlist. More...
 
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. More...
 
virtual bool internalSaveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save object state to a keyword list. More...
 
virtual bool internalLoadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of the object from a keyword list. More...
 
int FindSRGRSetNumber (JSDDateTime date) const
 Finds the SRGR data set which update time is the closest to the center scene time. More...
 

Additional Inherited Members

- Public Types inherited from ossimSensorModel
enum  CovMatStatus { COV_INVALID = 0, COV_PARTIAL = 1, COV_FULL = 2 }
 
enum  DeriveMode {
  OBS_INIT =-99, EVALUATE =-98, P_WRT_X = -1, P_WRT_Y = -2,
  P_WRT_Z = -3
}
 
- Static Public Member Functions inherited from ossimSensorModel
static void writeGeomTemplate (ostream &os)
 
- Static Public Attributes inherited from ossimplugins::ossimGeometricSarSensorModel
static const char * CREATE_OCG_PREF_KW = "geometric_sar_sensor_model.create_ocg"
 
- Protected Member Functions inherited from ossimplugins::ossimGeometricSarSensorModel
bool createReplacementOCG ()
 Creates replacement coarse grid model if user requested via ossim preferences keyword "geometric_sar_sensor_model.create_ocg: <bool>". More...
 
- Protected Member Functions inherited from ossimSensorModel
virtual ~ossimSensorModel ()
 
virtual ossimDpt extrapolate (const ossimGpt &gp) const
 
virtual ossimGpt extrapolate (const ossimDpt &ip, const double &height=ossim::nan()) const
 
void buildNormalEquation (const ossimTieGptSet &tieSet, NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &residue, NEWMAT::ColumnVector &projResidue, double pstep_scale)
 
NEWMAT::ColumnVector getResidue (const ossimTieGptSet &tieSet)
 
NEWMAT::ColumnVector solveLeastSquares (NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &r) const
 
NEWMAT::Matrix invert (const NEWMAT::Matrix &m) const
 stable invert stolen from ossimRpcSolver More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimAdjustableParameterInterface
bool paramChanged (ossim_uint32 param_idx) const
 Returns true if specified parameter has been modified since last setAllChangeFlag(false) call. More...
 
void setAllChangeFlags (bool areChanged)
 Sets all the change flags to the boolean indicated to indicate parameters are changed (TRUE) or not (FALSE). More...
 
void initChangeFlags ()
 Initializes the change flags to TRUE. More...
 

Detailed Description

This class is able to direct localisation and indirect localisation using the RadarSat sensor model.

Definition at line 40 of file ossimRadarSatModel.h.

Constructor & Destructor Documentation

◆ ossimRadarSatModel() [1/2]

ossimplugins::ossimRadarSatModel::ossimRadarSatModel ( )

Constructor.

Definition at line 48 of file ossimRadarSatModel.cpp.

Referenced by dup().

48  :
50  _n_srgr(0),
51  _pixel_spacing(0),
52  _data(NULL),
53  _leader(NULL),
54  _trailer(NULL),
55  _volumeDir(NULL)
56 {
57 }
double _pixel_spacing
Pixel spacing.
Trailer * _trailer
List of metadata contained in the Trailer file.
Data * _data
List of metadata contained in the Data file.
VolumeDir * _volumeDir
List of metadata contained in the Volume Directory file.
Leader * _leader
List of metadata contained in the Leader file.
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.

◆ ossimRadarSatModel() [2/2]

ossimplugins::ossimRadarSatModel::ossimRadarSatModel ( const ossimRadarSatModel rhs)

copy constructor

Definition at line 59 of file ossimRadarSatModel.cpp.

59  :
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 }
double _pixel_spacing
Pixel spacing.
Trailer * _trailer
List of metadata contained in the Trailer file.
Data * _data
List of metadata contained in the Data file.
VolumeDir * _volumeDir
List of metadata contained in the Volume Directory file.
Leader * _leader
List of metadata contained in the Leader file.
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.

◆ ~ossimRadarSatModel()

ossimplugins::ossimRadarSatModel::~ossimRadarSatModel ( )
virtual

Destructor.

Definition at line 70 of file ossimRadarSatModel.cpp.

References _data, _leader, _trailer, and _volumeDir.

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 }
Trailer * _trailer
List of metadata contained in the Trailer file.
Data * _data
List of metadata contained in the Data file.
VolumeDir * _volumeDir
List of metadata contained in the Volume Directory file.
Leader * _leader
List of metadata contained in the Leader file.

Member Function Documentation

◆ dup()

ossimObject * ossimplugins::ossimRadarSatModel::dup ( ) const
virtual

Returns pointer to a new instance, copy of this.

Implements ossimProjection.

Definition at line 93 of file ossimRadarSatModel.cpp.

References ossimRadarSatModel().

94 {
95  return new ossimRadarSatModel(*this);
96 }

◆ FindSRGRSetNumber()

int ossimplugins::ossimRadarSatModel::FindSRGRSetNumber ( JSDDateTime  date) const
private

Finds the SRGR data set which update time is the closest to the center scene time.

Definition at line 1210 of file ossimRadarSatModel.cpp.

References _n_srgr, _srgr_update, ossimplugins::JSDDateTime::get_decimal(), and ossimplugins::JSDDateTime::get_second().

Referenced by getSlantRangeFromGeoreferenced().

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 }
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.
double _srgr_update[20]
SRGR coefficient sets update times.

◆ getClassName()

ossimString ossimplugins::ossimRadarSatModel::getClassName ( ) const
virtual

Method to return the class name.

Returns
The name of this class.

Reimplemented from ossimObject.

Definition at line 98 of file ossimRadarSatModel.cpp.

Referenced by loadState().

99 {
100  return ossimString("ossimRadarSatModel");
101 }

◆ getSlantRangeFromGeoreferenced()

double ossimplugins::ossimRadarSatModel::getSlantRangeFromGeoreferenced ( double  col) const
virtual

This function associates an image column number to a slant range when the image is georeferenced (ground projected)

Parameters
colColumn coordinate of the image point
Todo:
: could be improved (date choice)

Implements ossimplugins::ossimGeometricSarSensorModel.

Definition at line 103 of file ossimRadarSatModel.cpp.

References _n_srgr, _pixel_spacing, ossimplugins::ossimGeometricSarSensorModel::_refPoint, ossimplugins::ossimGeometricSarSensorModel::_sensor, _srgr_coefset, FindSRGRSetNumber(), ossimplugins::SensorParams::get_col_direction(), ossimplugins::RefPoint::get_distance(), ossimplugins::RefPoint::get_ephemeris(), and ossimplugins::RefPoint::get_pix_col().

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 }
double _pixel_spacing
Pixel spacing.
Ephemeris * get_ephemeris()
Definition: RefPoint.cpp:90
double get_distance() const
Definition: RefPoint.cpp:95
int FindSRGRSetNumber(JSDDateTime date) const
Finds the SRGR data set which update time is the closest to the center scene time.
double get_pix_col() const
Definition: RefPoint.cpp:105
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.
double _srgr_coefset[20][6]
SRGR coefficient sets.

◆ InitPlatformPosition()

bool ossimplugins::ossimRadarSatModel::InitPlatformPosition ( const ossimKeywordlist kwl,
const char *  prefix 
)
privatevirtual

Initializes the Platform Position from a projection keywordlist.

Implements ossimplugins::ossimGeometricSarSensorModel.

Definition at line 799 of file ossimRadarSatModel.cpp.

References ossimplugins::ossimGeometricSarSensorModel::_platformPosition, ossimplugins::GMSTDateTime::AN2000, ossimplugins::CivilDateTime::AsGMSTDateTime(), ossimplugins::JSDDateTime::AsGMSTDateTime(), ossimKeywordlist::find(), ossimplugins::JSDDateTime::get_second(), ossimplugins::GMSTDateTime::get_tms(), ossimplugins::JSDDateTime::NormDate(), ossimplugins::CivilDateTime::set_day(), ossimplugins::CivilDateTime::set_decimal(), ossimplugins::CivilDateTime::set_month(), ossimplugins::GMSTDateTime::set_origine(), ossimplugins::JSDDateTime::set_second(), ossimplugins::CivilDateTime::set_second(), ossimplugins::CivilDateTime::set_year(), and ossimplugins::GalileanEphemeris::ToGeographic().

Referenced by internalLoadState().

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);
897  GeographicEphemeris* eph = new GeographicEphemeris();
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 }
const char * find(const char *key) const
PlatformPosition * _platformPosition
Handle the position of the platform.

◆ InitRefPoint()

bool ossimplugins::ossimRadarSatModel::InitRefPoint ( const ossimKeywordlist kwl,
const char *  prefix 
)
privatevirtual

Initializes the Reference Point from a projection keywordlist.

Todo:
: effacer

Implements ossimplugins::ossimGeometricSarSensorModel.

Definition at line 930 of file ossimRadarSatModel.cpp.

References ossimplugins::ossimGeometricSarSensorModel::_isProductGeoreferenced, _pixel_spacing, ossimplugins::ossimGeometricSarSensorModel::_platformPosition, ossimplugins::ossimGeometricSarSensorModel::_refPoint, ossimplugins::ossimGeometricSarSensorModel::_sensor, distance(), ossimKeywordlist::find(), ossimplugins::SensorParams::get_nRangeLook(), ossimplugins::RefPoint::get_pix_col(), ossimplugins::SensorParams::get_prf(), ossimplugins::SensorParams::get_sf(), ossimplugins::PlatformPosition::Interpolate(), min, ossimplugins::ossimGeometricSarSensorModel::optimizeModel(), ossimplugins::RefPoint::set_distance(), ossimplugins::RefPoint::set_ephemeris(), ossimplugins::SensorParams::set_nAzimuthLook(), ossimplugins::RefPoint::set_pix_col(), ossimplugins::RefPoint::set_pix_line(), ossimSensorModel::theImageClipRect, ossimSensorModel::theImageSize, ossimIpt::x, and ossimIpt::y.

Referenced by internalLoadState().

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 }
double _pixel_spacing
Pixel spacing.
const char * find(const char *key) const
double get_nRangeLook() const
Definition: SensorParams.h:118
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
void set_pix_col(double pix_col)
Definition: RefPoint.cpp:85
bool _isProductGeoreferenced
True iff the product is ground range.
double get_pix_col() const
Definition: RefPoint.cpp:105
ossimDrect theImageClipRect
PlatformPosition * _platformPosition
Handle the position of the platform.
ossim_int32 y
Definition: ossimIpt.h:142
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.
void set_ephemeris(Ephemeris *ephemeris)
Definition: RefPoint.cpp:65
float distance(double lat1, double lon1, double lat2, double lon2, int units)
void set_distance(double distance)
Definition: RefPoint.cpp:75
#define min(a, b)
Definition: auxiliary.h:75

◆ InitSensorParams()

bool ossimplugins::ossimRadarSatModel::InitSensorParams ( const ossimKeywordlist kwl,
const char *  prefix 
)
privatevirtual

Initializes the Sensor Params from a projection keywordlist.

Implements ossimplugins::ossimGeometricSarSensorModel.

Definition at line 718 of file ossimRadarSatModel.cpp.

References ossimplugins::ossimGeometricSarSensorModel::_sensor, ossimKeywordlist::find(), ossimplugins::SensorParams::Left, ossimplugins::SensorParams::Right, ossimplugins::SensorParams::set_col_direction(), ossimplugins::SensorParams::set_lin_direction(), ossimplugins::SensorParams::set_nAzimuthLook(), ossimplugins::SensorParams::set_nRangeLook(), ossimplugins::SensorParams::set_prf(), ossimplugins::SensorParams::set_rwl(), ossimplugins::SensorParams::set_semiMajorAxis(), ossimplugins::SensorParams::set_semiMinorAxis(), ossimplugins::SensorParams::set_sf(), ossimplugins::SensorParams::set_sightDirection(), and ossimString::trim().

Referenced by internalLoadState().

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 }
void set_sightDirection(SightDirection sight)
Definition: SensorParams.h:93
void set_rwl(double rwl)
Definition: SensorParams.h:83
const char * find(const char *key) const
void set_lin_direction(int dir)
Definition: SensorParams.h:128
void set_semiMinorAxis(double value)
Definition: SensorParams.h:158
void set_semiMajorAxis(double value)
Definition: SensorParams.h:153
void set_nRangeLook(double look)
Definition: SensorParams.h:138
void set_nAzimuthLook(double look)
Definition: SensorParams.h:133
void set_prf(double prf)
Definition: SensorParams.h:73
void set_col_direction(int dir)
Definition: SensorParams.h:123
void set_sf(double sf)
Definition: SensorParams.h:78

◆ InitSRGR()

bool ossimplugins::ossimRadarSatModel::InitSRGR ( const ossimKeywordlist kwl,
const char *  prefix 
)
privatevirtual

Initializes the Slant Range for each Ground Range data sets : _n_srgr,_srgr_coefset,_srgr_update,_pixel_spacing,_isProductGeoreferenced.

Implements ossimplugins::ossimGeometricSarSensorModel.

Definition at line 1121 of file ossimRadarSatModel.cpp.

References ossimplugins::ossimGeometricSarSensorModel::_isProductGeoreferenced, _n_srgr, _pixel_spacing, _srgr_coefset, _srgr_update, ossimKeywordlist::find(), and min.

Referenced by internalLoadState().

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 }
double _pixel_spacing
Pixel spacing.
const char * find(const char *key) const
bool _isProductGeoreferenced
True iff the product is ground range.
int _n_srgr
Slant Range for each Ground Range (SRGR) number of coefficients sets.
double _srgr_update[20]
SRGR coefficient sets update times.
double _srgr_coefset[20][6]
SRGR coefficient sets.
#define min(a, b)
Definition: auxiliary.h:75

◆ internalLoadState()

bool ossimplugins::ossimRadarSatModel::internalLoadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
privatevirtual

Method to the load (recreate) the state of the object from a keyword list.

Return true if ok or false on error.

Returns
true if load OK, false on error

Definition at line 659 of file ossimRadarSatModel.cpp.

References InitPlatformPosition(), InitRefPoint(), InitSensorParams(), InitSRGR(), ossimNotify(), and ossimNotifyLevel_DEBUG.

Referenced by loadState(), and open().

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 }
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.
virtual bool InitRefPoint(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Reference Point from a projection keywordlist.
virtual bool InitPlatformPosition(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Platform Position from a projection keywordlist.
virtual bool InitSensorParams(const ossimKeywordlist &kwl, const char *prefix)
Initializes the Sensor Params from a projection keywordlist.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ internalSaveState()

bool ossimplugins::ossimRadarSatModel::internalSaveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
privatevirtual

Method to save object state to a keyword list.

Parameters
kwlKeyword list to save to.
prefixadded to keys when saved.
Returns
true on success, false on error.

Definition at line 430 of file ossimRadarSatModel.cpp.

References _data, _leader, _trailer, ossimKeywordlist::add(), ossimplugins::ProcessedDataRecord::get_acq_msec(), ossimplugins::DataSetSummary::get_alt_dopcen(), ossimplugins::DataSetSummary::get_asc_des(), ossimplugins::DataSetSummary::get_bnd_azi(), ossimplugins::DataSetSummary::get_bnd_azilok(), ossimplugins::DataSetSummary::get_bnd_rng(), ossimplugins::DataSetSummary::get_bnd_rnglok(), ossimplugins::DataSetSummary::get_crt_dopcen(), ossimplugins::PlatformPositionData::get_data_int(), ossimplugins::Trailer::get_DataSetSummary(), ossimplugins::Leader::get_DataSetSummary(), ossimplugins::PlatformPositionData::get_day(), ossimplugins::DataSetSummary::get_ellip_des(), ossimplugins::DataSetSummary::get_ellip_maj(), ossimplugins::DataSetSummary::get_ellip_min(), ossimplugins::DataSetSummary::get_fa(), ossimplugins::FileDescriptor::get_file_name(), ossimplugins::Leader::get_FileDescriptor(), ossimplugins::Data::get_FirstProcessedDataRecord(), ossimplugins::DataSetSummary::get_fr(), ossimplugins::PlatformPositionData::get_gmt_sec(), ossimplugins::PlatformPositionData::get_hr_angle(), ossimplugins::Data::get_ImageOptionsFileDescriptor(), ossimplugins::DataSetSummary::get_inp_sctim(), ossimplugins::Data::get_LastProcessedDataRecord(), ossimplugins::ProcessedDataRecord::get_lat_first(), ossimplugins::ProcessedDataRecord::get_lat_last(), ossimplugins::DataSetSummary::get_line_spacing(), ossimplugins::ProcessedDataRecord::get_lon_first(), ossimplugins::ProcessedDataRecord::get_lon_last(), ossimplugins::PlatformPositionData::get_month(), ossimplugins::DataSetSummary::get_n_azilok(), ossimplugins::DataSetSummary::get_n_rnglok(), ossimplugins::ProcessingParameters::get_n_srgr(), ossimplugins::PlatformPositionData::get_ndata(), ossimplugins::ImageOptionsFileDescriptor::get_ngrp(), ossimplugins::ImageOptionsFileDescriptor::get_nlin(), ossimplugins::ProcessingParameters::get_pixel_spacing(), ossimplugins::DataSetSummary::get_plat_head(), ossimplugins::DataSetSummary::get_plat_lat(), ossimplugins::DataSetSummary::get_plat_long(), ossimplugins::Leader::get_PlatformPositionData(), ossimplugins::PlatformPositionData::get_pos_vect(), ossimplugins::DataSetSummary::get_pro_head(), ossimplugins::DataSetSummary::get_pro_lat(), ossimplugins::DataSetSummary::get_pro_long(), ossimplugins::Trailer::get_ProcessingParameters(), ossimplugins::Leader::get_ProcessingParameters(), ossimplugins::DataSetSummary::get_rng_gate(), ossimplugins::DataSetSummary::get_sc_lin(), ossimplugins::DataSetSummary::get_sc_pix(), ossimplugins::ProcessingParameters::get_sens_orient(), ossimplugins::ProcessingParameters::get_srgr_coefset(), ossimplugins::DataSetSummary::get_terrain_h(), ossimplugins::DataSetSummary::get_time_dir_lin(), ossimplugins::DataSetSummary::get_time_dir_pix(), ossimplugins::DataSetSummary::get_wave_length(), ossimplugins::PlatformPositionData::get_year(), ossimNotify(), ossimNotifyLevel_DEBUG, and ossimKeywordNames::TYPE_KW.

Referenced by open(), and saveState().

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 }
FileDescriptor * get_FileDescriptor()
Definition: Leader.cpp:196
Trailer * _trailer
List of metadata contained in the Trailer file.
DataSetSummary * get_DataSetSummary()
Definition: Trailer.cpp:163
ProcessingParameters * get_ProcessingParameters()
Definition: Trailer.cpp:143
ProcessedDataRecord * get_FirstProcessedDataRecord()
Definition: Data.cpp:226
static const char * TYPE_KW
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
Data * _data
List of metadata contained in the Data file.
PlatformPositionData * get_PlatformPositionData()
Definition: Leader.cpp:166
ProcessedDataRecord * get_LastProcessedDataRecord()
Definition: Data.cpp:231
ProcessingParameters * get_ProcessingParameters()
Definition: Leader.cpp:171
DataSetSummary * get_DataSetSummary()
Definition: Leader.cpp:191
Leader * _leader
List of metadata contained in the Leader file.
ImageOptionsFileDescriptor * get_ImageOptionsFileDescriptor()
Definition: Data.cpp:221
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadState()

bool ossimplugins::ossimRadarSatModel::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of the object from a keyword list.

Return true if ok or false on error.

Returns
true if load OK, false on error

Reimplemented from ossimplugins::ossimGeometricSarSensorModel.

Definition at line 680 of file ossimRadarSatModel.cpp.

References ossimKeywordlist::find(), getClassName(), internalLoadState(), ossimNotify(), ossimNotifyLevel_DEBUG, and ossimKeywordNames::TYPE_KW.

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 }
const char * find(const char *key) const
static const char * TYPE_KW
virtual ossimString getClassName() const
Method to return the class name.
virtual bool internalLoadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ open()

bool ossimplugins::ossimRadarSatModel::open ( const ossimFilename file)

Method to intantial model from a file.

Parameters
file
Returns
true on success, false on error.

Definition at line 127 of file ossimRadarSatModel.cpp.

References _data, _leader, _trailer, _volumeDir, ossimString::c_str(), ossimFilename::exists(), ossimString::find(), ossimplugins::RadarSatRecordFactory::Instanciate(), internalLoadState(), internalSaveState(), ossimplugins::ossimGeometricSarSensorModel::lineSampleToWorld(), ossimDrect::ll(), ossimDrect::lr(), ossimNotify(), ossimNotifyLevel_DEBUG, ossimplugins::RadarSatRecord::Read(), ossimSensorModel::setGroundRect(), ossimSensorModel::theImageClipRect, ossimDrect::ul(), and ossimDrect::ur().

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 }
Represents serializable keyword/value map.
std::basic_ifstream< char > ifstream
Class for char input file streams.
Definition: ossimIosFwd.h:44
const ossimDpt & ul() const
Definition: ossimDrect.h:339
virtual bool internalSaveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
Trailer * _trailer
List of metadata contained in the Trailer file.
Data * _data
List of metadata contained in the Data file.
ossimDrect theImageClipRect
void setGroundRect(const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
const ossimDpt & ur() const
Definition: ossimDrect.h:340
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.
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
const ossimDpt & ll() const
Definition: ossimDrect.h:342
virtual bool internalLoadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of the object from a keyword list.
const ossimDpt & lr() const
Definition: ossimDrect.h:341
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)

◆ saveState()

bool ossimplugins::ossimRadarSatModel::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save object state to a keyword list.

Parameters
kwlKeyword list to save to.
prefixadded to keys when saved.
Returns
true on success, false on error.

Reimplemented from ossimplugins::ossimGeometricSarSensorModel.

Definition at line 646 of file ossimRadarSatModel.cpp.

References internalSaveState(), and ossimplugins::ossimGeometricSarSensorModel::saveState().

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 }
virtual bool internalSaveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save object state to a keyword list.

Member Data Documentation

◆ _data

Data* ossimplugins::ossimRadarSatModel::_data
protected

List of metadata contained in the Data file.

Definition at line 116 of file ossimRadarSatModel.h.

Referenced by internalSaveState(), open(), and ~ossimRadarSatModel().

◆ _leader

Leader* ossimplugins::ossimRadarSatModel::_leader
protected

List of metadata contained in the Leader file.

Definition at line 121 of file ossimRadarSatModel.h.

Referenced by internalSaveState(), open(), and ~ossimRadarSatModel().

◆ _n_srgr

int ossimplugins::ossimRadarSatModel::_n_srgr
protected

Slant Range for each Ground Range (SRGR) number of coefficients sets.

Definition at line 99 of file ossimRadarSatModel.h.

Referenced by FindSRGRSetNumber(), getSlantRangeFromGeoreferenced(), and InitSRGR().

◆ _pixel_spacing

double ossimplugins::ossimRadarSatModel::_pixel_spacing
protected

Pixel spacing.

Definition at line 111 of file ossimRadarSatModel.h.

Referenced by getSlantRangeFromGeoreferenced(), InitRefPoint(), and InitSRGR().

◆ _srgr_coefset

double ossimplugins::ossimRadarSatModel::_srgr_coefset[20][6]
protected

SRGR coefficient sets.

Definition at line 103 of file ossimRadarSatModel.h.

Referenced by getSlantRangeFromGeoreferenced(), and InitSRGR().

◆ _srgr_update

double ossimplugins::ossimRadarSatModel::_srgr_update[20]
protected

SRGR coefficient sets update times.

Definition at line 107 of file ossimRadarSatModel.h.

Referenced by FindSRGRSetNumber(), and InitSRGR().

◆ _trailer

Trailer* ossimplugins::ossimRadarSatModel::_trailer
protected

List of metadata contained in the Trailer file.

Definition at line 126 of file ossimRadarSatModel.h.

Referenced by internalSaveState(), open(), and ~ossimRadarSatModel().

◆ _volumeDir

VolumeDir* ossimplugins::ossimRadarSatModel::_volumeDir
protected

List of metadata contained in the Volume Directory file.

Definition at line 131 of file ossimRadarSatModel.h.

Referenced by open(), and ~ossimRadarSatModel().


The documentation for this class was generated from the following files: