DataSetAdapterLayer.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/DataSetAdapterLayer.h
22 
23  \brief A layer with reference to a DataSetTypeConverter.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_DATASETADAPTERLAYER_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_DATASETADAPTERLAYER_H
28 
29 // TerraLib
30 #include "../sam/rtree/Index.h"
31 #include "../sam/rtree.h"
32 #include "AbstractLayer.h"
33 
34 namespace te
35 {
36 
37  namespace da { class DataSetTypeConverter; }
38 
39  namespace map
40  {
41  /*!
42  \class DataSetAdapterLayer
43 
44  \brief A layer with reference to a DataSetTypeConverter.
45 
46  A DataSetAdapterLayer is a reference to a DataSetTypeConverter.
47 
48  \sa AbstractLayer, QueryLayer, RasterLayer, FolderLayer, DatasetLayer
49  */
51  {
52  public:
53 
54  /*!
55  \brief It initializes a new layer.
56 
57  \param parent The parent layer (NULL if it has no parent).
58  */
60 
61  /*!
62  \brief It initializes a new layer.
63 
64  \param id The layer id.
65  \param parent The parent layer (NULL if it has no parent).
66  */
67  DataSetAdapterLayer(const std::string& id, AbstractLayer* parent = 0);
68 
69  /*!
70  \brief It initializes a new Layer.
71 
72  \param id The layer id.
73  \param title The title is a brief description about the layer.
74  \param parent The parent layer (NULL if it has no parent).
75  */
76  DataSetAdapterLayer(const std::string& id, const std::string& title, AbstractLayer* parent = 0);
77 
78  /*! \brief Destructor. */
80 
81  AbstractLayer* clone() {return nullptr;}
82 
83  std::unique_ptr<LayerSchema> getSchema() const;
84 
85  std::unique_ptr<te::da::DataSet> getData(te::common::TraverseType travType = te::common::FORWARDONLY,
86  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
87 
88  std::unique_ptr<te::da::DataSet> getData(const std::string& propertyName,
89  const te::gm::Envelope* e,
92  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
93 
94  std::unique_ptr<te::da::DataSet> getData(const std::string& propertyName,
95  const te::gm::Geometry* g,
98  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
99 
100  std::unique_ptr<te::da::DataSet> getData(te::da::Expression* restriction,
102  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
103 
104  std::unique_ptr<te::da::DataSet> getData(const te::da::ObjectIdSet* oids,
106  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
107 
108  bool isValid() const;
109 
110  void draw(Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
111 
112  /*!
113  \brief It returns the DataSetTypeConverter.
114 
115  \return The he DataSetTypeConverter.
116  \note The caller will not take ownership of the returned pointer.
117  */
119 
120  /*!
121  \brief
122  It sets the converter that will be used by the layer
123  */
124  void setConverter(std::unique_ptr<te::da::DataSetTypeConverter> converter);
125 
126  /*!
127  \brief It returns the layer type: DATASET_LAYER.
128 
129  \return The layer type: DATASET_LAYER.
130  */
131  const std::string& getType() const;
132 
133  /*!
134  \brief
135 
136  \return
137  */
138  const std::string& getRendererType() const;
139 
140  /*!
141  \brief
142 
143  \param t
144  */
145  void setRendererType(const std::string& t);
146 
147  private:
148 
149  std::unique_ptr<te::da::DataSetTypeConverter> m_converter; //!< The DataSetConverter that will be cused to configure the layer.
150 
151  std::string m_rendererType; //!< A pointer to the internal renderer used to paint this layer.
152  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
153 
155  };
156 
157  typedef boost::intrusive_ptr<DataSetAdapterLayer> DataSetAdapterLayerPtr;
158 
159  } // end namespace map
160 } // end namespace te
161 
162 #endif // __TERRALIB_MAPTOOLS_INTERNAL_DATASETADAPTERLAYER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::map::DataSetAdapterLayer::getType
const std::string & getType() const
It returns the layer type: DATASET_LAYER.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::map::DataSetAdapterLayer::isValid
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false.
te::sam::rtree::Index< std::size_t, 4 >
te::map::DataSetAdapterLayer::DataSetAdapterLayer
DataSetAdapterLayer(const std::string &id, AbstractLayer *parent=0)
It initializes a new layer.
te::common::RAccess
@ RAccess
Definition: Enums.h:43
te::common::TraverseType
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:54
te::map::DataSetAdapterLayer::setConverter
void setConverter(std::unique_ptr< te::da::DataSetTypeConverter > converter)
It sets the converter that will be used by the layer.
te::map::DataSetAdapterLayer::m_rendererType
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
Definition: DataSetAdapterLayer.h:151
te::map::DataSetAdapterLayerPtr
boost::intrusive_ptr< DataSetAdapterLayer > DataSetAdapterLayerPtr
Definition: DataSetAdapterLayer.h:157
te::map::DataSetAdapterLayer::~DataSetAdapterLayer
~DataSetAdapterLayer()
Destructor.
te::map::DataSetAdapterLayer::getSchema
std::unique_ptr< LayerSchema > getSchema() const
It returns the layer schema.
te::map::DataSetAdapterLayer::getData
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.
te::map::DataSetAdapterLayer::m_rtree
te::sam::rtree::Index< std::size_t, 4 > m_rtree
Definition: DataSetAdapterLayer.h:154
te::map::DataSetAdapterLayer::sm_type
static const std::string sm_type
A static data member used in the implementation of getType method.
Definition: DataSetAdapterLayer.h:152
te::gm::SpatialRelation
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:128
te::da::Expression
This is an abstract class that models a query expression.
Definition: Expression.h:48
te::map::DataSetAdapterLayer::getRendererType
const std::string & getRendererType() const
te::map::AbstractLayer
This is the base class for layers.
Definition: AbstractLayer.h:78
te::map::Canvas
A canvas is an abstraction of a drawing area.
Definition: Canvas.h:93
te::gm::INTERSECTS
@ INTERSECTS
Definition: Enums.h:130
te::map::DataSetAdapterLayer::getData
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.
te::map::DataSetAdapterLayer::getData
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.
te::map::DataSetAdapterLayer::clone
AbstractLayer * clone()
It returns a clone of the object.
Definition: DataSetAdapterLayer.h:81
te::map::DataSetAdapterLayer::getData
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...
te::map::DataSetAdapterLayer::getConverter
te::da::DataSetTypeConverter * getConverter() const
It returns the DataSetTypeConverter.
te::map::DataSetAdapterLayer::getData
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.
AbstractLayer.h
This is the base class for Layers.
TEMAPEXPORT
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
te::map::DataSetAdapterLayer::DataSetAdapterLayer
DataSetAdapterLayer(const std::string &id, const std::string &title, AbstractLayer *parent=0)
It initializes a new Layer.
te::map::DataSetAdapterLayer::m_converter
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
The DataSetConverter that will be cused to configure the layer.
Definition: DataSetAdapterLayer.h:149
te::map::DataSetAdapterLayer::draw
void draw(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.
te::map::DataSetAdapterLayer::setRendererType
void setRendererType(const std::string &t)
te::map::DataSetAdapterLayer::DataSetAdapterLayer
DataSetAdapterLayer(AbstractLayer *parent=0)
It initializes a new layer.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::da::DataSetTypeConverter
An converter for DataSetType.
Definition: DataSetTypeConverter.h:60
te::common::AccessPolicy
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:41
te::map::DataSetAdapterLayer
A layer with reference to a DataSetTypeConverter.
Definition: DataSetAdapterLayer.h:51
te::da::ObjectIdSet
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56
te::common::FORWARDONLY
@ FORWARDONLY
Definition: Enums.h:55