Commit 8aa9f900 authored by Victor Poughon's avatar Victor Poughon
Browse files

Merge branch 'enhance_otbSarSensorModelAdapter_2' into 'develop'

enhance SarSensorModelAdapter

See merge request orfeotoolbox/otb!289
No related merge requests found
Showing with 38 additions and 2 deletions
+38 -2
...@@ -95,6 +95,10 @@ public: ...@@ -95,6 +95,10 @@ public:
/** Transform world point (lat,lon,hgt) to satellite position (x,y,z) and satellite velocity */ /** Transform world point (lat,lon,hgt) to satellite position (x,y,z) and satellite velocity */
bool WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, Point3DType & satellitePosition, bool WorldToSatPositionAndVelocity(const Point3DType & inGeoPoint, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const; Point3DType & satelliteVelocity) const;
/** Transform line index to satellite position (x,y,z) and satellite velocity */
bool LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const;
/** Transform world point (lat,lon,hgt) to cartesian point (x,y,z) */ /** Transform world point (lat,lon,hgt) to cartesian point (x,y,z) */
static bool WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint); static bool WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint);
...@@ -104,6 +108,7 @@ public: ...@@ -104,6 +108,7 @@ public:
static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long deburstLine, unsigned long & imageLine); static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long deburstLine, unsigned long & imageLine);
protected: protected:
SarSensorModelAdapter(); SarSensorModelAdapter();
virtual ~SarSensorModelAdapter() override; virtual ~SarSensorModelAdapter() override;
......
...@@ -216,5 +216,34 @@ bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & in ...@@ -216,5 +216,34 @@ bool SarSensorModelAdapter::WorldToSatPositionAndVelocity(const Point3DType & in
return true; return true;
} }
bool SarSensorModelAdapter::LineToSatPositionAndVelocity(const double line, Point3DType & satellitePosition,
Point3DType & satelliteVelocity) const
{
if(!m_SensorModel.get())
{
return false;
}
ossimplugins::ossimSarSensorModel::TimeType azimuthTime;
ossimEcefPoint sensorPos;
ossimEcefVector sensorVel;
m_SensorModel->lineToAzimuthTime(line, azimuthTime);
m_SensorModel->interpolateSensorPosVel(azimuthTime, sensorPos, sensorVel);
if(sensorPos.isNan() || sensorVel.isNan())
return false;
satellitePosition[0] = sensorPos.x();
satellitePosition[1] = sensorPos.y();
satellitePosition[2] = sensorPos.z();
satelliteVelocity[0] = sensorVel.x();
satelliteVelocity[1] = sensorVel.y();
satelliteVelocity[2] = sensorVel.z();
return true;
}
} // namespace otb } // namespace otb
...@@ -62,7 +62,7 @@ int otbSarSensorModelAdapterTest(int itkNotUsed(argc), char* argv[]) ...@@ -62,7 +62,7 @@ int otbSarSensorModelAdapterTest(int itkNotUsed(argc), char* argv[])
otb::SarSensorModelAdapter::Point2DType out1,out2; otb::SarSensorModelAdapter::Point2DType out1,out2;
otb::SarSensorModelAdapter::Point3DType in, out3, out4, out5; otb::SarSensorModelAdapter::Point3DType in, out3, out4, out5, out6, out7;
// GCP 99 from input geom file // GCP 99 from input geom file
//support_data.geom.gcp[99].world_pt.hgt: 2.238244926818182e+02 //support_data.geom.gcp[99].world_pt.hgt: 2.238244926818182e+02
...@@ -78,7 +78,9 @@ int otbSarSensorModelAdapterTest(int itkNotUsed(argc), char* argv[]) ...@@ -78,7 +78,9 @@ int otbSarSensorModelAdapterTest(int itkNotUsed(argc), char* argv[])
sensorModel->WorldToCartesian(in, out5); sensorModel->WorldToCartesian(in, out5);
sensorModel->WorldToSatPositionAndVelocity(in,out3, out4); sensorModel->WorldToSatPositionAndVelocity(in,out3, out4);
unsigned int ind_Line = 2;
sensorModel->LineToSatPositionAndVelocity(ind_Line, out6, out7);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment