Skip to content
Snippets Groups Projects
Commit e3310b02 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: reuse the same SarSensor

parent 1b0e7e9e
Branches
Tags
No related merge requests found
......@@ -45,6 +45,7 @@ ossimGeometricSarSensorModel::ossimGeometricSarSensorModel()
ossimSensorModel(),
_platformPosition(0),
_sensor(0),
_sarSensor(0),
_refPoint(0),
_isProductGeoreferenced(false),
_optimizationFactorX(0.0),
......@@ -69,6 +70,7 @@ ossimGeometricSarSensorModel::ossimGeometricSarSensorModel(
_imageFilename(rhs._imageFilename),
_productXmlFile(rhs._productXmlFile)
{
_sarSensor = new SarSensor(_sensor,_platformPosition);
}
ossimGeometricSarSensorModel::~ossimGeometricSarSensorModel()
......@@ -85,6 +87,12 @@ ossimGeometricSarSensorModel::~ossimGeometricSarSensorModel()
_sensor = 0;
}
if (_sarSensor != 0)
{
delete _sarSensor;
_sarSensor = 0;
}
if(_refPoint != 0)
{
delete _refPoint;
......@@ -134,7 +142,12 @@ void ossimGeometricSarSensorModel::lineSampleHeightToWorld(
const double& heightEllipsoid,
ossimGpt& worldPoint) const
{
SarSensor sensor(_sensor,_platformPosition);
if (!_sarSensor)
{
// bad design consequence, should be fixed.
_sarSensor = new SarSensor(_sensor, _platformPosition);
}
double lon, lat;
// const double CLUM = 2.99792458e+8 ;
......@@ -155,7 +168,7 @@ void ossimGeometricSarSensorModel::lineSampleHeightToWorld(
slantRange = getSlantRange(col) ;
}
int etatLoc = sensor.ImageToWorld(slantRange, azimuthTime, heightEllipsoid, lon, lat);
int etatLoc = _sarSensor->ImageToWorld(slantRange, azimuthTime, heightEllipsoid, lon, lat);
if(traceDebug())
{
......@@ -402,6 +415,8 @@ bool ossimGeometricSarSensorModel::loadState(const ossimKeywordlist &kwl,
result = false;
}
_sarSensor = new SarSensor(_sensor, _platformPosition);
// Load the ref point.
if ( !_refPoint)
{
......
......@@ -36,6 +36,7 @@ namespace ossimplugins
class PlatformPosition;
class SensorParams;
class RefPoint;
class SarSensor;
/**
* @brief This class allows for direct localisation and indirect localisation
......@@ -189,6 +190,11 @@ protected:
PlatformPosition *_platformPosition;
SensorParams * _sensor;
RefPoint * _refPoint;
// Note that this is only mutable because of bad design of the
// classes, with a bunch of classes initializing the variables of
// the base class directly, the 3 variable above must be made
// private.
mutable SarSensor* _sarSensor;
/**
* @brief True iff the product is ground range
......@@ -209,7 +215,7 @@ protected:
double _optimizationBiasX ;
double _optimizationBiasY ;
ossimFilename _imageFilename;
ossimFilename _imageFilename;
ossimFilename _productXmlFile;
ossimRefPtr<ossimCoarseGridModel> _replacementOcgModel;
......
......@@ -34,7 +34,7 @@ SarSensor::~SarSensor()
{
}
int SarSensor::ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat)
int SarSensor::ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) const
{
const double TWOPI = 6.28318530717958647693 ;
......@@ -75,7 +75,7 @@ int SarSensor::ImageToWorld(double distance, JSDDateTime time, double height, do
int SarSensor::localisationSAR ( GeographicEphemeris PosVit , double lambda ,
double dist , double fDop , int sensVisee ,
double rayonEqu , double rayonPol ,
double h , RectangularCoordinate* cart )
double h , RectangularCoordinate* cart ) const
{
double coordCart[3];
coordCart[0]=0.0;
......
......@@ -53,7 +53,7 @@ public:
*
* @remark : the doppler frequency is set to zero in this implementation
*/
virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat);
virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) const;
protected:
/**
......@@ -62,7 +62,7 @@ protected:
int localisationSAR ( GeographicEphemeris PosVit , double lambda ,
double dist , double fDop , int sensVisee ,
double rayonEqu , double rayonPol ,
double h , RectangularCoordinate* cart );
double h , RectangularCoordinate* cart ) const;
private:
};
......
......@@ -50,7 +50,7 @@ public:
* @retval lon : Longitude of the world point
* @retval lat : Latitude of the world point
*/
virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) = 0;
virtual int ImageToWorld(double distance, JSDDateTime time, double height, double& lon, double& lat) const = 0;
protected:
SensorParams * _params;
PlatformPosition* _position;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment