All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DataSetLayer.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/maptools/DataSetLayer.h
22 
23  \brief A layer with reference to a dataset.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_DATASETLAYER_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_DATASETLAYER_H
28 
29 // TerraLib
30 #include "AbstractLayer.h"
31 
32 namespace te
33 {
34  namespace map
35  {
36  /*!
37  \class DataSetLayer
38 
39  \brief A layer with reference to a dataset.
40 
41  A DataSetLayer is a reference to a dataset with/without geometric attributes.
42 
43  \ingroup map
44 
45  \sa AbstractLayer, QueryLayer, RasterLayer, FolderLayer
46  */
48  {
49  public:
50 
51  /*!
52  \brief It initializes a new layer.
53 
54  \param parent The parent layer (NULL if it has no parent).
55  */
56  DataSetLayer(AbstractLayer* parent = 0);
57 
58  /*!
59  \brief It initializes a new layer.
60 
61  \param id The layer id.
62  \param parent The parent layer (NULL if it has no parent).
63  */
64  DataSetLayer(const std::string& id, AbstractLayer* parent = 0);
65 
66  /*!
67  \brief It initializes a new Layer.
68 
69  \param id The layer id.
70  \param title The title is a brief description about the layer.
71  \param parent The parent layer (NULL if it has no parent).
72  */
73  DataSetLayer(const std::string& id, const std::string& title, AbstractLayer* parent = 0);
74 
75  /*! \brief Destructor. */
76  ~DataSetLayer();
77 
78  std::auto_ptr<LayerSchema> getSchema() const;
79 
80  std::auto_ptr<te::da::DataSet> getData(te::common::TraverseType travType = te::common::FORWARDONLY,
81  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
82 
83  std::auto_ptr<te::da::DataSet> getData(const std::string& propertyName,
84  const te::gm::Envelope* e,
87  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
88 
89  std::auto_ptr<te::da::DataSet> getData(const std::string& propertyName,
90  const te::gm::Geometry* g,
93  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
94 
95  std::auto_ptr<te::da::DataSet> getData(te::da::Expression* restriction,
97  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
98 
99  std::auto_ptr<te::da::DataSet> getData(const te::da::ObjectIdSet* oids,
101  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
102 
103  bool isValid() const;
104 
105  void draw(Canvas* canvas, const te::gm::Envelope& bbox, int srid);
106 
107  /*!
108  \brief It returns the layer type: DATASET_LAYER.
109 
110  \return The layer type: DATASET_LAYER.
111  */
112  const std::string& getType() const;
113 
114  /*!
115  \brief
116 
117  \return
118  */
119  const std::string& getDataSetName() const;
120 
121  /*!
122  \brief
123 
124  \param name
125  */
126  void setDataSetName(const std::string& name);
127 
128  /*!
129  \brief
130 
131  \return
132  */
133  const std::string& getDataSourceId() const;
134 
135  /*!
136  \brief
137 
138  \param id
139  */
140  void setDataSourceId(const std::string& id);
141 
142  /*!
143  \brief
144 
145  \return
146  */
147  const std::string& getRendererType() const;
148 
149  /*!
150  \brief
151 
152  \param t
153  */
154  void setRendererType(const std::string& t);
155 
156  /*!
157  \brief Its indicate that the layer schema is out of date.
158  */
159  virtual void setOutOfDate();
160 
161  private:
162 
163  std::string m_datasetName; //!< The dataset name where we will retrieve the layer objects.
164  std::string m_datasourceId; //!< The DataSource associated to this layer.
165  std::string m_rendererType; //!< A pointer to the internal renderer used to paint this layer.
166  mutable LayerSchema* m_schema; //!< The dataset schema.
167 
168  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
169  };
170 
171  typedef boost::intrusive_ptr<DataSetLayer> DataSetLayerPtr;
172 
173  } // end namespace map
174 } // end namespace te
175 
176 #endif // __TERRALIB_MAPTOOLS_INTERNAL_DATASETLAYER_H
This is the base class for layers.
Definition: AbstractLayer.h:76
A class that models the description of a dataset.
Definition: DataSetType.h:72
This is the base class for Layers.
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
Definition: DataSetLayer.h:165
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:122
This is an abstract class that models a query expression.
Definition: Expression.h:47
std::string m_datasetName
The dataset name where we will retrieve the layer objects.
Definition: DataSetLayer.h:163
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
static const std::string sm_type
A static data member used in the implementation of getType method.
Definition: DataSetLayer.h:168
std::string m_datasourceId
The DataSource associated to this layer.
Definition: DataSetLayer.h:164
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:91
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr
Definition: DataSetLayer.h:171
LayerSchema * m_schema
The dataset schema.
Definition: DataSetLayer.h:166
A layer with reference to a dataset.
Definition: DataSetLayer.h:47