ObservationDataSetType.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 ObservationDataSetType.h
22 
23  \brief This file contains a class called ObservationDataSetType
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_OBSERVATIONDATASETTYPE_H
27 #define __TERRALIB_ST_INTERNAL_OBSERVATIONDATASETTYPE_H
28 
29 //ST
30 #include "../../Config.h"
31 
32 //STL
33 #include <string>
34 #include <vector>
35 
36 //Boost
37 #include <boost/ptr_container/ptr_vector.hpp>
38 
39 
40 namespace te { namespace da { class DataSetType; } }
41 namespace te { namespace dt { class DateTimeProperty; class DateTime;
42  class DateTimeInstant; class DateTimePeriod;} }
43 namespace te { namespace gm { class GeometryProperty; class Geometry; } }
44 
45 namespace te
46 {
47  namespace st
48  {
49  /*!
50  \class ObservationDataSetType
51 
52  \brief A class that contains complemental DataSetType information about a DataSet
53  that holds observations.
54 
55  This class contains complemental DataSetType information about a
56  DataSet that holds observations.
57 
58  An observation is a result of a measurement associated to a discrete
59  time instant or period which assigns values to a phenomenon. It follows
60  the OGC's Observation and Measurement (O&M) specification.
61  An observation is composed of: (1) a phenomenon time, (2) a valid time,
62  (3) a result time and (4) observed values.
63 
64  Thus, this class has the indexes of the DataSet properties that contains the
65  phenomenon time, the valid time, the result time and the observed values.
66 
67  \sa Observation ObservationDataSet
68  */
69 
71  {
72  public:
73 
74  /*!
75  \brief Constructor.
76 
77  \param dsName The DataSet name.
78  */
79  ObservationDataSetType(const std::string& dsName);
80 
81  /*! \brief Copy constructor. */
83 
84  /*!
85  \brief Assignment operator.
86  */
87  const ObservationDataSetType& operator=(const ObservationDataSetType& rhs);
88 
89  /*! \name Operations to set information */
90  //@{
91 
92  /*!
93  \brief It sets the DataSet name that contains the observations
94 
95  \param dsName The DataSet name.
96  */
97  void setDataSetName(const std::string& dsName);
98 
99  /*!
100  \brief It sets the property info that contains the phenomenon beginning time.
101 
102  \param tpInfo The property info that contains the phenomenon beginning time.
103 
104  \note It will take the ownership of the given pointers.
105  */
106  void setTimePropInfo(te::dt::DateTimeProperty* tpInfo);
107 
108  /*!
109  \brief It sets the property info that contains the phenomenon time.
110 
111  \param tpInfo1 The property info that contains the phenomenon beginning time.
112  \param tpInfo2 The property info that contains the phenomenon beginning time.
113 
114  \note It will take the ownership of the given pointers.
115  */
116  void setTimePropInfo(te::dt::DateTimeProperty* tpInfo1, te::dt::DateTimeProperty* tpInfo2);
117 
118  /*!
119  \brief It sets the phenomenon time associated to all observations.
120 
121  In this case, the phenomenon time is not inside the DataSet but it is
122  informed by the user.
123 
124  \param t The phenomenon time.
125 
126  \note It will take the ownership of the given pointers.
127  */
128  void setTime(te::dt::DateTime* t);
129 
130  /*!
131  \brief It sets the property info that contains the valid time.
132 
133  \param tpInfo The property info that contains the valid time.
134 
135  \note It will take the ownership of the given pointers.
136  */
137  void setVlTimePropInfo(te::dt::DateTimeProperty* tpInfo);
138 
139  /*!
140  \brief It sets the property info that contains the valid time.
141 
142  \param tpInfo1 The property info that contains the phenomenon valid time.
143  \param tpInfo2 The property info that contains the phenomenon valid time.
144 
145  \note It will take the ownership of the given pointers.
146  */
147  void setVlTimePropInfo(te::dt::DateTimeProperty* tpInfo1, te::dt::DateTimeProperty* tpInfo2);
148 
149  /*!
150  \brief It sets the valid time associated to all observations.
151 
152  In this case, the valid time is not inside the DataSet but it is
153  informed by the user.
154 
155  \param t The valid time.
156 
157  \note It will take the ownership of the given pointers.
158  */
159  void setVlTime(te::dt::DateTimePeriod* t);
160 
161  /*!
162  \brief It sets the property info that contains the result time.
163 
164  \param tpInfo The property info that contains the result time.
165 
166  \note It will take the ownership of the given pointers.
167  */
168  void setRsTimePropInfo(te::dt::DateTimeProperty* tpInfo);
169 
170  /*!
171  \brief It sets the result time associated to all observations.
172 
173  In this case, the result time is not inside the DataSet but it is
174  informed by the user.
175 
176  \param t The result time.
177 
178  \note It will take the ownership of the given pointers.
179  */
180  void setRsTime(te::dt::DateTimeInstant* t);
181 
182  /*!
183  \brief It sets the indexes of the DataSet properties that are observed over time.
184 
185  \param props The indexes of the DataSet properties that are observed over time.
186  */
187  void setObsPropInfo(const std::vector<int>& props);
188 
189  /*!
190  \brief It sets the names of the DataSet properties that are observed over time.
191 
192  \param props The names of the DataSet properties that are observed over time.
193  */
194  void setObsPropInfo(const std::vector<std::string>& props);
195 
196  /*!
197  \brief It sets the info about the property that contains the observation location.
198 
199  In this case, the location of each observation is stored in the DataSet as a
200  geometry property. The geometry property can be observed over time or be the
201  same for all observations.
202 
203  \param prop The info about the property that contains the observation location.
204 
205  \note It will take the ownership of the given pointer.
206  */
207  void setGeomPropInfo(te::gm::GeometryProperty* prop);
208 
209  /*!
210  \brief It sets the geometry associated to all observations.
211 
212  In this case, the location of all observations is NOT stored in the DataSet as a
213  geometry property. The observation location is informed
214  by the user.
215 
216  \param geom The geometry associated to all observations.
217 
218  \note It will take the ownership of the given pointer.
219  */
220  void setGeometry(te::gm::Geometry* geom);
221 
222  /*!
223  \brief It sets the index of the DataSet property that contains identifiers that groups the observations.
224 
225  \param idProp The index of the DataSet property that contains identifiers that groups the observations.
226  */
227  void setIdPropInfo(int idProp);
228 
229  /*!
230  \brief It sets the name of the DataSet property that contains identifiers that groups the observations.
231 
232  \param idProp The name of the DataSet property that contains identifiers that groups the observations.
233  */
234  void setIdPropInfo(const std::string& idProp);
235 
236  /*!
237  \brief It sets the identifier associated to all observations.
238 
239  In this case, the identifier is NOT in the DataSet. It is informed by the user.
240 
241  \param id The identifier associated to all observations.
242  */
243  void setId(const std::string& id);
244 
245  /*!
246  \brief It sets the spatial extent of all observations.
247 
248  \param se The spatial extent of all observations.
249 
250  \note It will take the ownership of the given pointer.
251  */
252  void setSpatialExtent(te::gm::Geometry* se);
253 
254  /*!
255  \brief It sets the temporal extent of all observations.
256 
257  \param te The temporal extent of all observations.
258 
259  \note It will take the ownership of the given pointer.
260  */
261  void setTemporalExtent(te::dt::DateTimePeriod* te);
262 
263  //@}
264 
265  /*! \name Operations to check information */
266  //@{
267  bool hasTimeProp() const;
268  bool hasTwoTimeProp() const;
269  bool hasTime() const;
270  bool hasVlTimeProp() const;
271  bool hasTwoVlTimeProp() const;
272  bool hasVlTime() const;
273  bool hasRsTimeProp() const;
274  bool hasRsTime() const;
275  bool hasGeomProp() const;
276  bool hasGeometry() const;
277  bool hasIdProp() const;
278  bool hasId() const;
279  bool hasSpatialExtent() const;
280  bool hasTemporalExtent() const;
281  //@}
282 
283  /*! \name Operations to get information */
284  //@{
285 
286  /*!
287  \brief It returns the DataSet name
288 
289  \return The dataSet name
290  */
291  std::string getDataSetName() const;
292 
293  /*!
294  \brief It returns the DataSet property information that contains the phenomenon beginning time.
295 
296  \return The DataSet property information that contains the phenomenon beginning time.
297 
298  \note The user does NOT take the ownership of the returned pointer.
299  \note The returned pointer can be NULL, when there is no information.
300  */
301  const te::dt::DateTimeProperty* getBeginTimePropInfo() const;
302 
303  /*!
304  \brief It returns the DataSet property information that contains the phenomenon end time.
305 
306  \return The DataSet property information that contains the phenomenon end time.
307 
308  \note The user does NOT take the ownership of the returned pointer.
309  \note The returned pointer can be NULL, when there is no information.
310  */
311  const te::dt::DateTimeProperty* getEndTimePropInfo() const;
312 
313  /*!
314  \brief It returns the phenomenon time.
315 
316  \return The phenomenon time.
317 
318  \note The user does NOT take the ownership of the returned pointer.
319  \note The returned pointer can be NULL, when there is no information.
320  */
321  const te::dt::DateTime* getTime() const;
322 
323  /*!
324  \brief It returns the DataSet property information that contains the valid beginning time.
325 
326  \return The DataSet property information that contains the valid beginning time.
327 
328  \note The user does NOT take the ownership of the returned pointer.
329  \note The returned pointer can be NULL, when there is no information.
330  */
331  const te::dt::DateTimeProperty* getVlBeginTimePropInfo() const;
332 
333  /*!
334  \brief It returns the DataSet property information that contains the valid end time.
335 
336  \return The DataSet property information that contains the valid end time.
337 
338  \note The user does NOT take the ownership of the returned pointer.
339  \note The returned pointer can be NULL, when there is no information.
340  */
341  const te::dt::DateTimeProperty* getVlEndTimePropInfo() const;
342 
343  /*!
344  \brief It returns the valid time.
345 
346  \return The valid time.
347 
348  \note The user does NOT take the ownership of the returned pointer.
349  \note The returned pointer can be NULL, when there is no information.
350  */
351  const te::dt::DateTimePeriod* getVlTime() const;
352 
353  /*!
354  \brief It returns the DataSet property information that contains the result time.
355 
356  \return The DataSet property information that contains the result time.
357 
358  \note The user does NOT take the ownership of the returned pointer.
359  \note The returned pointer can be NULL, when there is no information.
360  */
361  const te::dt::DateTimeProperty* getRsTimePropInfo() const;
362 
363  /*!
364  \brief It returns the result time.
365 
366  \return The result time.
367 
368  \note The user does NOT take the ownership of the returned pointer.
369  \note The returned pointer can be NULL, when there is no information.
370  */
371  const te::dt::DateTimeInstant* getRsTime() const;
372 
373  /*!
374  \brief It returns the indexes of the DataSet properties that are observed over time.
375 
376  \return The indexes of the DataSet properties that are observed over time.
377  */
378  const std::vector<int>& getObsPropIdxs() const;
379 
380  /*!
381  \brief It returns the names of the DataSet properties that are observed over time.
382 
383  \return The names of the DataSet properties that are observed over time.
384  */
385  const std::vector<std::string>& getObsPropNames() const;
386 
387  /*!
388  \brief It returns the DataSet property information that contains the geometry.
389 
390  \return The DataSet property information that contains the geometry.
391 
392  \note The user does NOT take the ownership of the returned pointer.
393  \note The returned pointer can be NULL, when there is no information.
394  */
395  const te::gm::GeometryProperty* getGeomPropInfo() const;
396 
397  /*!
398  \brief It returns the geometry associated to all observations.
399 
400  \return The geometry associated to all observations.
401 
402  \note The user does NOT take the ownership of the returned pointer.
403  \note The returned pointer can be NULL, when there is no information.
404  */
405  const te::gm::Geometry* getGeometry() const;
406 
407  /*!
408  \brief It returns the index of the property that contains identifiers that groups observations.
409 
410  \return The index of the property that contains identifiers that groups observations.
411  */
412  int getIdPropIdx() const;
413 
414  /*!
415  \brief It returns the name of the property that contains identifiers that groups observations.
416 
417  \return The name of the property that contains identifiers that groups observations.
418  */
419  std::string getIdPropName() const;
420 
421  /*!
422  \brief It returns the identifier associated to all observations.
423 
424  \return The identifier associated to all observations.
425  */
426  std::string getObsId() const;
427 
428  /*!
429  \brief It returns the temporal extent of the observations.
430 
431  \return The temporal extent of the observations.
432 
433  \note The caller will NOT take the ownership of the returned pointer.
434  */
435  const te::dt::DateTimePeriod* getTemporalExtent() const;
436 
437  /*!
438  \brief It returns the spatial extent of the observations.
439 
440  \return The spatial extent of the observations.
441 
442  \note The caller will NOT take the ownership of the returned pointer.
443  */
444  const te::gm::Geometry* getSpatialExtent() const;
445 
446  /*!
447  \brief It returns the name of the DataSet property that contains the phenomenon beginning time.
448 
449  \return The name of the DataSet property that contains the phenomenon beginning time.
450 
451  \note It returns "" when there is no a phenomenon beginning time.
452  */
453  std::string getBeginTimePropName() const;
454 
455  /*!
456  \brief It returns the name of the DataSet property that contains the phenomenon end time.
457 
458  \return The name of the DataSet property that contains the phenomenon end time.
459 
460  \note It returns "" when there is no a phenomenon end time.
461  */
462  std::string getEndTimePropName() const;
463 
464  /*!
465  \brief It returns the name of the property that is a geometry property.
466 
467  \return The name of the property that is a geometry property.
468 
469  \note It returns "" when there is no a phenomenon end time.
470  */
471  std::string getGeomPropName() const;
472  //@}
473 
474  /*! \brief Virtual destructor. */
475  virtual ~ObservationDataSetType();
476 
477  private:
478 
479  std::string m_dsName; //!< The DataSet name
480 
481  boost::ptr_vector<te::dt::DateTimeProperty> m_phTimePropInfo; //!< Phenomenon time: information about the DataSet properties that contain the phenomenon time.
482  std::auto_ptr<te::dt::DateTime> m_phTime; //!< Phenomenon time: the phenomenon time, when the time is not inside a DataSet.
483 
484  boost::ptr_vector<te::dt::DateTimeProperty> m_validTimePropInfo; //!< Valid time: information about the DataSet properties that contain the valid time.
485  std::auto_ptr<te::dt::DateTimePeriod> m_validTime; //!< Valid time: the valid time, when the time is not inside a DataSet.
486 
487  std::auto_ptr<te::dt::DateTimeProperty> m_resultTimePropInfo; //!< Result time: information about the DataSet property that contains the result time.
488  std::auto_ptr<te::dt::DateTimeInstant> m_resultTime; //!< Result time: the result time, when the time is not inside a DataSet.
489 
490  std::vector<int> m_observedPropIdx; //!< Observed properties: the indexes of DataSet properties that are observed.
491  std::vector<std::string> m_observedPropName; //!< Observed properties: the names of DataSet properties that are observed.
492 
493  std::auto_ptr<te::gm::GeometryProperty> m_geomPropInfo; //!< Geometry: information about the property that has the observation spatial location
494  std::auto_ptr<te::gm::Geometry> m_geom; //!< Geometry: the geometry, when the spatial location of the observations are not in the DataSet.
495 
496  int m_idPropIndex; //!< Id: the index of DataSet property that contain the id of each group of observation.
497  std::string m_idPropName; //!< Id: the name of DataSet property that contain the id of each group of observation.
498  std::string m_id; //!< Id: the id associated to all observations
499 
500  std::auto_ptr<te::gm::Geometry> m_spatialExtent; //!< Spatial extent
501  std::auto_ptr<te::dt::DateTimePeriod> m_temporalExtent; //!< Temporal extent
502  };
503  } // end namespace st
504 } // end namespace te
505 
506 #endif // __TERRALIB_ST_INTERNAL_OBSERVATIONDATASETTYPE_H
507 
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
Geometric property.
boost::ptr_vector< te::dt::DateTimeProperty > m_validTimePropInfo
Valid time: information about the DataSet properties that contain the valid time. ...
std::string m_dsName
The DataSet name.
std::auto_ptr< te::gm::GeometryProperty > m_geomPropInfo
Geometry: information about the property that has the observation spatial location.
std::auto_ptr< te::gm::Geometry > m_spatialExtent
Spatial extent.
std::auto_ptr< te::dt::DateTimePeriod > m_validTime
Valid time: the valid time, when the time is not inside a DataSet.
std::auto_ptr< te::dt::DateTimeInstant > m_resultTime
Result time: the result time, when the time is not inside a DataSet.
std::string m_idPropName
Id: the name of DataSet property that contain the id of each group of observation.
int m_idPropIndex
Id: the index of DataSet property that contain the id of each group of observation.
std::vector< int > m_observedPropIdx
Observed properties: the indexes of DataSet properties that are observed.
URI C++ Library.
std::auto_ptr< te::dt::DateTime > m_phTime
Phenomenon time: the phenomenon time, when the time is not inside a DataSet.
boost::ptr_vector< te::dt::DateTimeProperty > m_phTimePropInfo
Phenomenon time: information about the DataSet properties that contain the phenomenon time...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
std::auto_ptr< te::gm::Geometry > m_geom
Geometry: the geometry, when the spatial location of the observations are not in the DataSet...
std::auto_ptr< te::dt::DateTimePeriod > m_temporalExtent
Temporal extent.
std::string m_id
Id: the id associated to all observations.
std::vector< std::string > m_observedPropName
Observed properties: the names of DataSet properties that are observed.
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 class that contains complemental DataSetType information about a DataSet that holds observations...
std::auto_ptr< te::dt::DateTimeProperty > m_resultTimePropInfo
Result time: information about the DataSet property that contains the result time.
An abstract class to represent an instant of date and time.