Skip to content
Snippets Groups Projects
Commit 9aa0e4e8 authored by Tristan Laurent's avatar Tristan Laurent
Browse files

FIX: change seconds computation of DimapMetadataHelper::GetTime

parent 958ff803
No related branches found
No related tags found
1 merge request!1047Retrieve improvments from 9.1
......@@ -24,6 +24,7 @@
#include "OTBMetadataExport.h"
#include "otbMetadataSupplierInterface.h"
#include "otbSpot5Metadata.h"
#include "otbDateTime.h"
namespace otb
......@@ -226,16 +227,18 @@ private:
}
double GetTime(std::string timeStr){
double GetTime(const std::string& timeStr){
// Time stamps are in the format: "yyyy-mm-ddThh:mm:ss.ssssss"
int year, month, day, hour, minute;
double second;
sscanf(timeStr.c_str(),
"%4d-%2d-%2dT%2d:%2d:%9lf",
&year, &month, &day,
&hour, &minute, &second);
return (((((year-2002.0)*12.0 + month - 1.0)*365.0 + day - 1.0)*24.0
+ hour)*60.0 + minute)*60.0 + second;
const auto d = MetaData::ReadFormattedDate(timeStr);
return d.GetSecond() + 60.0 * (
d.GetMinute() + 60.0 * ( // Total NB of minutes
d.GetHour() + 24.0 * ( // Total NB of hours
d.GetDay() - 1.0 + 365.25 * ( // Total NB of days (-1 as day is not over)
d.GetYear() - 2002.0
)
)
)
);
}
DimapData m_Data;
......
......@@ -71,7 +71,7 @@ public:
* @return image point to world point at given height
*/
Point3DType lineSampleHeightToWorld(Point2DType lineSampPt,
const double& heightAboveEllipsoid) const;
double heightAboveEllipsoid) const;
const std::vector<Point2DType>& getLineSamplePoints() const;
......
......@@ -105,7 +105,7 @@ public:
* @param[in] offset double offset
* @return world point (lat,lon,hgt)
*/
Point3DType NearestIntersection(const Ephemeris& imRay, const double& offset) const;
Point3DType NearestIntersection(const Ephemeris& imRay, double offset) const;
/**
* @brief Compute world point intersected by image ray.
......@@ -145,7 +145,7 @@ public:
* @param[in] time input time
* @return 3D position
*/
Point3DType GetPositionEcf(const double& time) const;
Point3DType GetPositionEcf(double time) const;
/**
* @brief Get the 3D velocity of the sensor at time (interpolation of velocity samples vector from metadata).
......@@ -153,7 +153,7 @@ public:
* @param[in] time input time
* @return 3D position
*/
Point3DType GetVelocityEcf(const double& time) const;
Point3DType GetVelocityEcf(double time) const;
/**
* @brief Get look angles on X and Y axis of the sensor at line (interpolation of angles samples vector from metadata).
......@@ -170,7 +170,7 @@ public:
* @param[in] time input time
* @return 3D attitude
*/
Point3DType GetAttitude(const double& time) const;
Point3DType GetAttitude(double time) const;
/**
* @brief Compute SatToOrb matrix with an input time.
......
......@@ -85,7 +85,7 @@ BilinearProjection::Point3DType BilinearProjection::lineSampleToWorld(Point2DTyp
BilinearProjection::Point3DType BilinearProjection::lineSampleHeightToWorld(
Point2DType lineSampPt,
const double& heightAboveEllipsoid) const
double heightAboveEllipsoid) const
{
itk::Vector<double,2> lineSampMatrix;
lineSampMatrix[0] = lineSampPt[0];
......
......@@ -334,7 +334,7 @@ itk::Point<double, 3> Spot5SensorModel::GetLagrangeInterpolation(
}
itk::Point<double, 3> Spot5SensorModel::GetPositionEcf(const double& time) const
itk::Point<double, 3> Spot5SensorModel::GetPositionEcf(double time) const
{
if((m_Spot5Param.EcefPosSamples.size() < 8)||
(m_Spot5Param.EcefTimeSamples.size() < 8))
......@@ -348,7 +348,7 @@ itk::Point<double, 3> Spot5SensorModel::GetPositionEcf(const double& time) cons
}
itk::Point<double, 3> Spot5SensorModel::GetVelocityEcf(const double& time) const
itk::Point<double, 3> Spot5SensorModel::GetVelocityEcf(double time) const
{
if((m_Spot5Param.EcefVelSamples.size() < 8)||
(m_Spot5Param.EcefTimeSamples.size() < 8))
......@@ -362,7 +362,7 @@ itk::Point<double, 3> Spot5SensorModel::GetVelocityEcf(const double& time) cons
}
void Spot5SensorModel::GetPixelLookAngleXY(unsigned int line,
double& psiX, double& psiY) const
double& psiX, double& psiY) const
{
if (line >= m_Spot5Param.PixelLookAngleX.size())
{
......@@ -377,12 +377,12 @@ void Spot5SensorModel::GetPixelLookAngleXY(unsigned int line,
}
itk::Point<double, 3> Spot5SensorModel::GetAttitude(const double& time) const
itk::Point<double, 3> Spot5SensorModel::GetAttitude(double time) const
{
return GetBilinearInterpolation(time, m_Spot5Param.AttitudesSamples, m_Spot5Param.AttitudesSamplesTimes);
}
itk::Point<double, 3> Spot5SensorModel::NearestIntersection(const Ephemeris& imRay, const double& offset) const
itk::Point<double, 3> Spot5SensorModel::NearestIntersection(const Ephemeris& imRay, double offset) const
{
// WGS 84 parameters conversion
double wgsA = 6378137.000;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment