te::st::Trajectory Class Reference

A class to represent trajectory. More...

#include <Trajectory.h>

Public Member Functions

void add (te::dt::DateTime *time, te::gm::Geometry *geom)
 It adds an observation (time and geometry) into the trajectory. More...
 
void add (const TrajectoryObservation &p)
 It adds an observation (time and geometry) into the trajectory. More...
 
Trajectoryclone () const
 It returns a clone of this trajectory. More...
 
std::auto_ptr< TimeSeriesgetDistance (const Trajectory &other) const
 It returns the distance between two trajectories. More...
 
std::auto_ptr< TimeSeriesgetDistance (const te::gm::Geometry &geom)
 It returns the distance between the trajectory and a given geometry. More...
 
std::auto_ptr< te::gm::GeometrygetGeometry (te::dt::DateTime *t) const
 It returns the geometry associated to a given date and time. More...
 
std::string getId () const
 It returns the trajectory id. More...
 
AbstractTrajectoryInterpgetInterpolator () const
 It returns the interpolator associated to the trajectory. More...
 
const TrajectoryObservationSetgetObservations () const
 It returns the trajectory observations. More...
 
te::gm::Envelope getSpatialExtent () const
 It returns the spatial extent of the trajectory observations. More...
 
std::auto_ptr< te::dt::DateTimePeriodgetTemporalExtent () const
 It returns the temporal extent of the trajectory observations. More...
 
Trajectoryoperator= (const Trajectory &other)
 Copy assignment operator. More...
 
void setId (const std::string &id)
 It sets the trajectory id. More...
 
void setInterpolator (AbstractTrajectoryInterp *interp)
 It sets the interpolator associated to the path. More...
 
std::size_t size () const
 It returns the size of the trajectory observations. More...
 
virtual ~Trajectory ()
 Virtual destructor. More...
 
Trajectory Constructors
 Trajectory ()
 Empty constructor. More...
 
 Trajectory (const std::string &id)
 Empty constructor. More...
 
 Trajectory (AbstractTrajectoryInterp *interp, const std::string &id)
 Empty constructor. More...
 
 Trajectory (const TrajectoryObservationSet &obs, const std::string &id)
 Constructor. More...
 
 Trajectory (const TrajectoryObservationSet &obs, AbstractTrajectoryInterp *interp, const std::string &id)
 Constructor. More...
 
 Trajectory (const TrajectoryPatch &patch, AbstractTrajectoryInterp *interp, const std::string &id)
 It constructs a trajectory from a patch. More...
 
 Trajectory (const Trajectory &tj)
 Copy constructor. More...
 
Trajectory Iterator

An example of use:

TrajectoryIterator it = tj.begin(); while(it!=tj.end()) { Geometry* g = it.getGeometry(); DateTime* t = it.getTime(); ++it; }

TrajectoryIterator begin () const
 It returns an iterator that points to the first observation of the trajectory. More...
 
TrajectoryIterator end () const
 It returns an iterator that points to the end of the trajectory. More...
 
TrajectoryIterator at (te::dt::DateTime *t) const
 It returns an iterator that points to an observation at a given time. More...
 
Trajectory Patch

These methods return patches of a trajectory, as TrajectoryPatch objects, that satisfy given restrictions. A TrajectoryPatch object contains only pointers to the initial and final observations that delimit a patch of a Trajectory. The end() method of a TrajectoryPatch object returns an iterator that points to the position AFTER the last required observation.

Example of use:

TrajectoryPatch patch = tj->getTrajectory(period, "DURING"); TrajectoryIterator it = patch.begin(); while(it!=patch.end()) { Geometry* g = it.getGeometry(); DateTime* t = it.getTime(); ++it; }

Other option is to create a new Trajectory from the returned patch:

TrajectoryPatch patch = tj->getTrajectory(period, "DURING"); Trajectory tjnew(patch);

TrajectoryPatch getPatch (const te::dt::DateTime &dt, te::dt::TemporalRelation r=te::dt::DURING) const
 It returns a trajectory subset that satisfies a given temporal relation. More...
 
void getPatches (const te::gm::Envelope &g, te::gm::SpatialRelation r, std::vector< TrajectoryPatch > &result) const
 It returns trajectory subsets that satisfy a given spatial relation. More...
 
void getPatches (const te::gm::Geometry &geom, te::gm::SpatialRelation r, std::vector< TrajectoryPatch > &result) const
 It returns trajectory subsets that satisfy a given spatial relation. More...
 
void getPatches (const te::gm::Envelope &e, te::gm::SpatialRelation sr, const te::dt::DateTime &dt, te::dt::TemporalRelation tr, std::vector< TrajectoryPatch > &result) const
 It returns trajectory subsets that satisfy a given spatial and temporal relation. More...
 
void getPatches (const te::gm::Geometry &geom, te::gm::SpatialRelation sr, const te::dt::DateTime &dt, te::dt::TemporalRelation tr, std::vector< TrajectoryPatch > &result) const
 It returns trajectory subsets that satisfy a given spatial and temporal relation. More...
 
void getPatches (const te::gm::Geometry &geom, te::st::SpatioTemporalRelation str, const std::vector< TrajectoryPatch > &result) const
 It returns trajectory subsets that satisfy a given spatiotemporal relation. More...
 

Private Attributes

std::string m_id
 The trajectory identification. More...
 
AbstractTrajectoryInterpm_interpolator
 The interpolator used to estimate non-observed times. More...
 
TrajectoryObservationSet m_observations
 The trajectory observations. More...
 
TjRTreeShrPtr m_rtree
 The RTree to index the trajectory geometries. More...
 

Detailed Description

A class to represent trajectory.

A trajectory represents the variation of spatial locations or boundaries of an object over time. It is composed of an observation set and of an interpolator. The observations have a fixed object identity and measured geometries at controlled times. The interpolator is able to estimate spaces at non-observed times.

See also
ObservationSet AbstractInterpolator

Definition at line 75 of file Trajectory.h.

Constructor & Destructor Documentation

te::st::Trajectory::Trajectory ( )

Empty constructor.

It constructs an empty trajectory. The user does not indicate the interpolator associated to it. Internally, it uses a default interpolator that is NearestGeometryAtTimeInterp.

te::st::Trajectory::Trajectory ( const std::string &  id)

Empty constructor.

It constructs an empty trajectory. The user does not indicate the interpolator associated to it. Internally, it uses a default interpolator that is NearestGeometryAtTimeInterp.

Parameters
idThe trajectory id
te::st::Trajectory::Trajectory ( AbstractTrajectoryInterp interp,
const std::string &  id 
)

Empty constructor.

It constructs an empty trajectory.

Parameters
interpThe interpolator associated to the trajectory.
idThe trajectory id.
te::st::Trajectory::Trajectory ( const TrajectoryObservationSet obs,
const std::string &  id 
)

Constructor.

The user does not indicate the interpolator associated to it. Internally, it uses a default interpolator that is NearestGeometryAtTimeInterp.

Parameters
obsThe trajectory observations.
idThe trajectory id.
Note
This constructor does not build the internal RTree
te::st::Trajectory::Trajectory ( const TrajectoryObservationSet obs,
AbstractTrajectoryInterp interp,
const std::string &  id 
)

Constructor.

Parameters
obsThe trajectory observations.
interpThe interpolator associated to the trajectory.
idThe trajectory id.
Note
This constructor does not build the internal RTree
te::st::Trajectory::Trajectory ( const TrajectoryPatch patch,
AbstractTrajectoryInterp interp,
const std::string &  id 
)

It constructs a trajectory from a patch.

Parameters
patchThe given patch.
interpThe interpolator
idThe trajectory id
te::st::Trajectory::Trajectory ( const Trajectory tj)

Copy constructor.

Note
They will share the internal pointers.
The caller has to use the method "clone" to have a deep copy.
virtual te::st::Trajectory::~Trajectory ( )
virtual

Virtual destructor.

Member Function Documentation

void te::st::Trajectory::add ( te::dt::DateTime time,
te::gm::Geometry geom 
)

It adds an observation (time and geometry) into the trajectory.

Parameters
timeA pointer to the time.
dataA pointer to the geometry.
Note
The caller will take the ownership of the given pointers.
void te::st::Trajectory::add ( const TrajectoryObservation p)

It adds an observation (time and geometry) into the trajectory.

Parameters
pA pair of date and time.
Note
The caller will take the ownership of the returned pointer.
TrajectoryIterator te::st::Trajectory::at ( te::dt::DateTime t) const

It returns an iterator that points to an observation at a given time.

If there is no observation at this given time, the returned iterator points to the end of the trajectory.

Returns
The trajectory iterator.
Note
This does not take the ownership of the given pointer.
TrajectoryIterator te::st::Trajectory::begin ( ) const

It returns an iterator that points to the first observation of the trajectory.

Returns
The trajectory iterator.
Trajectory* te::st::Trajectory::clone ( ) const

It returns a clone of this trajectory.

Returns
A new trajectory
Note
The caller will take the ownership of the returned pointer.
TrajectoryIterator te::st::Trajectory::end ( ) const

It returns an iterator that points to the end of the trajectory.

Returns
The trajectory iterator.
std::auto_ptr<TimeSeries> te::st::Trajectory::getDistance ( const Trajectory other) const

It returns the distance between two trajectories.

Parameters
otherThe other trajectory.
Returns
a time series that maps times to the distances.
Note
The caller will take the ownership of the returned pointer.
std::auto_ptr<TimeSeries> te::st::Trajectory::getDistance ( const te::gm::Geometry geom)

It returns the distance between the trajectory and a given geometry.

Parameters
geomA given geometry.
Returns
a time series that maps times to the distances.
Note
The caller will take the ownership of the returned pointer.
std::auto_ptr<te::gm::Geometry> te::st::Trajectory::getGeometry ( te::dt::DateTime t) const

It returns the geometry associated to a given date and time.

If there is no geometry associated to the given date and time, it will use internally its interpolation function.

Parameters
tA date and time.
Returns
A pointer to the geometry associated to the given date and time.
Note
The caller WILL take the ownership of the returned pointer.
std::string te::st::Trajectory::getId ( ) const

It returns the trajectory id.

Returns
The trajectory id.
AbstractTrajectoryInterp* te::st::Trajectory::getInterpolator ( ) const

It returns the interpolator associated to the trajectory.

Returns
A pointer the interpolator associated to the trajectory.
Note
The caller will NOT take the ownership of the returned pointer.
The AbstractTrajectoryInterp points to a singleton.
const TrajectoryObservationSet& te::st::Trajectory::getObservations ( ) const

It returns the trajectory observations.

Returns
A reference to the trajectory observations.
TrajectoryPatch te::st::Trajectory::getPatch ( const te::dt::DateTime dt,
te::dt::TemporalRelation  r = te::dt::DURING 
) const

It returns a trajectory subset that satisfies a given temporal relation.

The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8)

Parameters
dtA given date and time.
rA given temporal relation.
Returns
A patch of the trajectory.
Note
When the temporal relation is DURING, dt must be a time period.
void te::st::Trajectory::getPatches ( const te::gm::Envelope g,
te::gm::SpatialRelation  r,
std::vector< TrajectoryPatch > &  result 
) const

It returns trajectory subsets that satisfy a given spatial relation.

The possible spatial relation is: 1. INTERSECTS

Parameters
gA given envelope.
rA given spatial relation.
resultThe returned patches.
void te::st::Trajectory::getPatches ( const te::gm::Geometry geom,
te::gm::SpatialRelation  r,
std::vector< TrajectoryPatch > &  result 
) const

It returns trajectory subsets that satisfy a given spatial relation.

The possible spatial relation is: 1. INTERSECTS

Parameters
geomA given geometry.
rA given spatial relation.
resultThe returned patches.
void te::st::Trajectory::getPatches ( const te::gm::Envelope e,
te::gm::SpatialRelation  sr,
const te::dt::DateTime dt,
te::dt::TemporalRelation  tr,
std::vector< TrajectoryPatch > &  result 
) const

It returns trajectory subsets that satisfy a given spatial and temporal relation.

The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8)

The possible spatial relation is: 1. INTERSECTS

Parameters
eA given envelope.
rA given spatial relation.
dtA given date and time.
rA given temporal relation.
resultThe returned patches.
void te::st::Trajectory::getPatches ( const te::gm::Geometry geom,
te::gm::SpatialRelation  sr,
const te::dt::DateTime dt,
te::dt::TemporalRelation  tr,
std::vector< TrajectoryPatch > &  result 
) const

It returns trajectory subsets that satisfy a given spatial and temporal relation.

The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8)

The possible spatial relation is: 1. INTERSECTS

Parameters
geomA given geometry.
rA given spatial relation.
dtA given date and time.
rA given temporal relation.
resultThe returned patches.
void te::st::Trajectory::getPatches ( const te::gm::Geometry geom,
te::st::SpatioTemporalRelation  str,
const std::vector< TrajectoryPatch > &  result 
) const

It returns trajectory subsets that satisfy a given spatiotemporal relation.

The possible spatiotemporal relations are:

  1. REACH; 2. EXITS; 3. REACHES; 4. LEAVES
Parameters
geomA given geometry.
srtA given spatiotemporal relation.
resultThe returned patches.
te::gm::Envelope te::st::Trajectory::getSpatialExtent ( ) const

It returns the spatial extent of the trajectory observations.

Returns
The spatial extent of the trajectory observations.
Note
The caller will take the ownership of the output pointer.
std::auto_ptr<te::dt::DateTimePeriod> te::st::Trajectory::getTemporalExtent ( ) const

It returns the temporal extent of the trajectory observations.

Returns
The temporal extent of trajectory observations.
Note
The caller will take the ownership of the output pointer.
Trajectory& te::st::Trajectory::operator= ( const Trajectory other)

Copy assignment operator.

Note
They will share the internal pointers.
The caller has to use the method "clone" to have a deep copy.
void te::st::Trajectory::setId ( const std::string &  id)

It sets the trajectory id.

Parameters
idThe trajectory od.
void te::st::Trajectory::setInterpolator ( AbstractTrajectoryInterp interp)

It sets the interpolator associated to the path.

Parameters
interpA interpolator which is able to estimate geometries in non-observed times.
Note
It will NOT take the ownership of the input pointer.
The AbstractTrajectoryInterp points to a singleton.
std::size_t te::st::Trajectory::size ( ) const

It returns the size of the trajectory observations.

Returns
The observations size of the trajectory.

Member Data Documentation

std::string te::st::Trajectory::m_id
private

The trajectory identification.

Definition at line 461 of file Trajectory.h.

AbstractTrajectoryInterp* te::st::Trajectory::m_interpolator
private

The interpolator used to estimate non-observed times.

Definition at line 460 of file Trajectory.h.

TrajectoryObservationSet te::st::Trajectory::m_observations
private

The trajectory observations.

Definition at line 459 of file Trajectory.h.

TjRTreeShrPtr te::st::Trajectory::m_rtree
private

The RTree to index the trajectory geometries.

Definition at line 462 of file Trajectory.h.


The documentation for this class was generated from the following file: