TrajectoryDataSet.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file TrajectoryDataSet.h
22 
23  \brief This file contains a class to represent a trajectory data set.
24  */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_TRAJECTORYDATASET_H
27 #define __TERRALIB_ST_INTERNAL_TRAJECTORYDATASET_H
28 
29 //ST
30 #include "../../Config.h"
31 
32 // Boost
33 #include <boost/noncopyable.hpp>
34 
35 //STL
36 #include <vector>
37 #include <memory>
38 
39 // Forward declarations
40 namespace te { namespace dt { class DateTime; class DateTimePeriod; class DateTimeProperty;} }
41 namespace te { namespace gm { class Geometry; class Envelope; class GeometryProperty; } }
42 
43 namespace te
44 {
45  namespace st
46  {
47  // Forward declarations
48  class ObservationDataSet;
49  class ObservationDataSetType;
50  class Trajectory;
51  class AbstractTrajectoryInterp;
52  class TrajectoryDataSetLayer;
53 
54  /*!
55  \class TrajectoryDataSet
56 
57  \brief A class to represent a trajectory data set.
58 
59  This class represents a view on a DataSet that
60  contains observations of a trajectory.
61 
62  A trajectory represents the variation of spatial locations or boundaries of an
63  object over time. It is composed of an observation data set where one
64  observed property is a geometry.
65  The observations have a fixed object identity and measured geometries at controlled
66  times.
67 
68  \ingroup st
69 
70  \sa ObservationDataSet ObservationDatasSetType TrajectoryDataSetType
71  */
72  class TESTEXPORT TrajectoryDataSet : public boost::noncopyable
73  {
74  friend class TrajectoryDataSetLayer;
75 
76  public:
77 
78  /*! \name Constructor */
79  //@{
80 
81  /*!
82  \brief Constructor.
83 
84  \param ds The data set that contains the trajectory observations.
85  \param type The observation data set type.
86 
87  \note It will take the ownership of the input pointer.
88  */
90 
91  /*!
92  \brief Constructor.
93 
94  \param ds The data set that contains the trajectory observations.
95  \param type The observation data set type.
96  \param id The trajectory id.
97 
98  \note It will take the ownership of the input pointer.
99  */
101  const std::string& id);
102 
103  /*!
104  \brief Constructor.
105 
106  \param obs The data set that contains the trajectory observations.
107  \param id The trajectory id
108 
109  \note It will take the ownership of the input pointer.
110  */
111  TrajectoryDataSet(ObservationDataSet* obs, const std::string& id);
112  //@}
113 
114  /*!
115  \brief It returns the data set that contains the trajectory observations.
116 
117  \return A reference to the data set that contains the trajectory observations.
118 
119  \note The caller will NOT take the ownership of the input pointer.
120  */
121  ObservationDataSet* getObservationSet() const;
122 
123  /*!
124  \brief It returns the identifier associated to the trajectory.
125 
126  \return The identifier associated to the trajectory.
127  */
128  std::string getId() const;
129 
130  /*!
131  \brief It sets the identifier associated to the trajectory.
132 
133  \param id The identifier associated to the trajectory.
134  */
135  void setId(const std::string& id);
136 
137  /*!
138  \brief It returns the size of the trajectory observation set.
139 
140  \return The observation set size of the trajectory.
141  */
142  std::size_t size() const;
143 
144  /*! \name Methods to traverse the trajectory observations and to check the
145  internal cursor pointer*/
146  //@{
147  bool moveNext();
148 
149  bool movePrevious();
150 
151  bool moveFirst();
152 
153  bool moveBeforeFirst();
154 
155  bool moveLast();
156 
157  bool isAtBegin() const;
158 
159  bool isBeforeBegin() const;
160 
161  bool isAtEnd() const;
162 
163  bool isAfterEnd() const;
164  //@}
165 
166  /*! \name Methods to get values pointed by the internal cursor. */
167  //@{
168  /*!
169  \brief It returns the geometry pointed by the internal cursor.
170 
171  \return A pointer to the geometry pointed by the internal cursor.
172 
173  \note The caller will take the ownership of the returned pointer.
174  */
175  std::auto_ptr<te::gm::Geometry> getGeometry() const;
176 
177  /*!
178  \brief It returns the time pointed by the internal cursor.
179 
180  \return A pointer to the time pointed by the internal cursor.
181 
182  \note The caller will take the ownership of the returned pointer.
183  */
184  std::auto_ptr<te::dt::DateTime> getTime() const;
185  //@}
186 
187  /*!
188  \brief It returns the temporal extent of the trajectory observations.
189 
190  \return The temporal extent of the trajectory observations.
191 
192  \note The caller will NOT take the ownership of the output pointer.
193  */
194  const te::dt::DateTimePeriod* getTemporalExtent() const;
195 
196  /*!
197  \brief It returns the spatial extent of the trajectory observations.
198 
199  \return The spatial extent of the trajectory observations.
200  */
201  const te::gm::Geometry* getSpatialExtent() const;
202 
203  /*!
204  \brief It returns the trajectory from the DataSet.
205 
206  This method encapsulates all observations of this DataSet as a
207  Trajectory type associated to a given interpolator.
208 
209  \return The trajectory associated to a given interpolator.
210 
211  \note The caller will take the ownership of the returned pointer.
212  \note It uses the method moveNext() internally. So, after calling this method,
213  the internal cursor will point to the end of the DataSet.
214  */
215  std::auto_ptr<Trajectory> getTrajectory(AbstractTrajectoryInterp* interp);
216 
217  /*!
218  \brief It returns the trajectory from the DataSet.
219 
220  This method encapsulates all observations of this DataSet as a
221  Trajectory type associated to a NearestGeometryAtTimeInterp interpolator.
222 
223  \return The trajectory associated to a NearestGeometryAtTimeInterp interpolator.
224 
225  \note The caller will take the ownership of the returned pointer.
226  \note It uses the method moveNext() internally. So, after calling this method,
227  the internal cursor will point to the end of the DataSet.
228  */
229  std::auto_ptr<Trajectory> getTrajectory();
230 
231  /*!
232  \brief It returns the trajectory geometry property.
233 
234  \return The trajectory geometry property.
235 
236  \note The caller will NOT take the ownership of the returned pointer.
237  */
239 
240  /*!
241  \brief It returns the trajectory datetime property.
242 
243  \return The trajectory datetime property.
244 
245  \note The caller will NOT take the ownership of the returned pointer.
246  */
247  const te::dt::DateTimeProperty* getTimeProperty() const{return 0;}
248 
249  /*! \brief Virtual destructor. */
250  virtual ~TrajectoryDataSet();
251 
252  protected:
253 
254  /*!
255  \brief It releases all internal pointers, returning its internal DataSet and invalidating itself
256  \return A pointer to the internal DataSet that contains the observations.
257 
258  \note This method is used when the user is interested only in its internal DataSet
259  \note The caller will take the ownership of the returned pointer.
260  */
261  std::auto_ptr<te::da::DataSet> release();
262 
263  private:
264  std::auto_ptr<ObservationDataSet> m_obsDs; //!< The data set that contains the trajectory observations
265  std::string m_id; //!< The trajectory identification.
266  };
267  } // end namespace st
268 } // end namespace te
269 
270 #endif // __TERRALIB_ST_INTERNAL_TRAJECTORYDATASET_H
271 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
Geometric property.
A class to represent a DataSet that contains observations.
std::string m_id
The trajectory identification.
const te::dt::DateTimeProperty * getTimeProperty() const
It returns the trajectory datetime property.
An abstract class for an interpolation function or interpolator that estimates geometries at non-obse...
URI C++ Library.
std::auto_ptr< ObservationDataSet > m_obsDs
The data set that contains the trajectory observations.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A class to represent a trajectory data set.
const te::gm::GeometryProperty * getGeometryProperty() const
It returns the trajectory geometry property.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
An abstract class to represent a period of date and time.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
A layer with reference to a dataset that contains trajectories.
A class that contains complemental DataSetType information about a DataSet that holds observations...