TrajectoryIntersection.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/common.h>
7 #include <terralib/datatype.h>
8 #include <terralib/geometry.h>
9 #include <terralib/st.h>
10 
11 // STL
12 #include <iostream>
13 
15 {
16  if(tj == 0)
17  {
18  std::cout << "Trajectory is NULL!" << std::endl;
19  return;
20  }
21 
22  if(geom == 0)
23  {
24  std::cout << "Geometry is NULL!" << std::endl;
25  return;
26  }
27 
28  std::vector<te::st::TrajectoryPatch> result;
29 
30  //It returns the patches of the trajectory that intersects the given geometry
31  tj->getPatches(*geom, te::gm::INTERSECTS, result);
32 
33  //Print the returned patches
34  for(std::size_t i = 0; i<result.size(); ++i)
35  {
36  std::cout << "Printing trajectory patch " << i << ":" << std::endl;
37  PrintTrajectoryPatch(result[i]);
38  }
39 }
40 
This file contains include headers for the Data Type module of TerraLib.
void TrajectoryIntersection(te::st::Trajectory *tj, te::gm::Geometry *geom)
It calculates the intersection between a trajectory and a geometry (TrajectoryInstersection.cpp).
Examples on how to load/manipulate st types.
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.
Definition: Trajectory.cpp:287
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
This file contains include headers for the TerraLib Common Runtime module.
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.
This file contains include headers for the Data Access module of TerraLib.