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