ObservationDataSet.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 ObservationDataSet.h
22 
23  \brief This file contains a class to represent an observation data set.
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_OBSERVATIONDATASET_H
27 #define __TERRALIB_ST_INTERNAL_OBSERVATIONDATASET_H
28 
29 //ST
30 #include "../../Config.h"
31 #include "ObservationDataSetType.h"
32 
33 //TerraLib
34 #include "../../../geometry/Envelope.h"
35 #include "../../../datatype/DateTimePeriod.h"
36 
37 // Boost
38 #include <boost/noncopyable.hpp>
39 
40 //STL
41 #include <memory>
42 
43 // Forward declarations
44 namespace te { namespace da { class DataSet; class DataSetType; } }
45 namespace te { namespace dt { class Property; class DateTime; class DateTimePeriod; } }
46 namespace te { namespace gm { class Envelope; class Geometry; } }
47 
48 namespace te
49 {
50  namespace st
51  {
52 
53  // Forward declarations
54  class Observation;
55  class ObservationDataSetType;
56  class TrajectoryDataSet;
57  class TimeSeriesDataSet;
58 
59  /*!
60  \class ObservationDataSet
61 
62  \brief A class to represent a DataSet that contains observations.
63 
64  This class implements a view on a data set. It encapsulates a DataSet as a
65  ObservationDataSet. An observation data set is composed of a finite number
66  of homogeneous observations, that is,
67  every observation has the same number and type of observed values.
68 
69  \ingroup st
70 
71  \sa DataSet Observation DataSource
72  */
73 
74  /*
75  \\\Nota: Poderíamos ter internamente um ponteiro para o STDataLoader
76  \\\ que o gerou ou para o Info (para obter o STDataLoader)... isso seria útil para:
77  \\\ (1) calcular o temporalExtent.
78  \\\ (2) carregar o dado por partes e não tudo de uma vez
79  \\\ mas por enquanto vamos deixar sem esse ponteiro.
80  \\\ No caso do temporalExtent, a pessoa pode informar no construtor ou não
81  */
82  class TESTEXPORT ObservationDataSet : public boost::noncopyable
83  {
85  friend class TrajectoryDataSet;
86  friend class TimeSeriesDataSet;
87 
88  public:
89 
90  /*! \name Constructors */
91  //@{
92  /*! \brief Constructor.
93 
94  It constructs an observation data set, based on the given
95  DataSet and ObservationDataSetType
96 
97  \param ds the DataSet
98  \param obst extra information about the properies of the DataSet
99 
100  \note It will take the ownership of the DataSet pointer
101  */
103 
104  /*! \brief Constructor.
105 
106  It constructs an observation data set, based on the given
107  DataSet and ObservationDataSetType
108 
109  \param ds The DataSet.
110  \param obst extra information about the properies of the DataSet
111  \param text the temporal extent
112 
113  \note It will take the ownership of the given pointers
114  */
116  te::dt::DateTimePeriod* text);
117 
118  /*! \brief Constructor.
119 
120  It constructs an observation data set, based on the given
121  DataSet and ObservationDataSetType
122 
123  \param ds The DataSet.
124  \param obst extra information about the properies of the DataSet
125  \param text the temporal extent
126  \param sext the spatial extent
127 
128  \note It will take the ownership of the given pointers
129  */
132  //@}
133 
134  /*!
135  \brief It returns the DataSet that contains the observations.
136 
137  \return A pointer to the internal DataSet that contains the observations.
138 
139  \note The caller will NOT take the ownership of the returned pointer.
140  */
141  te::da::DataSet* getData() const;
142 
143  /*!
144  \brief It returns a reference to the ObservationDataSetType.
145 
146  \return A reference to the internal ObservationDataSetType.
147  */
148  const ObservationDataSetType& getType() const;
149 
150  /*!
151  \brief It returns the spatial extent of the observations,
152  when there is an observed value of geometry type.
153 
154  \return The spatial extent of the observations.
155 
156  \note The caller will NOT take the ownership of the returned pointer.
157  */
158  //const te::gm::Envelope& getSpatialExtent();
159  const te::gm::Geometry* getSpatialExtent();
160 
161  /*!
162  \brief It sets the spatial extent of the observations,
163  when there is an observed value of geometry type.
164 
165  \param ext The spatial extent of the observations.
166 
167  \note It will take the ownership of the given pointer.
168  */
169  //void setSpatialExtent(const te::gm::Envelope& ext);
170  void setSpatialExtent(te::gm::Geometry* ext);
171 
172  /*!
173  \brief It returns the temporal extent of the observations.
174 
175  \return The temporal extent of the observations.
176 
177  \note The caller will NOT take the ownership of the returned pointer.
178  */
179  const te::dt::DateTimePeriod* getTemporalExtent();
180 
181  /*!
182  \brief It sets the temporal extent of the observations,
183  when there is an observed value of geometry type.
184 
185  \param ext The temporal extent of the observations.
186 
187  \note It will take the ownership of the given pointer.
188  */
189  void setTemporalExtent(te::dt::DateTimePeriod* ext);
190 
191  /*! \name Methods to traverse the observation set and to check the
192  internal cursor pointer*/
193  //@{
194  bool moveNext();
195 
196  bool movePrevious();
197 
198  bool moveFirst();
199 
200  bool moveBeforeFirst();
201 
202  bool moveLast();
203 
204  bool isAtBegin() const;
205 
206  bool isBeforeBegin() const;
207 
208  bool isAtEnd() const;
209 
210  bool isAfterEnd() const;
211  //@}
212 
213  /*!
214  \brief It returns the observation pointed by the internal cursor.
215 
216  \return The observation pointed by the internal cursor.
217 
218  \note The caller will take the ownership of the output pointer.
219  */
220  std::auto_ptr<Observation> getObservation() const;
221 
222  /*! \name Methods to return the properties associated to observations. */
223  //@{
224  /*!
225  \brief It returns the property of the phenomenon beginning time.
226 
227  \return The property of the phenomenon beginning time.
228 
229  \note The caller will NOT take the ownership of the returned pointer.
230  */
231  const te::dt::DateTimeProperty* getBeginTimeProperty() const;
232 
233  /*!
234  \brief It returns the property of the phenomenon end time.
235 
236  \return The property of the phenomenon end time.
237 
238  \note The caller will NOT take the ownership of the returned pointer.
239  */
240  const te::dt::DateTimeProperty* getEndTimeProperty() const;
241 
242  /*!
243  \brief It returns the property of the valid beginning time.
244 
245  \return The property of the valid beginning time.
246 
247  \note The caller will NOT take the ownership of the returned pointer.
248  */
249  const te::dt::DateTimeProperty* getVlBeginTimeProperty() const;
250 
251  /*!
252  \brief It returns the property of the valid end time.
253 
254  \return The property of the valid end time.
255 
256  \note The caller will NOT take the ownership of the returned pointer.
257  */
258  const te::dt::DateTimeProperty* getVlEndTimeProperty() const;
259 
260  /*!
261  \brief It returns the property of the result time.
262 
263  \return The property of the result time.
264 
265  \note The caller will NOT take the ownership of the returned pointer.
266  */
267  const te::dt::DateTimeProperty* getRsTimeProperty() const;
268  //@}
269 
270  /*! \brief Virtual destructor. */
271  virtual ~ObservationDataSet();
272 
273  protected:
274 
275  /*!
276  \brief It releases all internal pointers, returning its internal DataSet and invalidating itself
277  \return A pointer to the internal DataSet that contains the observations.
278 
279  \note This method is used when the user is interested only in its internal DataSet
280  \note The caller will take the ownership of the returned pointer.
281  */
282  std::auto_ptr<te::da::DataSet> release();
283 
284  private:
285 
286  std::auto_ptr<te::da::DataSet> m_ds; //! A data set that contains observations
287  ObservationDataSetType m_obst; //! An observation data set type that refers to m_ds
288  };
289 
290  typedef std::auto_ptr<ObservationDataSet> ObservationDataSetPtr;
291 
292  } // end namespace st
293 } // end namespace te
294 
295 #endif // __TERRALIB_ST_INTERNAL_OBSERVATIONDATASET_H
296 
297 
298 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
std::auto_ptr< ObservationDataSet > ObservationDataSetPtr
A layer with reference to a dataset that contains observations.
A class to represent a time series data set.
A class to represent a DataSet that contains observations.
ObservationDataSetType m_obst
A data set that contains observations.
This file contains a class called ObservationDataSetType.
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
A class to represent a trajectory data set.
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.
std::auto_ptr< te::da::DataSet > m_ds
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 class that contains complemental DataSetType information about a DataSet that holds observations...