All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STDataLoaderImpl.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 STDataLoaderImpl.h
22 
23  \brief This file contains an abstract class responsible for loading
24  spatiotemporal data from data sources.
25 */
26 
27 #ifndef __TERRALIB_ST_INTERNAL_STDATALOADERIMPL_H
28 #define __TERRALIB_ST_INTERNAL_STDATALOADERIMPL_H
29 
30 //TerraLib
31 #include "../../common/Enums.h"
32 #include "../../geometry/Enums.h"
33 #include "../../geometry/Envelope.h"
34 #include "../../datatype/Enums.h"
35 
36 //ST
37 #include "../Config.h"
38 
39 //STL
40 #include <memory>
41 
42 //Boost
43 #include <boost/ptr_container/ptr_vector.hpp>
44 
45 // Forward declarations
46 namespace te { namespace gm { class Geometry; } }
47 namespace te { namespace dt { class DateTime; class DateTimePeriod; } }
48 
49 namespace te
50 {
51  namespace st
52  {
53  // Forward declarations
54  class ObservationDataSet;
55  class TrajectoryDataSet;
56  class TimeSeriesDataSet;
57  class CoverageSeriesDataSet;
58  class ObservationDataSetInfo;
59  class TrajectoryDataSetInfo;
60  class TimeSeriesDataSetInfo;
61  class CoverageSeriesDataSetInfo;
62  class Trajectory;
63  class TimeSeries;
64  class CoverageSeries;
65 
66  /*!
67  \class STDataLoaderImpl
68 
69  \brief An abstract class responsible for loading spatiotemporal data
70  from data sources.
71 
72  \note The methods of this class can throw an Exception when internal errors occur.
73 
74  \sa ObservationDataSet ObservationDataSetInfo
75  \sa TrajectoryDataSet TrajectoryDataSetInfo
76  \sa CoverageSeriesDataSet CoverageSeriesDataSetInfo
77  */
79  {
80  public:
81 
82  /*! \brief Empty constructor */
84 
85  /*! \name Operations for loading ObservationDataSet */
86  //@{
87 
88  /*!
89  \brief It returns a ObservationDataSet, that is, a DataSet that contains observations.
90 
91  \param info Information about the DataSource which the observation are from and
92  the DataSet which contains the observations.
93  \param travType The traverse type associated to the returned dataset.
94 
95  \return A pointer to a new ObservationDataSet.
96 
97  \note The caller will take the ownership of the returned pointer.
98  \note It can throw an Exception when internal errors occur.
99  */
100  virtual std::auto_ptr<ObservationDataSet> getDataSet(const ObservationDataSetInfo& info,
102 
103  /*!
104  \brief It returns a data set with observations whose observed geometries satisfy a
105  given spatial relation.
106 
107  \param info Information about the DataSource which the observation are from and
108  the DataSet which contains the observations.
109  \param e A given envelope.
110  \param r A given spatial relation.
111  \param travType The traverse type associated to the returned dataset.
112 
113  \return A pointer to a new ObservationDataSet.
114 
115  \note The caller will take the ownership of the returned pointer.
116  \note It can throw an Exception when internal errors occur.
117  */
118  virtual std::auto_ptr<ObservationDataSet> getDataSet(const ObservationDataSetInfo& info, const te::gm::Envelope& e,
121 
122  /*!
123  \brief It returns a data set with observations whose observed geometries satisfy a
124  given spatial relation.
125 
126  The possible spatial relations implemented here are: INTERSECTS
127 
128  \param info Information about the DataSource which the observation are from and
129  the DataSet which contains the observations.
130  \param geom A given geometry.
131  \param r A given spatial relation.
132  \param travType The traverse type associated to the returned dataset.
133 
134  \return A pointer to a new ObservationDataSet.
135 
136  \note The caller will take the ownership of the returned pointer.
137  \note It can throw an Exception when internal errors occur.
138  */
139  virtual std::auto_ptr<ObservationDataSet> getDataSet(const ObservationDataSetInfo& info, const te::gm::Geometry& geom,
142 
143  /*!
144  \brief It returns a data set with observations whose phenomenon times satisfy a
145  given temporal relation.
146 
147  The possible temporal relations are: 1. AFTER;
148  2. AFTER | EQUALS; 3. BEFORE; 4. BEFORE | EQUALS; 5. DURING; 6. EQUALS
149 
150  \param info Information about the DataSource which the observation are from and
151  the DataSet which contains the observations.
152  \param dt A given datetime.
153  \param r A given temporal relation.
154  \param travType The traverse type associated to the returned dataset.
155 
156  \return A pointer to a new ObservationDataSet.
157 
158  \note The caller will take the ownership of the returned pointer.
159  \note When the temporal relation is DURING, dt must be a time period.
160  \note It can throw an Exception when internal errors occur.
161  */
162  virtual std::auto_ptr<ObservationDataSet> getDataSet(const ObservationDataSetInfo& info,
165 
166  /*!
167  \brief It returns a data set with observations whose observed geometries satisfy a
168  given spatial relation and phenomenon times satisfy a given temporal relation.
169 
170  The possible spatial relations are: INTERSECTS
171  The possible temporal relations are: 1. AFTER;
172  2. AFTER | EQUALS; 3. BEFORE; 4. BEFORE | EQUALS; 5. DURING; 6. EQUALS
173 
174  \param info Information about the DataSource which the observation are from and
175  the DataSet which contains the observations.
176  \param geom A given geometry.
177  \param sr A given spatial relation.
178  \param dt A given datetime.
179  \param tr A given temporal relation.
180  \param travType The traverse type associated to the returned dataset.
181 
182  \return A pointer to a new ObservationDataSet.
183 
184  \note The caller will take the ownership of the returned pointer.
185  \note It will NOT take the ownership of the given pointers.
186  \note When the temporal relation is DURING, dt must be a time period.
187  \note It can throw an Exception when internal errors occur.
188  */
189  virtual std::auto_ptr<ObservationDataSet> getDataSet(const ObservationDataSetInfo& info,
193  //@}
194 
195  /*! \name Operations for loading TrajectoryDataSet */
196  //@{
197 
198  /*!
199  \brief It returns the information about all trajectories that exist in a single DataSet.
200 
201  The information about the DataSource and DataSet that contains trajectories is defined
202  as a TrajectoryDataSetInfo (input parameter).
203 
204  The information about each trajectory (its correct id) is returned as a
205  TrajectoryDataSetInfo of the parameter output.
206  These results can be used to create TrajectoryDataSetLayers.
207 
208  \param input The information about the DataSource and DataSet that contains trajectories
209  \param output The information about each trajectory (its correct id).
210 
211  \note It can throw an Exception when internal errors occur.
212  */
213  virtual void getInfo( const TrajectoryDataSetInfo& input,
214  std::vector<TrajectoryDataSetInfo>& output) = 0;
215 
216  /*!
217  \brief It returns a data set with observations of a trajectory.
218 
219  When the DataSet contains more than one trajectory, the info parameter
220  (TrajectoryDataSetInfo) must contain the id of the desire trajectory that
221  must be returned as a TrajectoryDataSet.
222 
223  \param info Information about the DataSource which the observations of a trajectory
224  are from and the DataSet which contains these observations.
225  \param travType The traverse type associated to the returned datasets.
226  \param rwRole The read and write permission associated to the returned datasets.
227  \return The returned TrajectoryDataSet.
228 
229  \note The info must have the id of the desire trajectory
230  \note The caller will take the ownership of the returned pointer.
231  \note It can throw an Exception when internal errors occur.
232  */
233  virtual std::auto_ptr<TrajectoryDataSet> getDataSet(const TrajectoryDataSetInfo& info,
235 
236  /*!
237  \brief It returns patches of a trajectory whose geometries
238  satisfy a given spatial relation.
239 
240  When the DataSet contains more than one trajectory, the info parameter
241  (TrajectoryDataSetInfo) must contain the id of the desire trajectory that
242  must be returned as a TrajectoryDataSet.
243 
244  The possible spatial relations implemented here are: INTERSECTS
245 
246  \param info Information about the DataSource which the observations of a trajectory
247  are from and the DataSet which contains these observations.
248  \param geom A given geometry.
249  \param r A given spatial relation.
250  \param travType The traverse type associated to the returned dataset.
251 
252  \return The returned trajectoy data set.
253 
254  \note The caller will take the ownership of the returned pointer.
255  \note It can throw an Exception when internal errors occur.
256  */
257  virtual std::auto_ptr<TrajectoryDataSet> getDataSet(const TrajectoryDataSetInfo& info,
260 
261  /*!
262  \brief It returns patches of a trajectory whose geometries
263  satisfy a given spatial relation.
264 
265  When the DataSet contains more than one trajectory, the info parameter
266  (TrajectoryDataSetInfo) must contain the id of the desire trajectory that
267  must be returned as a TrajectoryDataSet.
268 
269  \param info Information about the DataSource which the observations of a trajectory are from
270  and the DataSet which contains the observations.
271  \param e A given envelope.
272  \param r A given spatial relation.
273  \param travType The traverse type associated to the returned dataset.
274 
275  \return The returned trajectoy data set.
276 
277  \note The caller will take the ownership of the returned pointer.
278  \note It can throw an Exception when internal errors occur.
279  */
280  virtual std::auto_ptr<TrajectoryDataSet> getDataSet(const TrajectoryDataSetInfo& info,
283 
284  /*!
285  \brief It returns a data set with observations of trajectories whose times
286  satisfy a given temporal relation.
287 
288  When the DataSet contains more than one trajectory, the info parameter
289  (TrajectoryDataSetInfo) must contain the id of the desire trajectory that
290  must be returned as a TrajectoryDataSet.
291 
292  The possible temporal relations are: 1. AFTER;
293  2. AFTER | EQUALS; 3. BEFORE; 4. BEFORE | EQUALS; 5. DURING; 6. EQUALS
294 
295  \param info Information about the DataSource which the observation of trajectpries
296  are from and the DataSet which contains the observations.
297  \param dt A given datetime.
298  \param r A given temporal relation.
299  \param travType The traverse type associated to the returned dataset.
300 
301  \return A pointer to a new TrajectoryDataSet.
302 
303  \note The caller will take the ownership of the returned pointer.
304  \note When the temporal relation is DURING, dt must be a time period.
305  \note It can throw an Exception when internal errors occur.
306  */
307  virtual std::auto_ptr<TrajectoryDataSet> getDataSet(const TrajectoryDataSetInfo& info,
310 
311  /*!
312  \brief It returns patches of a trajectory whose geometries
313  satisfy a given spatial relation and times satisfy a given temporal relation.
314 
315  When the DataSet contains more than one trajectory, the info parameter
316  (TrajectoryDataSetInfo) must contain the id of the desire trajectory that
317  must be returned as a TrajectoryDataSet.
318 
319  The possible spatial relations are: INTERSECTS
320  The possible temporal relations are: 1. AFTER;
321  2. AFTER | EQUALS; 3. BEFORE; 4. BEFORE | EQUALS; 5. DURING; 6. EQUALS
322 
323  \param info Information about the DataSource which the observations of trajectories
324  are from and the DataSet which contains these observations.
325  \param geom A given geometry.
326  \param sr A given spatial relation.
327  \param dt A given datetime.
328  \param tr A given temporal relation.
329  \param travType The traverse type associated to the returned dataset.
330 
331  \return The returned trajectoy data set.
332 
333  \note The caller will take the ownership of the returned pointer.
334  \note It will NOT take the ownership of the given pointers.
335  \note When the temporal relation is DURING, dt must be a time period.
336  \note It can throw an Exception when internal errors occur.
337  */
338  virtual std::auto_ptr<TrajectoryDataSet> getDataSet(const TrajectoryDataSetInfo& info,
342  //@}
343 
344  /*! \name Operations for loading TimeSeriesDataSet */
345  //@{
346 
347  /*!
348  \brief It returns the information about all time series that exist in a single DataSet.
349 
350  The information about the DataSource and DataSet that contains time series is defined
351  as a TimeSeriesDataSetInfo (input parameter).
352 
353  The information about each time series (its correct id) is returned as a
354  TimeSeriesDataSetInfo of the parameter output.
355  These results can be used to create TimeSeriesDataSetLayers.
356 
357  \param input The information about the DataSource and DataSet that contains time series
358  \param output The information about each time series (its correct id).
359 
360  \note It can throw an Exception when internal errors occur.
361  */
362  virtual void getInfo( const TimeSeriesDataSetInfo& input,
363  std::vector<TimeSeriesDataSetInfo>& output) = 0;
364 
365  /*!
366  \brief It returns a data set with observations of time series.
367 
368  When the DataSet contains more than one time series, the info parameter
369  (TimeSeriesDataSetInfo) must contain the id of the desire time series that
370  must be returned as a TimeSeriesDataSet.
371 
372  \param info Information about the DataSource which the observations of a time series
373  are from and the DataSet which contains these observations.
374  \param travType The traverse type associated to the returned datasets.
375 
376  \return The returned TrajectoryDataSet.
377 
378  \note The caller will take the ownership of the returned pointer.
379  \note It can throw an Exception when internal errors occur.
380  */
381  virtual std::auto_ptr<TimeSeriesDataSet> getDataSet(const TimeSeriesDataSetInfo& info,
383 
384  /*!
385  \brief It returns a data set with observations of time series whose times
386  satisfy a given temporal relation.
387 
388  When the DataSet contains more than one time series, the info parameter
389  (TimeSeriesDataSetInfo) must contain the id of the desire time series that
390  must be returned as a TimeSeriesDataSet.
391 
392  The possible temporal relations are: 1. AFTER;
393  2. AFTER | EQUALS; 3. BEFORE; 4. BEFORE | EQUALS; 5. DURING; 6. EQUALS
394 
395  \param info Information about the DataSource which the observation of time series
396  are from and the DataSet which contains the observations.
397  \param dt A given datetime.
398  \param r A given temporal relation.
399  \param travType The traverse type associated to the returned dataset.
400 
401  \return A pointer to a new TimeSeriesDataSet.
402 
403  \note The caller will take the ownership of the returned pointer.
404  \note When the temporal relation is DURING, dt must be a time period.
405  \note It can throw an Exception when internal errors occur.
406  */
407  virtual std::auto_ptr<TimeSeriesDataSet> getDataSet(const TimeSeriesDataSetInfo& info,
410  //@}
411 
412  /*! \name Operations for loading spatiotemporal data types
413  (TimeSeries, Trajetory, CoverageSeries) directly from data sources, without using
414  DataSets. */
415  //@{
416 
417  /*!
418  \brief It returns a coverage series.
419 
420  \param info Information about the DataSource which the observations of a coverage series
421  are from and the data sets which contain these observations.
422 
423  \return The returned CoverageSeries.
424 
425  \note The caller will take the ownership of the returned pointer.
426  \note It can throw an Exception when internal errors occur.
427  */
428  //virtual std::auto_ptr<CoverageSeries> getCoverageSeries(const CoverageSeriesDataSetInfo& info) = 0;
429 
430  /*!
431  \brief It returns a time series associated to a point of a coverage series.
432 
433  If info contains information about raster coverages and its associated data source
434  supports raster data type, this function is executed by the data source.
435  Otherwise, it is executed in two steps: (1) creating a CoverageSeries type
436  and (2) using its method getTimeSeries.
437 
438  \param info Information about the DataSource which the observations of a coverage series
439  are from and the data sets which contain these observations.
440  \param p A given point.
441 
442  \return The returned CoverageSeries.
443 
444  \note The caller will take the ownership of the returned pointer.
445  \note It can throw an Exception when internal errors occur.
446 
447  \\TO DO: (1) vantagem de usar o DataSetCoverageDataSet é ele fica armazenado no driver
448  \\em memória (stmem) ao invés de toda hora gerar o CoverageSeries para cada ponto
449  \\que queremos extrair a time series.
450  */
451  //virtual std::auto_ptr<CoverageSeries> getTimeSeries(const CoverageSeriesDataSetInfo& info,
452  // const te::gm::Point& p) = 0;
453  //@}
454 
455  /*! \name Operations for loading temporal and spatial extent */
456  //@{
457 
458  /*!
459  \brief It returns the temporal extent of the data set with observations.
460 
461  \return The temporal extent of the observations.
462 
463  \note The caller will take the ownership of the returned pointer.
464  \note It will NOT take the ownership of the given pointer "info".
465  \note It can throw an Exception when internal errors occur.
466  */
467  virtual std::auto_ptr<te::dt::DateTimePeriod> getTemporalExtent(const ObservationDataSetInfo& info) = 0;
468 
469  /*!
470  \brief It returns the temporal extent of the data set with observations of a trajectory.
471 
472  \return The temporal extent of the observations of a trajectory.
473 
474  \note The caller will take the ownership of the returned pointer.
475  \note It will NOT take the ownership of the given pointer "info".
476  \note It can throw an Exception when internal errors occur.
477  */
478  virtual std::auto_ptr<te::dt::DateTimePeriod> getTemporalExtent(const TrajectoryDataSetInfo& info) = 0;
479 
480  /*!
481  \brief It returns the temporal extent of the data set with observations of a time series.
482 
483  \return The temporal extent of the observations of a time series.
484 
485  \note The caller will take the ownership of the returned pointer.
486  \note It will NOT take the ownership of the given pointer "info".
487  \note It can throw an Exception when internal errors occur.
488  */
489  virtual std::auto_ptr<te::dt::DateTimePeriod> getTemporalExtent(const TimeSeriesDataSetInfo& info) = 0;
490 
491  /*!
492  \brief It returns the temporal extent of the data set with observations of a coverage series.
493 
494  \return The temporal extent of the observations of a coverage series.
495 
496  \note The caller will take the ownership of the returned pointer.
497  \note It will NOT take the ownership of the given pointer "info".
498  \note It can throw an Exception when internal errors occur.
499  */
500  //virtual std::auto_ptr<te::dt::DateTimePeriod> getTemporalExtent(const CoverageSeriesDataSetInfo& info) = 0;
501 
502  /*!
503  \brief It returns the spatial extent of the observations, when there is an observed value of geometry type.
504 
505  \return The spatial extent of the observations.
506 
507  \note The caller will take the ownership of the returned pointer.
508  \note It can throw an Exception when internal errors occur.
509  */
510  virtual te::gm::Envelope getSpatialExtent(const ObservationDataSetInfo& info) = 0;
511 
512  /*!
513  \brief It returns the spatial extent of the observations of a trajectory.
514 
515  \return The spatial extent of the observations of a trajectory.
516 
517  \note The caller will take the ownership of the returned pointer.
518  \note It can throw an Exception when internal errors occur.
519  */
520  virtual te::gm::Envelope getSpatialExtent(const TrajectoryDataSetInfo& info) = 0;
521 
522  /*!
523  \brief It returns the spatial extent of the observations of a coverage series.
524 
525  \return The spatial extent of the observations of a coverage series.
526 
527  \note The caller will take the ownership of the returned pointer.
528  \note It can throw an Exception when internal errors occur.
529  */
530  //virtual te::gm::Envelope getSpatialExtent(const CoverageSeriesDataSetInfo& info) = 0;
531  //@}
532 
533  /*! \brief Virtual destructor. */
534  virtual ~STDataLoaderImpl();
535  };
536 
537  } // end namespace st
538 } // end namespace te
539 
540 #endif // __TERRALIB_ST_INTERNAL_STDATALOADERIMPL_H
541 
542 
543 
A class that contains infos about a DataSet that contains observations of one or more time series...
A class that contains infos about a DataSet that contains observations.
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:122
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:136
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
Definition: Enums.h:76
A class that contains infos about a DataSet that contains observations of one or more trajectories...
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
An abstract class responsible for loading spatiotemporal data from data sources.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51