diff --git a/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h index 17705f7f41725151a084b6345683aef1479a5f61..abaabd28f7d71d88057235a130f41f5e19101de0 100644 --- a/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h +++ b/Modules/Adapters/OSSIMAdapters/include/otbSarSensorModelAdapter.h @@ -91,7 +91,13 @@ public: /** Transform world point (lat,lon,hgt) to input image point (col,row) */ bool WorldToLineSample(const Point3DType & inGEoPOint, Point2DType & cr) const; - + + /** Transform world point (lat,lon,hgt) to cartesian point (x,y,z) */ + bool WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint) const; + +/** Transform world point (lat,lon,hgt) to satellite position (x,y,z)*/ + bool WorldToSatPosition(const Point3DType & inGeoPoint, Point3DType & satelitePosition) const; + static bool ImageLineToDeburstLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long imageLine, unsigned long & deburstLine); static void DeburstLineToImageLine(const std::vector<std::pair<unsigned long,unsigned long> >& lines, unsigned long deburstLine, unsigned long & imageLine); diff --git a/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx index 83360cefad15022c827bfb0ddc687f39a27be806..324a1855652c443adcc8f087ca78b3019cee3362 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbSarSensorModelAdapter.cxx @@ -162,6 +162,62 @@ bool SarSensorModelAdapter::WorldToLineSample(const Point3DType & inGeoPoint, Po return true; } +bool SarSensorModelAdapter::WorldToCartesian(const Point3DType & inGeoPoint, Point3DType & outCartesianPoint) const +{ + if(m_SensorModel.get() == ITK_NULLPTR) + { + return false; + } + + ossimGpt inGpt; + inGpt.lat = inGeoPoint[0]; + inGpt.lon = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + + ossimEcefPoint outCartesien(inGpt); + + + if(outCartesien.isNan()) + return false; + + outCartesianPoint[0] = outCartesien.x(); + outCartesianPoint[1] = outCartesien.y(); + outCartesianPoint[2] = outCartesien.z(); + + return true; + +} + +bool SarSensorModelAdapter::WorldToSatPosition(const Point3DType & inGeoPoint, Point3DType & satelitePosition) const +{ + if(m_SensorModel.get() == ITK_NULLPTR) + { + return false; + } + + ossimGpt inGpt; + inGpt.lat = inGeoPoint[0]; + inGpt.lon = inGeoPoint[1]; + inGpt.hgt = inGeoPoint[2]; + + + ossimplugins::ossimSarSensorModel::TimeType azimuthTime; + double rangeTime; + ossimEcefPoint sensorPos; + ossimEcefVector sensorVel; + + const bool success = m_SensorModel->worldToAzimuthRangeTime(inGpt, azimuthTime, rangeTime,sensorPos,sensorVel); + + if(sensorPos.isNan()) + return false; + + satelitePosition[0] = sensorPos.x(); + satelitePosition[1] = sensorPos.y(); + satelitePosition[2] = sensorPos.z(); + + return true; +} } // namespace otb