All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::DateTimePeriod
getTemporalExtent () 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.

Definition at line 44 of file Trajectory.cpp.

References m_rtree.

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

Definition at line 54 of file Trajectory.cpp.

References m_rtree.

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.

Definition at line 64 of file Trajectory.cpp.

References m_rtree.

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

Definition at line 74 of file Trajectory.cpp.

References m_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

Definition at line 84 of file Trajectory.cpp.

References m_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

Definition at line 95 of file Trajectory.cpp.

References te::st::TrajectoryPatch::begin(), te::st::TrajectoryPatch::end(), m_observations, and m_rtree.

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.

Definition at line 114 of file Trajectory.cpp.

te::st::Trajectory::~Trajectory ( )
virtual

Virtual destructor.

Definition at line 550 of file Trajectory.cpp.

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.

Definition at line 173 of file Trajectory.cpp.

Referenced by clone(), and te::st::TrajectoryDataSet::getTrajectory().

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.

Definition at line 182 of file Trajectory.cpp.

te::st::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.

Definition at line 206 of file Trajectory.cpp.

References te::dt::AbstractData::clone().

te::st::TrajectoryIterator te::st::Trajectory::begin ( ) const

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

Returns
The trajectory iterator.

Definition at line 194 of file Trajectory.cpp.

te::st::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.

Definition at line 134 of file Trajectory.cpp.

References add().

te::st::TrajectoryIterator te::st::Trajectory::end ( ) const

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

Returns
The trajectory iterator.

Definition at line 200 of file Trajectory.cpp.

Referenced by getPatches().

std::auto_ptr< te::st::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.

Definition at line 524 of file Trajectory.cpp.

References te::dt::AbstractData::clone(), and getGeometry().

std::auto_ptr< te::st::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.

Definition at line 543 of file Trajectory.cpp.

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.

Definition at line 213 of file Trajectory.cpp.

References te::dt::AbstractData::clone().

Referenced by getDistance().

std::string te::st::Trajectory::getId ( ) const

It returns the trajectory id.

Returns
The trajectory id.

Definition at line 163 of file Trajectory.cpp.

te::st::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.

Definition at line 153 of file Trajectory.cpp.

const te::st::TrajectoryObservationSet & te::st::Trajectory::getObservations ( ) const

It returns the trajectory observations.

Returns
A reference to the trajectory observations.

Definition at line 148 of file Trajectory.cpp.

Referenced by te::st::NearestGeometryAtTimeInterp::estimate().

te::st::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.

Definition at line 237 of file Trajectory.cpp.

References te::dt::AFTER, te::dt::BEFORE, te::dt::AbstractData::clone(), te::dt::DURING, te::st::TrajectoryPatch::end(), and te::dt::EQUALS.

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.

Definition at line 297 of file Trajectory.cpp.

References te::gm::INTERSECTS.

Referenced by getPatches().

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.

Definition at line 351 of file Trajectory.cpp.

References te::gm::Geometry::getMBR(), te::gm::INTERSECTS, and te::gm::Geometry::intersects().

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.

Definition at line 415 of file Trajectory.cpp.

References end(), getPatches(), and te::st::TrajectoryIterator::getTime().

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.

Definition at line 467 of file Trajectory.cpp.

References end(), getPatches(), and te::st::TrajectoryIterator::getTime().

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.

Definition at line 519 of file Trajectory.cpp.

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.

Definition at line 231 of file Trajectory.cpp.

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.

Definition at line 223 of file Trajectory.cpp.

References te::dt::GetTemporalExtent().

te::st::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.

Definition at line 122 of file Trajectory.cpp.

References m_id, m_interpolator, m_observations, and m_rtree.

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

It sets the trajectory id.

Parameters
idThe trajectory od.

Definition at line 168 of file Trajectory.cpp.

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.

Definition at line 158 of file Trajectory.cpp.

std::size_t te::st::Trajectory::size ( void  ) const

It returns the size of the trajectory observations.

Returns
The observations size of the trajectory.

Definition at line 189 of file Trajectory.cpp.

Member Data Documentation

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

The trajectory identification.

Definition at line 461 of file Trajectory.h.

Referenced by operator=().

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

The interpolator used to estimate non-observed times.

Definition at line 460 of file Trajectory.h.

Referenced by operator=().

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

The trajectory observations.

Definition at line 459 of file Trajectory.h.

Referenced by operator=(), and Trajectory().

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

The RTree to index the trajectory geometries.

Definition at line 462 of file Trajectory.h.

Referenced by operator=(), and Trajectory().


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