PrintTrajectoryDataSet.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 PrintTrajectoryDataSet(boost::ptr_vector<te::st::TrajectoryDataSet>& output)
14 {
15  for(std::size_t i=0; i<output.size(); ++i)
16  {
17  std::cout << "Printing observations of the trajectory data set" << i << " :" << std::endl;
18  PrintTrajectoryDataSet(&output[i]);
19  }
20 }
21 
23 {
24  if(output == 0)
25  {
26  std::cout << "Trajectory Data Set is NULL!" << std::endl;
27  return;
28  }
29 
31 
32  std::cout << "Trajectory observations: " << std::endl;
33 
34  output->moveBeforeFirst();
35 
36  while(output->moveNext())
37  {
38  std::unique_ptr<te::dt::DateTime> time = output->getTime();
39  std::unique_ptr<te::gm::Geometry> geom = output->getGeometry();
40 
41  std::cout << "Date and Time: " << time->toString() << std::endl;
42  std::cout << "Geometry: " << geom->toString() << std::endl << std::endl;
43  }
44 }
45 
46 void PrintTrajectoryDataSetInfo(boost::ptr_vector<te::st::TrajectoryDataSet>& output)
47 {
48  for(std::size_t i=0; i<output.size(); ++i)
49  {
50  std::cout << "Printing information about the trajectory data set " << i << " :" << std::endl;
51  PrintTrajectoryDataSetInfo(&output[i]);
52  }
53 }
54 
56 {
57  const te::dt::DateTimePeriod* textent = output->getTemporalExtent();
58  std::cout << "Temporal Extent: " << textent->toString() << std::endl;
59 
60  //const te::gm::Envelope sextent = output->getSpatialExtent();
61  //std::cout << "Spatial Extent: " << sextent.getLowerLeftX() << std::endl;
62 }
63 
This file contains include headers for the Data Type module of TerraLib.
void PrintTrajectoryDataSet(boost::ptr_vector< te::st::TrajectoryDataSet > &output)
It prints all observations of the trajectory data set (PrintTrajectoryDataSet.cpp) ...
const te::dt::DateTimePeriod * getTemporalExtent() const
It returns the temporal extent of the trajectory observations.
Examples on how to load/manipulate st types.
virtual std::string toString() const =0
It returns the data value in a string notation.
std::unique_ptr< te::dt::DateTime > getTime() const
It returns the time pointed by the internal cursor.
A class to represent a trajectory data set.
std::unique_ptr< te::gm::Geometry > getGeometry() const
It returns the geometry pointed by the internal cursor.
An abstract class to represent a period of date and time.
void PrintTrajectoryDataSetInfo(boost::ptr_vector< te::st::TrajectoryDataSet > &output)
It prints information about the trajectory data set: its spatial and temporal extent (PrintTrajectory...
This file contains include headers for the TerraLib ST module.
This file contains include headers for the Vector Geometry model of TerraLib.
This file contains include headers for the Data Access module of TerraLib.