All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObservationDataSet.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 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 ObservationDataSetType;
55  class Observation;
56 
57  /*!
58  \class ObservationDataSet
59 
60  \brief A class to represent a DataSet that contains observations.
61 
62  This class implements a view on a data set. It encapsulates a DataSet as a
63  ObservationDataSet. An observation data set is composed of a finite number
64  of homogeneous observations, that is,
65  every observation has the same number and type of observed values.
66 
67  \ingroup st
68 
69  \sa DataSet Observation DataSource
70  */
71 
72  /*
73  \\\Nota: Poderíamos ter internamente um ponteiro para o STDataLoader
74  \\\ que o gerou ou para o Info (para obter o STDataLoader)... isso seria útil para:
75  \\\ (1) calcular o temporalExtent.
76  \\\ (2) carregar o dado por partes e não tudo de uma vez
77  \\\ mas por enquanto vamos deixar sem esse ponteiro.
78  \\\ No caso do temporalExtent, a pessoa pode informar no construtor ou não */ class TESTEXPORT ObservationDataSet : public boost::noncopyable { public: /*! \name Constructors */ //@{ /*! \brief Constructor. It constructs an observation data set, based on the given DataSet and ObservationDataSetType \param ds the DataSet \param obst extra information about the properies of the DataSet \note It will take the ownership of the DataSet pointer */ ObservationDataSet(te::da::DataSet* ds, const ObservationDataSetType& obst); /*! \brief Constructor. It constructs an observation data set, based on the given DataSet and ObservationDataSetType \param ds The DataSet. \param obst extra information about the properies of the DataSet \param text the temporal extent \note It will take the ownership of the given pointers */ ObservationDataSet(te::da::DataSet* ds, const ObservationDataSetType& obst, te::dt::DateTimePeriod* text); /*! \brief Constructor. It constructs an observation data set, based on the given DataSet and ObservationDataSetType \param ds The DataSet. \param obst extra information about the properies of the DataSet \param text the temporal extent \param sext the spatial extent \note It will take the ownership of the given pointers */ ObservationDataSet(te::da::DataSet* ds, const ObservationDataSetType& obst, te::dt::DateTimePeriod* text, const te::gm::Envelope& sext); /*! \brief Constructor. \param ds The DataSet. \param phTimeIdx The index of the property that contains the phenomenon time. \param obsPropIdx The index of the property that is observed. \param geomPropIdx The index of the observed property that contains the geometry. \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx, int geomPropIdx = -1); /*! \brief Constructor. \param ds the DataSet \param phTimeIdxs The indexes of the property that contains the begin and final phenomenon time. \param obsPropIdx The indexes of the properties that are observed. \param geomPropIdx The index of the observed property that contains the geometry. \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs, const std::vector<int>& obsPropIdxs, int geomPropIdx = -1); /*! \brief Constructor. \param ds The DataSet \param phTimeIdx The index of the property that contains the phenomenon time. \param obsPropIdx The index of the property that is observed. \param geomPropIdx The index of the observed property that contains the geometry. \param text The temporal extent \param sext The spatial extent \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx, int geomPropIdx, te::dt::DateTimePeriod* text); /*! \brief Constructor. \param ds The DataSet \param phTimeIdx The index of the property that contains the phenomenon time. \param obsPropIdx The index of the property that is observed. \param geomPropIdx The index of the observed property that contains the geometry. \param text The temporal extent \param sext The spatial extent \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx, int geomPropIdx, te::dt::DateTimePeriod* text, const te::gm::Envelope& sext); /*! \brief Constructor. \param ds The DataSet \param phTimeIdxs The index of the property that contains the begin and end times. \param obsPropIdxs The indexes of the properties that are observed. \param geomPropIdx The index of the observed property that contains the geometry. \param text The temporal extent \param sext The spatial extent \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs, const std::vector<int>& obsPropIdxs, int geomPropIdx, te::dt::DateTimePeriod* text); /*! \brief Constructor. \param ds The DataSet \param phTimeIdxs The index of the property that contains the begin and end times. \param obsPropIdxs The indexes of the properties that are observed. \param geomPropIdx The index of the observed property that contains the geometry. \param text The temporal extent \param sext The spatial extent \note It will take the ownership of the DataSet pointer */ ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs, const std::vector<int>& obsPropIdxs, int geomPropIdx, te::dt::DateTimePeriod* text, const te::gm::Envelope& sext); //@} /*! \brief It returns the DataSet that contains the observations. \return A pointer to the internal DataSet that contains the observations. \note The caller will NOT take the ownership of the returned pointer. */ te::da::DataSet* getData() const; /*! \brief It returns a reference to the ObservationDataSetType. \return A reference to the internal ObservationDataSetType. */ const ObservationDataSetType& getType() const; /*! \brief It returns the spatial extent of the observations, when there is an observed value of geometry type. \return The spatial extent of the observations. */ const te::gm::Envelope& getSpatialExtent(); /*! \brief It sets the spatial extent of the observations, when there is an observed value of geometry type. \param ext The spatial extent of the observations. */ void setSpatialExtent(const te::gm::Envelope& ext); /*! \brief It returns the temporal extent of the observations. \return The temporal extent of the observations. \note The caller will NOT take the ownership of the returned pointer. */ te::dt::DateTimePeriod* getTemporalExtent(); /*! \brief It sets the temporal extent of the observations, when there is an observed value of geometry type. \param ext The temporal extent of the observations. \note It will take the ownership of the given pointer. */ void setTemporalExtent(te::dt::DateTimePeriod* ext); /*! \name Methods to traverse the observation set and to check the internal cursor pointer*/ //@{ bool moveNext(); bool movePrevious(); bool moveFirst(); bool moveBeforeFirst(); bool moveLast(); bool isAtBegin() const; bool isBeforeBegin() const; bool isAtEnd() const; bool isAfterEnd() const; //@} /*! \brief It returns the observation pointed by the internal cursor. \return The observation pointed by the internal cursor. \note The caller will take the ownership of the output pointer. */ std::auto_ptr<Observation> getObservation() const; /*! \name Methods to return the properties associated to observations. */ //@{ /*! \brief It returns the property of the phenomenon beginning time. \return The property of the phenomenon beginning time. \note The caller will NOT take the ownership of the returned pointer. */ //te::dt::DateTimeProperty* getBeginTimeProperty() const; /*! \brief It returns the property of the phenomenon end time. \return The property of the phenomenon end time. \note The caller will NOT take the ownership of the returned pointer. */ //te::dt::DateTimeProperty* getEndTimeProperty() const; /*! \brief It returns the properties of the observed values. \param output the properties of the observed values. \note The caller will NOT take the ownership of the output pointers. */ //void getObsProperties(std::vector<te::dt::Property*> output); /*! \brief It returns the property of the valid beginning time. \return The property of the valid beginning time. \note The caller will NOT take the ownership of the returned pointer. */ //te::dt::DateTimeProperty* getVlBeginTimeProperty() const; /*! \brief It returns the property of the valid end time. \return The property of the valid end time. \note The caller will NOT take the ownership of the returned pointer. */ //te::dt::DateTimeProperty* getVlEndTimeProperty() const; /*! \brief It returns the property of the result time. \return The property of the result time. \note The caller will NOT take the ownership of the returned pointer. */ //te::dt::DateTimeProperty* getRsTimeProperty() const; //@} /*! \brief Virtual destructor. */ virtual ~ObservationDataSet(); private: std::auto_ptr<te::da::DataSet> m_ds; //! A data set that contains observations ObservationDataSetType m_obst; //! An observation data set type that refers to m_ds std::auto_ptr<te::dt::DateTimePeriod> m_tpExtent; //! Its temporal extent te::gm::Envelope m_spExtent; //! Its spatial extent }; typedef std::auto_ptr<ObservationDataSet> ObservationDataSetPtr; } // end namespace st } // end namespace te #endif // __TERRALIB_ST_INTERNAL_OBSERVATIONDATASET_H
79  */
80  class TESTEXPORT ObservationDataSet : public boost::noncopyable
81  {
82  public:
83 
84  /*! \name Constructors */
85  //@{
86  /*! \brief Constructor.
87 
88  It constructs an observation data set, based on the given
89  DataSet and ObservationDataSetType
90 
91  \param ds the DataSet
92  \param obst extra information about the properies of the DataSet
93 
94  \note It will take the ownership of the DataSet pointer
95  */
97 
98  /*! \brief Constructor.
99 
100  It constructs an observation data set, based on the given
101  DataSet and ObservationDataSetType
102 
103  \param ds The DataSet.
104  \param obst extra information about the properies of the DataSet
105  \param text the temporal extent
106 
107  \note It will take the ownership of the given pointers
108  */
110  te::dt::DateTimePeriod* text);
111 
112  /*! \brief Constructor.
113 
114  It constructs an observation data set, based on the given
115  DataSet and ObservationDataSetType
116 
117  \param ds The DataSet.
118  \param obst extra information about the properies of the DataSet
119  \param text the temporal extent
120  \param sext the spatial extent
121 
122  \note It will take the ownership of the given pointers
123  */
125  te::dt::DateTimePeriod* text, const te::gm::Envelope& sext);
126 
127  /*! \brief Constructor.
128 
129  \param ds The DataSet.
130  \param phTimeIdx The index of the property that contains the phenomenon time.
131  \param obsPropIdx The index of the property that is observed.
132  \param geomPropIdx The index of the observed property that contains the geometry.
133 
134  \note It will take the ownership of the DataSet pointer
135  */
136  ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx,
137  int geomPropIdx = -1);
138 
139  /*! \brief Constructor.
140 
141  \param ds the DataSet
142  \param phTimeIdxs The indexes of the property that contains the begin and final phenomenon time.
143  \param obsPropIdx The indexes of the properties that are observed.
144  \param geomPropIdx The index of the observed property that contains the geometry.
145 
146  \note It will take the ownership of the DataSet pointer
147  */
148  ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs,
149  const std::vector<int>& obsPropIdxs, int geomPropIdx = -1);
150 
151  /*! \brief Constructor.
152 
153  \param ds The DataSet
154  \param phTimeIdx The index of the property that contains the phenomenon time.
155  \param obsPropIdx The index of the property that is observed.
156  \param geomPropIdx The index of the observed property that contains the geometry.
157  \param text The temporal extent
158  \param sext The spatial extent
159 
160  \note It will take the ownership of the DataSet pointer
161  */
162  ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx,
163  int geomPropIdx, te::dt::DateTimePeriod* text);
164 
165 
166  /*! \brief Constructor.
167 
168  \param ds The DataSet
169  \param phTimeIdx The index of the property that contains the phenomenon time.
170  \param obsPropIdx The index of the property that is observed.
171  \param geomPropIdx The index of the observed property that contains the geometry.
172  \param text The temporal extent
173  \param sext The spatial extent
174 
175  \note It will take the ownership of the DataSet pointer
176  */
177  ObservationDataSet( te::da::DataSet* ds, int phTimeIdx, int obsPropIdx,
178  int geomPropIdx, te::dt::DateTimePeriod* text,
179  const te::gm::Envelope& sext);
180 
181  /*! \brief Constructor.
182 
183  \param ds The DataSet
184  \param phTimeIdxs The index of the property that contains the begin and end times.
185  \param obsPropIdxs The indexes of the properties that are observed.
186  \param geomPropIdx The index of the observed property that contains the geometry.
187  \param text The temporal extent
188  \param sext The spatial extent
189 
190  \note It will take the ownership of the DataSet pointer
191  */
192  ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs,
193  const std::vector<int>& obsPropIdxs, int geomPropIdx,
194  te::dt::DateTimePeriod* text);
195 
196  /*! \brief Constructor.
197 
198  \param ds The DataSet
199  \param phTimeIdxs The index of the property that contains the begin and end times.
200  \param obsPropIdxs The indexes of the properties that are observed.
201  \param geomPropIdx The index of the observed property that contains the geometry.
202  \param text The temporal extent
203  \param sext The spatial extent
204 
205  \note It will take the ownership of the DataSet pointer
206  */
207  ObservationDataSet( te::da::DataSet* ds, const std::vector<int>& phTimeIdxs,
208  const std::vector<int>& obsPropIdxs, int geomPropIdx,
209  te::dt::DateTimePeriod* text, const te::gm::Envelope& sext);
210  //@}
211 
212  /*!
213  \brief It returns the DataSet that contains the observations.
214 
215  \return A pointer to the internal DataSet that contains the observations.
216 
217  \note The caller will NOT take the ownership of the returned pointer.
218  */
219  te::da::DataSet* getData() const;
220 
221  /*!
222  \brief It returns a reference to the ObservationDataSetType.
223 
224  \return A reference to the internal ObservationDataSetType.
225  */
226  const ObservationDataSetType& getType() const;
227 
228  /*!
229  \brief It returns the spatial extent of the observations,
230  when there is an observed value of geometry type.
231 
232  \return The spatial extent of the observations.
233  */
234  const te::gm::Envelope& getSpatialExtent();
235 
236  /*!
237  \brief It sets the spatial extent of the observations,
238  when there is an observed value of geometry type.
239 
240  \param ext The spatial extent of the observations.
241  */
242  void setSpatialExtent(const te::gm::Envelope& ext);
243 
244  /*!
245  \brief It returns the temporal extent of the observations.
246 
247  \return The temporal extent of the observations.
248 
249  \note The caller will NOT take the ownership of the returned pointer.
250  */
251  te::dt::DateTimePeriod* getTemporalExtent();
252 
253  /*!
254  \brief It sets the temporal extent of the observations,
255  when there is an observed value of geometry type.
256 
257  \param ext The temporal extent of the observations.
258 
259  \note It will take the ownership of the given pointer.
260  */
261  void setTemporalExtent(te::dt::DateTimePeriod* ext);
262 
263  /*! \name Methods to traverse the observation set and to check the
264  internal cursor pointer*/
265  //@{
266  bool moveNext();
267 
268  bool movePrevious();
269 
270  bool moveFirst();
271 
272  bool moveBeforeFirst();
273 
274  bool moveLast();
275 
276  bool isAtBegin() const;
277 
278  bool isBeforeBegin() const;
279 
280  bool isAtEnd() const;
281 
282  bool isAfterEnd() const;
283  //@}
284 
285  /*!
286  \brief It returns the observation pointed by the internal cursor.
287 
288  \return The observation pointed by the internal cursor.
289 
290  \note The caller will take the ownership of the output pointer.
291  */
292  std::auto_ptr<Observation> getObservation() const;
293 
294  /*! \name Methods to return the properties associated to observations. */
295  //@{
296  /*!
297  \brief It returns the property of the phenomenon beginning time.
298 
299  \return The property of the phenomenon beginning time.
300 
301  \note The caller will NOT take the ownership of the returned pointer.
302  */
303  //te::dt::DateTimeProperty* getBeginTimeProperty() const;
304 
305  /*!
306  \brief It returns the property of the phenomenon end time.
307 
308  \return The property of the phenomenon end time.
309 
310  \note The caller will NOT take the ownership of the returned pointer.
311  */
312  //te::dt::DateTimeProperty* getEndTimeProperty() const;
313 
314  /*!
315  \brief It returns the properties of the observed values.
316 
317  \param output the properties of the observed values.
318 
319  \note The caller will NOT take the ownership of the output pointers.
320  */
321  //void getObsProperties(std::vector<te::dt::Property*> output);
322 
323  /*!
324  \brief It returns the property of the valid beginning time.
325 
326  \return The property of the valid beginning time.
327 
328  \note The caller will NOT take the ownership of the returned pointer.
329  */
330  //te::dt::DateTimeProperty* getVlBeginTimeProperty() const;
331 
332  /*!
333  \brief It returns the property of the valid end time.
334 
335  \return The property of the valid end time.
336 
337  \note The caller will NOT take the ownership of the returned pointer.
338  */
339  //te::dt::DateTimeProperty* getVlEndTimeProperty() const;
340 
341  /*!
342  \brief It returns the property of the result time.
343 
344  \return The property of the result time.
345 
346  \note The caller will NOT take the ownership of the returned pointer.
347  */
348  //te::dt::DateTimeProperty* getRsTimeProperty() const;
349  //@}
350 
351  /*! \brief Virtual destructor. */
352  virtual ~ObservationDataSet();
353 
354  private:
355 
356  std::auto_ptr<te::da::DataSet> m_ds; //! A data set that contains observations
357  ObservationDataSetType m_obst; //! An observation data set type that refers to m_ds
358  std::auto_ptr<te::dt::DateTimePeriod> m_tpExtent; //! Its temporal extent
359  te::gm::Envelope m_spExtent; //! Its spatial extent
360  };
361 
362  typedef std::auto_ptr<ObservationDataSet> ObservationDataSetPtr;
363 
364  } // end namespace st
365 } // end namespace te
366 
367 #endif // __TERRALIB_ST_INTERNAL_OBSERVATIONDATASET_H
368 
369 
370 
std::auto_ptr< ObservationDataSet > ObservationDataSetPtr
A class to represent a DataSet that contains observations.
An abstract class to represent a period of date and time.
std::auto_ptr< te::da::DataSet > m_ds
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:136
This file contains a class called ObservationDataSetType.
std::auto_ptr< te::dt::DateTimePeriod > m_tpExtent
An observation data set type that refers to m_ds.
A class that contains complemental DataSetType information about a DataSet that holds observations...
ObservationDataSetType m_obst
A data set that contains observations.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
te::gm::Envelope m_spExtent
Its temporal extent.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111