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... | |
Trajectory * | clone () const |
It returns a clone of this trajectory. More... | |
std::auto_ptr< TimeSeries > | getDistance (const Trajectory &other) const |
It returns the distance between two trajectories. More... | |
std::auto_ptr< TimeSeries > | getDistance (const te::gm::Geometry &geom) |
It returns the distance between the trajectory and a given geometry. More... | |
std::auto_ptr< te::gm::Geometry > | getGeometry (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... | |
AbstractTrajectoryInterp * | getInterpolator () const |
It returns the interpolator associated to the trajectory. More... | |
const TrajectoryObservationSet & | getObservations () 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... | |
Trajectory & | operator= (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... | |
AbstractTrajectoryInterp * | m_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... | |
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.
Definition at line 75 of file Trajectory.h.
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.
id | The 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.
interp | The interpolator associated to the trajectory. |
id | The 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.
obs | The trajectory observations. |
id | The trajectory id. |
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.
obs | The trajectory observations. |
interp | The interpolator associated to the trajectory. |
id | The trajectory id. |
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.
patch | The given patch. |
interp | The interpolator |
id | The 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.
Definition at line 114 of file Trajectory.cpp.
|
virtual |
Virtual destructor.
Definition at line 550 of file Trajectory.cpp.
void te::st::Trajectory::add | ( | te::dt::DateTime * | time, |
te::gm::Geometry * | geom | ||
) |
It adds an observation (time and geometry) into the trajectory.
time | A pointer to the time. |
data | A pointer to the geometry. |
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.
p | A pair of date and time. |
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.
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.
Definition at line 194 of file Trajectory.cpp.
te::st::Trajectory * te::st::Trajectory::clone | ( | ) | const |
It returns a clone of this trajectory.
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.
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.
other | The other trajectory. |
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.
geom | A given geometry. |
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.
t | A date and time. |
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.
Definition at line 163 of file Trajectory.cpp.
te::st::AbstractTrajectoryInterp * te::st::Trajectory::getInterpolator | ( | ) | const |
It returns the interpolator associated to the trajectory.
Definition at line 153 of file Trajectory.cpp.
const te::st::TrajectoryObservationSet & te::st::Trajectory::getObservations | ( | ) | const |
It returns 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)
dt | A given date and time. |
r | A given temporal relation. |
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
g | A given envelope. |
r | A given spatial relation. |
result | The 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
geom | A given geometry. |
r | A given spatial relation. |
result | The 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
e | A given envelope. |
r | A given spatial relation. |
dt | A given date and time. |
r | A given temporal relation. |
result | The 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
geom | A given geometry. |
r | A given spatial relation. |
dt | A given date and time. |
r | A given temporal relation. |
result | The 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:
geom | A given geometry. |
srt | A given spatiotemporal relation. |
result | The 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.
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.
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.
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.
id | The 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.
interp | A interpolator which is able to estimate geometries in non-observed times. |
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.
Definition at line 189 of file Trajectory.cpp.
|
private |
The trajectory identification.
Definition at line 461 of file Trajectory.h.
Referenced by operator=().
|
private |
The interpolator used to estimate non-observed times.
Definition at line 460 of file Trajectory.h.
Referenced by operator=().
|
private |
The trajectory observations.
Definition at line 459 of file Trajectory.h.
Referenced by operator=(), and Trajectory().
|
private |
The RTree to index the trajectory geometries.
Definition at line 462 of file Trajectory.h.
Referenced by operator=(), and Trajectory().