All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ProxyRaster.h
Go to the documentation of this file.
1 /* Copyright (C) 2008-2013 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/raster/ProxyRaster.h
22 
23  \brief A proxy class for bands of several rasters over the same region.
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_PROXYRASTER_H
27 #define __TERRALIB_RASTER_INTERNAL_PROXYRASTER_H
28 
29 // TerraLib
30 #include "Raster.h"
31 
32 namespace te
33 {
34  namespace rst
35  {
36  /*!
37  \class ProxyRaster
38 
39  \brief A proxy class for bands of several rasters over the same region.
40  */
42  {
43  public:
44 
45  /*!
46  \brief Constructor from a set of rasters.
47 
48  The bands of the proxy raster will be taken from the input set of raster.
49 
50  \param rasters A vector with the list of raster covering the same region.
51 
52  \pre All rasters must cover the same region, have the same grid parameters.
53 
54  \note It is desired, but not required, that all raster have the same block size.
55  */
56  ProxyRaster(const std::vector<RasterPtr>& rasters);
57 
58  /*!
59  \brief Copy constructor.
60 
61  \param rhs The right-hand side Raster.
62  */
63  ProxyRaster(const ProxyRaster& rhs);
64 
65  /*! \brief Destructor. */
66  ~ProxyRaster();
67 
68  void swap(std::size_t first, std::size_t second);
69 
70  void open(const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess);
71 
72  std::map<std::string, std::string> getInfo() const;
73 
74  std::size_t getNumberOfBands() const;
75 
76  int getBandDataType(std::size_t i) const;
77 
78  const Band* getBand(std::size_t i) const;
79 
80  Band* getBand(std::size_t i);
81 
82  const Band& operator[](std::size_t i) const;
83 
84  Band& operator[](std::size_t i);
85 
86  te::dt::AbstractData* clone() const { return 0; }
87 
88  protected:
89 
90  std::vector<RasterPtr> m_rasters; //!< The list of proxed rasters.
91  std::vector<Band*> m_bands; //!< The proxy raster bands.
92  std::map<std::string, std::string> m_rinfo; //!< Proxy raster additional information.
93  };
94 
95  typedef boost::shared_ptr<ProxyRaster> ProxyRasterPtr;
96 
97  } // end namespace rst
98 } // end namespace te
99 
100 #endif //__TERRALIB_RASTER_INTERNAL_PROXYRASTER_H
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:65
boost::shared_ptr< ProxyRaster > ProxyRasterPtr
Definition: ProxyRaster.h:95
std::map< std::string, std::string > m_rinfo
Proxy raster additional information.
Definition: ProxyRaster.h:92
std::vector< RasterPtr > m_rasters
The list of proxed rasters.
Definition: ProxyRaster.h:90
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
An abstract class for raster data strucutures.
An abstract class for raster data strucutures.
Definition: Raster.h:71
std::vector< Band * > m_bands
The proxy raster bands.
Definition: ProxyRaster.h:91
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
A raster band description.
Definition: Band.h:63
A proxy class for bands of several rasters over the same region.
Definition: ProxyRaster.h:41
te::dt::AbstractData * clone() const
It returns a clone of this object.
Definition: ProxyRaster.h:86