PrintTrajectory.cpp
Go to the documentation of this file.
1 // Examples
2 #include "STExamples.h"
3 
4 // TerraLib
5 #include <terralib/dataaccess.h>
6 #include <terralib/datatype.h>
7 #include <terralib/geometry.h>
8 #include <terralib/st.h>
9 
10 // STL
11 #include <iostream>
12 
13 void PrintTrajectory(boost::ptr_vector<te::st::Trajectory>& input)
14 {
15  for(std::size_t i=0; i<input.size(); ++i)
16  {
17  std::cout << "Printing observations of the trajectory " << i << " :" << std::endl;
18  PrintTrajectory(&input[i]);
19  }
20 }
21 
23 {
24  if(tj == 0)
25  {
26  std::cout << "Trajectory is NULL!" << std::endl;
27  return;
28  }
29 
31 
32  std::cout << "Trajectory observations: " << std::endl;
33 
35  while(it != tj->end())
36  {
37  std::cout << "Date/Time: " << it.getTime()->toString() << std::endl;
38  std::cout << "Geometry: " << it.getGeometry()->toString() << std::endl << std::endl;
39  ++it;
40  }
41 }
42 
44 {
45  te::st::TrajectoryIterator it = tjPatch.begin();
46  te::st::TrajectoryIterator itEnd = tjPatch.end();
47  while(it != itEnd)
48  {
49  std::cout << "Date and Time: " << it.getTime()->toString() << std::endl;
50  std::cout << "Geometry: " << it.getGeometry()->toString() << std::endl << std::endl;
51  ++it;
52  }
53 }
54 
55 void PrintTrajectoryInfo(boost::ptr_vector<te::st::Trajectory>& input)
56 {
57  for(std::size_t i=0; i<input.size(); ++i)
58  {
59  std::cout << "Printing information about the trajectory " << i << " :" << std::endl;
60  PrintTrajectoryInfo(&input[i]);
61  }
62 }
63 
65 {
66  if(tj == 0)
67  {
68  std::cout << "Trajectory is NULL!" << std::endl;
69  return;
70  }
71 
72  std::cout << "Trajectory id: " << tj->getId() << std::endl;
73  std::cout << "Trajectory spatial extent: " << tj->getSpatialExtent().getLowerLeftX() << std::endl;
74  std::cout << "Trajectory temporal extent: " << tj->getTemporalExtent()->toString() << std::endl;
75 }
76 
This file contains include headers for the Data Type module of TerraLib.
te::gm::Geometry * getGeometry() const
It returns the geometry pointed by the internal cursor.
A struct to represent a patch or a continuous piece of a trajectory.
TrajectoryIterator end() const
It returns an iterator that points to the end of the trajectory.
Definition: Trajectory.cpp:190
TrajectoryIterator end() const
Examples on how to load/manipulate st types.
void PrintTrajectory(boost::ptr_vector< te::st::Trajectory > &input)
It prints all observations of the trajectory (PrintTrajectory.cpp)
virtual std::string toString() const =0
It returns the data value in a string notation.
std::string getId() const
It returns the trajectory id.
Definition: Trajectory.cpp:153
void PrintTrajectoryInfo(boost::ptr_vector< te::st::Trajectory > &input)
It prints information about the trajectory: its spatial and temporal extent (PrintTrajectory.cpp)
std::unique_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the trajectory observations.
Definition: Trajectory.cpp:213
te::gm::Envelope getSpatialExtent() const
It returns the spatial extent of the trajectory observations.
Definition: Trajectory.cpp:221
te::dt::DateTime * getTime() const
It returns the datetime pointed by the internal cursor.
TrajectoryIterator begin() const
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
std::string toString() const
It returns the data value in a WKT representation.
This file contains include headers for the TerraLib ST module.
void PrintTrajectoryPatch(te::st::TrajectoryPatch &tjPatch)
A class to represent trajectory.
Definition: Trajectory.h:75
This file contains include headers for the Vector Geometry model of TerraLib.
A class to traverse the observations of a trajectory.
This file contains include headers for the Data Access module of TerraLib.
TrajectoryIterator begin() const
It returns an iterator that points to the first observation of the trajectory.
Definition: Trajectory.cpp:184