TimeSeriesDataSetLayer.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 terralib/st/maptools/TimeSeriesDataSetLayer.h
22 
23  \brief A layer with a reference to an TimeSeriesDataSet.
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_TIMESERIESDATASETLAYER_H
27 #define __TERRALIB_ST_INTERNAL_TIMESERIESDATASETLAYER_H
28 
29 // ST
30 #include "../Config.h"
31 #include "AbstractSTDataSetLayer.h"
32 
33 // Boost
34 #include <boost/ptr_container/ptr_vector.hpp>
35 
36 namespace te
37 {
38  namespace st
39  {
40 
41  //Forward declarations
42  class TimeSeriesDataSet;
43  class TimeSeriesDataSetInfo;
44 
46 
47  /*!
48  \class TimeSeriesDataSetLayer
49 
50  \brief A layer with reference to a dataset that contains trajectories.
51 
52  \sa AbstractLayer, AbstractSTDataSetLayer
53  */
55  {
56  public:
57 
58  /*!
59  \brief It initializes a new layer.
60 
61  \param parent The parent layer (NULL if it has no parent).
62  \param info Infos about the data source and its data set that contains observations.
63 
64  \note It will take the ownership of the given pointer info
65  */
66  TimeSeriesDataSetLayer(AbstractLayer* parent, TimeSeriesDataSetInfo* info);
67 
68  /*!
69  \brief It initializes a new layer.
70 
71  \param id The layer id.
72  \param parent The parent layer (NULL if it has no parent).
73  \param info Infos about the data source and its data set that contains observations.
74 
75  \note It will take the ownership of the given pointer info
76  */
77  TimeSeriesDataSetLayer(const std::string& id, AbstractLayer* parent, TimeSeriesDataSetInfo* info);
78 
79  /*!
80  \brief It initializes a new Layer.
81 
82  \param id The layer id.
83  \param title The title is a brief description about the layer.
84  \param parent The parent layer (NULL if it has no parent).
85  \param info Infos about the data source and its data set that contains observations.
86 
87  \note It will take the ownership of the given pointer info
88  */
89  TimeSeriesDataSetLayer(const std::string& id, const std::string& title, AbstractLayer* parent, TimeSeriesDataSetInfo* info);
90 
91  /*! \brief Destructor. */
93 
94  AbstractLayer* clone() { return nullptr; }
95 
96  std::unique_ptr<LayerSchema> getSchema() const;
97 
98  /*!
99  \brief It returns the layer temporal extent.
100 
101  \return The layer temporal extent.
102  */
104 
105  std::unique_ptr<te::da::DataSet> getData(te::common::TraverseType travType = te::common::FORWARDONLY,
106  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
107 
108  std::unique_ptr<te::da::DataSet> getData(const std::string& propertyName,
109  const te::gm::Envelope* e,
112  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
113 
114  std::unique_ptr<te::da::DataSet> getData(const std::string& propertyName,
115  const te::gm::Geometry* g,
118  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
119 
120  std::unique_ptr<te::da::DataSet> getData(te::da::Expression* restriction,
122  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
123 
124  std::unique_ptr<te::da::DataSet> getData(const te::da::ObjectIdSet* oids,
126  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
127 
128  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset(te::common::TraverseType travType = te::common::FORWARDONLY) const;
129 
130  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset(const te::gm::Envelope& e,
133 
134  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset(const te::gm::Geometry& g,
137 
138  std::unique_ptr<te::da::DataSet> getData( const te::dt::DateTime& dt, te::dt::TemporalRelation r = te::dt::DURING,
141 
142  std::unique_ptr<te::da::DataSet> getData( const te::dt::DateTime& dt, te::dt::TemporalRelation tr,
146 
147  std::unique_ptr<te::da::DataSet> getData( const te::dt::DateTime& dt, te::dt::TemporalRelation tr,
151 
152  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset( const te::dt::DateTime& dt, te::dt::TemporalRelation r = te::dt::DURING,
154 
155  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset( const te::dt::DateTime& dt, te::dt::TemporalRelation tr,
158 
159  std::unique_ptr<te::st::TimeSeriesDataSet> getTimeSeriesDataset( const te::dt::DateTime& dt, te::dt::TemporalRelation tr,
162 
163  bool isValid() const;
164 
165  void draw(te::map::Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
166 
167  /*!
168  \brief It returns the layer type: TIMESERIESDATASETLAYER.
169 
170  \return The layer type: TIMESERIESDATASETLAYER.
171  */
172  const std::string& getType() const;
173 
174  /*!
175  \brief
176 
177  \return
178  */
179  const std::string& getDataSourceId() const;
180 
181  /*!
182  \brief
183 
184  \return
185  */
186  const std::string& getRendererType() const;
187 
188  /*!
189  \brief
190 
191  \param t
192  */
193  void setRendererType(const std::string& t);
194 
195  /*!
196  \brief Checks if the layer has any childs
197 
198  \return true if the layer has any childs, otherwise returns false
199  */
200 
201  bool hasChilds();
202 
203  private:
204 
205  boost::ptr_vector<TimeSeriesDataSetLayer> m_layers; //!, A container the holds any child layers.
206  std::unique_ptr<TimeSeriesDataSetInfo> m_info; //!< Infos about the data source and its data set that contains observations.
207  std::string m_rendererType; //!< A pointer to the internal renderer used to paint this layer.
208  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
209  };
210 
211  typedef boost::intrusive_ptr<TimeSeriesDataSetLayer> TimeSeriesDataSetLayerPtr;
212 
213  } // end namespace st
214 } // end namespace te
215 
216 #endif // __TERRALIB_ST_INTERNAL_TIMESERIESDATASETLAYER_H
This file has the AbstractSTDataSetLayer class that provides an abstract interface for layers that co...
A class that models the description of a dataset.
Definition: DataSetType.h:73
This is an abstract class that models a query expression.
Definition: Expression.h:48
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56
An abstract class to represent a period of date and time.
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:93
A layer with reference to a dataset that contains spatiotemporal data.
A class that contains infos about a DataSet that contains observations of one or more time series.
A layer with reference to a dataset that contains trajectories.
std::unique_ptr< te::da::DataSet > getData(const te::dt::DateTime &dt, te::dt::TemporalRelation tr, const te::gm::Geometry &g, te::gm::SpatialRelation sr=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY, te::common::AccessPolicy rwRole=te::common::RAccess) const
It gets the dataset using a temporal filter over the phenomenon time property and a spatial filter ov...
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(const te::gm::Geometry &g, te::gm::SpatialRelation r, te::common::TraverseType travType=te::common::FORWARDONLY) const
void draw(te::map::Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)
It draws the layer geographic objects in the given canvas using the informed SRS.
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(const te::dt::DateTime &dt, te::dt::TemporalRelation tr, const te::gm::Envelope &e, te::gm::SpatialRelation sr=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY) const
te::dt::DateTimePeriod * getTemporalExtent() const
It returns the layer temporal extent.
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(const te::gm::Envelope &e, te::gm::SpatialRelation r=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY) const
TimeSeriesDataSetLayer(const std::string &id, AbstractLayer *parent, TimeSeriesDataSetInfo *info)
It initializes a new layer.
TimeSeriesDataSetLayer(const std::string &id, const std::string &title, AbstractLayer *parent, TimeSeriesDataSetInfo *info)
It initializes a new Layer.
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(const te::dt::DateTime &dt, te::dt::TemporalRelation r=te::dt::DURING, te::common::TraverseType travType=te::common::FORWARDONLY) const
std::unique_ptr< te::da::DataSet > getData(const te::da::ObjectIdSet *oids, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset from the given set of objects identification.
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(const te::dt::DateTime &dt, te::dt::TemporalRelation tr, const te::gm::Geometry &g, te::gm::SpatialRelation sr=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY) const
std::unique_ptr< te::da::DataSet > getData(const std::string &propertyName, const te::gm::Envelope *e, te::gm::SpatialRelation r=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset identified by the layer name using a spatial filter over the specified property.
AbstractLayer * clone()
It returns a clone of the object.
static const std::string sm_type
A static data member used in the implementation of getType method.
bool hasChilds()
Checks if the layer has any childs.
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
TimeSeriesDataSetLayer(AbstractLayer *parent, TimeSeriesDataSetInfo *info)
It initializes a new layer.
const std::string & getDataSourceId() const
const std::string & getRendererType() const
std::unique_ptr< LayerSchema > getSchema() const
It returns the layer schema.
std::unique_ptr< te::st::TimeSeriesDataSet > getTimeSeriesDataset(te::common::TraverseType travType=te::common::FORWARDONLY) const
std::unique_ptr< TimeSeriesDataSetInfo > m_info
, A container the holds any child layers.
const std::string & getType() const
It returns the layer type: TIMESERIESDATASETLAYER.
std::unique_ptr< te::da::DataSet > getData(te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset identified by the layer name.
void setRendererType(const std::string &t)
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false.
std::unique_ptr< te::da::DataSet > getData(const te::dt::DateTime &dt, te::dt::TemporalRelation tr, const te::gm::Envelope &e, te::gm::SpatialRelation sr=te::gm::INTERSECTS, te::common::TraverseType travType=te::common::FORWARDONLY, te::common::AccessPolicy rwRole=te::common::RAccess) const
It gets the dataset using a temporal filter over the phenomenon time property and a spatial filter ov...
std::unique_ptr< te::da::DataSet > getData(const std::string &propertyName, const te::gm::Geometry *g, te::gm::SpatialRelation r, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset identified by the layer name using a spatial filter over the given geometric prop...
std::unique_ptr< te::da::DataSet > getData(te::da::Expression *restriction, te::common::TraverseType travType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset identified by the layer name using the given restriction.
std::unique_ptr< te::da::DataSet > getData(const te::dt::DateTime &dt, te::dt::TemporalRelation r=te::dt::DURING, te::common::TraverseType travType=te::common::FORWARDONLY, te::common::AccessPolicy rwRole=te::common::RAccess) const
It gets the dataset using a temporal filter over the phenomenon time property.
boost::ptr_vector< TimeSeriesDataSetLayer > m_layers
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:54
@ FORWARDONLY
Definition: Enums.h:55
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:41
@ RAccess
Definition: Enums.h:43
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
Definition: Enums.h:141
@ DURING
Definition: Enums.h:145
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:128
@ INTERSECTS
Definition: Enums.h:130
boost::intrusive_ptr< TimeSeriesDataSetLayer > TimeSeriesDataSetLayerPtr
te::da::DataSetType LayerSchema
TerraLib.
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88