28 #include "../../../datatype/DateTime.h" 29 #include "../../../datatype/DateTimeUtils.h" 30 #include "../../../geometry/Geometry.h" 33 #include "../trajectory/Trajectory.h" 40 std::unique_ptr<te::gm::Geometry>
44 TrajectoryObservationSet::const_iterator itlower, itupper, itbegin, itend;
48 itlower = tjObs.lower_bound(dtshr);
49 itupper = tjObs.upper_bound(dtshr);
53 if(itlower==itupper && itlower!=tjObs.begin())
56 if(itlower!=tjObs.end() && itupper!=tjObs.end())
58 long distLower =
GetDistance(itlower->first.get(),time);
59 long distUpper =
GetDistance(itupper->first.get(),time);
60 if(distLower<distUpper)
61 return std::unique_ptr<te::gm::Geometry>(
static_cast<te::gm::Geometry*
>(itlower->second->clone()));
63 return std::unique_ptr<te::gm::Geometry>(
static_cast<te::gm::Geometry*
>(itupper->second->clone()));
66 if(itlower!=tjObs.end() && itupper==tjObs.end())
67 return std::unique_ptr<te::gm::Geometry>(static_cast<te::gm::Geometry*>(itlower->second->clone()));
69 return std::unique_ptr<te::gm::Geometry>(
nullptr);
std::unique_ptr< te::gm::Geometry > estimate(const Trajectory &tj, te::dt::DateTime *time) const
It estimates a geometry of a trajectory at a given non-observed time .
TEDATATYPEEXPORT long GetDistance(const te::dt::DateTime *t1, const te::dt::DateTime *t2)
It returns the distance between two datetime types.
const TrajectoryObservationSet & getObservations() const
It returns the trajectory observations.
This file contains an interpolation function that estimates the nearest geometry at time of a traject...
std::map< te::dt::DateTimeShrPtr, te::gm::GeometryShrPtr, CompareShrDateTime > TrajectoryObservationSet
boost::shared_ptr< DateTime > DateTimeShrPtr
virtual AbstractData * clone() const =0
It returns a clone of this object.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual ~NearestGeometryAtTimeInterp()
Virtual destructor.
A class to represent trajectory.
NearestGeometryAtTimeInterp()
Constructor.