RasterLayer.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/RasterLayer.h
22 
23  \brief A layer with reference to a raster.
24 */
25 
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_RASTERLAYER_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_RASTERLAYER_H
28 
29 // TerraLib
30 #include "AbstractLayer.h"
31 
32 // STL
33 #include <map>
34 #include <memory>
35 
36 namespace te
37 {
38 // Forward declaration
39  namespace rst { class Raster; }
40 
41  namespace map
42  {
43  /*!
44  \class RasterLayer
45 
46  \brief A layer with reference to a raster.
47 
48  \ingroup map
49 
50  \sa AbstractLayer, DataSetLayer, QueryLayer, FolderLayer
51  */
53  {
54  public:
55 
56  /*!
57  \brief It initializes a new layer.
58 
59  \param parent The parent layer (NULL if it has no parent).
60  */
61  RasterLayer(AbstractLayer* parent = 0);
62 
63  /*!
64  \brief It initializes a new layer.
65 
66  \param id The layer id.
67  \param parent The parent layer (NULL if it has no parent).
68  */
69  RasterLayer(const std::string& id, AbstractLayer* parent = 0);
70 
71  /*!
72  \brief It initializes a new Layer.
73 
74  \param id The layer id.
75  \param title The title is a brief description about the layer.
76  \param parent The parent layer (NULL if it has no parent).
77  */
78  RasterLayer(const std::string& id, const std::string& title, AbstractLayer* parent = 0);
79 
80  /*! \brief Destructor. */
82 
84 
85  std::unique_ptr<LayerSchema> getSchema() const;
86 
87  std::unique_ptr<te::da::DataSet> getData(te::common::TraverseType travType = te::common::FORWARDONLY,
88  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
89 
90  std::unique_ptr<te::da::DataSet> getData(const std::string& /*propertyName*/,
91  const te::gm::Envelope* /*e*/,
94  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
95 
96  std::unique_ptr<te::da::DataSet> getData(const std::string& /*propertyName*/,
97  const te::gm::Geometry* /*g*/,
100  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
101 
102  std::unique_ptr<te::da::DataSet> getData(te::da::Expression* /*restriction*/,
104  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
105 
106  std::unique_ptr<te::da::DataSet> getData(const te::da::ObjectIdSet* /*oids*/,
108  const te::common::AccessPolicy accessPolicy = te::common::RAccess) const;
109 
110  /*!
111  \brief It returns the layer type: RASTER_LAYER.
112 
113  \return The layer type: RASTER_LAYER.
114  */
115  const std::string& getType() const;
116 
117  bool isValid() const;
118 
119  void draw(Canvas* canvas, const te::gm::Envelope& bbox, int srid, const double& scale, bool* cancel);
120 
121  /*!
122  \brief
123 
124  \return
125  */
126  const std::string& getRendererType() const;
127 
128  /*!
129  \brief
130 
131  \param t
132  */
133  void setRendererType(const std::string& t);
134 
135  /*!
136  \brief
137 
138  \return Raster Ptr
139 
140  \note The caller of this method WILL TAKE the ownership of the raster.
141  */
143 
144  /*!
145  \brief
146 
147  \param rinfo Map of string for raster connection info.
148  */
149  void setRasterInfo(const std::map<std::string, std::string>& rinfo);
150 
151  /*!
152  \brief
153 
154  \return A raster connection info
155  */
156  std::map<std::string, std::string> getRasterInfo() const;
157 
158  private:
159 
160  std::string m_rendererType; //!< A pointer to the internal renderer used to paint this layer.
161  std::map<std::string, std::string> m_rinfo; //!< A raster connection info.
162  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
163  };
164 
165  typedef boost::intrusive_ptr<RasterLayer> RasterLayerPtr;
166 
167  } // end namespace map
168 } // end namespace te
169 
170 #endif // __TERRALIB_MAPTOOLS_INTERNAL_RASTERLAYER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te::map::RasterLayer::clone
AbstractLayer * clone()
It returns a clone of the object.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::map::RasterLayer::m_rinfo
std::map< std::string, std::string > m_rinfo
A raster connection info.
Definition: RasterLayer.h:161
te::map::RasterLayer::getRaster
te::rst::Raster * getRaster() const
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::common::RAccess
@ RAccess
Definition: Enums.h:43
te::map::RasterLayer::getData
std::unique_ptr< te::da::DataSet > getData(const std::string &, const te::gm::Geometry *, te::gm::SpatialRelation, te::common::TraverseType=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::RasterLayer::getData
std::unique_ptr< te::da::DataSet > getData(const std::string &, const te::gm::Envelope *, te::gm::SpatialRelation=te::gm::INTERSECTS, te::common::TraverseType=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::RasterLayerPtr
boost::intrusive_ptr< RasterLayer > RasterLayerPtr
Definition: RasterLayer.h:165
te::map::RasterLayer::getData
std::unique_ptr< te::da::DataSet > getData(const te::da::ObjectIdSet *, te::common::TraverseType=te::common::FORWARDONLY, const te::common::AccessPolicy accessPolicy=te::common::RAccess) const
It gets the dataset from the given set of objects identification.
te::map::RasterLayer::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::common::TraverseType
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:54
te::map::RasterLayer::getRasterInfo
std::map< std::string, std::string > getRasterInfo() const
te::map::RasterLayer
A layer with reference to a raster.
Definition: RasterLayer.h:53
te::map::RasterLayer::~RasterLayer
~RasterLayer()
Destructor.
te::map::RasterLayer::isValid
bool isValid() const
It returns true if the layer can be used for instance to draw, otherwise, it returns false.
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::RasterLayer::RasterLayer
RasterLayer(AbstractLayer *parent=0)
It initializes a new layer.
te::map::RasterLayer::RasterLayer
RasterLayer(const std::string &id, const std::string &title, AbstractLayer *parent=0)
It initializes a new Layer.
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::RasterLayer::RasterLayer
RasterLayer(const std::string &id, AbstractLayer *parent=0)
It initializes a new layer.
te::map::RasterLayer::m_rendererType
std::string m_rendererType
A pointer to the internal renderer used to paint this layer.
Definition: RasterLayer.h:160
te::map::RasterLayer::sm_type
static const std::string sm_type
A static data member used in the implementation of getType method.
Definition: RasterLayer.h:162
te::map::RasterLayer::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.
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::RasterLayer::getRendererType
const std::string & getRendererType() const
te::map::RasterLayer::setRendererType
void setRendererType(const std::string &t)
te::map::RasterLayer::getData
std::unique_ptr< te::da::DataSet > getData(te::da::Expression *, te::common::TraverseType=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::RasterLayer::getSchema
std::unique_ptr< LayerSchema > getSchema() const
It returns the layer schema.
te::map::RasterLayer::setRasterInfo
void setRasterInfo(const std::map< std::string, std::string > &rinfo)
te::map::RasterLayer::getType
const std::string & getType() const
It returns the layer type: RASTER_LAYER.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::common::AccessPolicy
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:41
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