ProxyRaster.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/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 
41  \ingroup rst
42  */
44  {
45  public:
46 
47  /*!
48  \brief Constructor from a set of rasters.
49 
50  The bands of the proxy raster will be taken from the input set of raster.
51 
52  \param rasters A vector with the list of raster covering the same region (all pointers must remain valid while this instance is active).
53 
54  \param takeRastersOwnership If true, this instance will take input rasters ownership.
55 
56  \pre All rasters must cover the same region, have the same grid parameters.
57 
58  \note It is desired, but not required, that all raster have the same block size.
59 
60  */
61  ProxyRaster( const std::vector< te::rst::Raster* >& rasters,
62  const bool takeRastersOwnership );
63 
64  /*!
65  \brief Constructor from a set of rasters.
66 
67  The bands of the proxy raster will be taken from the input set of raster.
68 
69  \param rasters A vector with the list of raster covering the same region.
70 
71  \pre All rasters must cover the same region, have the same grid parameters.
72 
73  \note It is desired, but not required, that all raster have the same block size.
74  */
75  ProxyRaster(const std::vector<RasterPtr>& rasters);
76 
77  /*!
78  \brief Copy constructor.
79 
80  \param rhs The right-hand side Raster.
81  */
82  ProxyRaster(const ProxyRaster& rhs);
83 
84  /*! \brief Destructor. */
85  ~ProxyRaster();
86 
87  void swap(std::size_t first, std::size_t second);
88 
89  void open(const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess);
90 
91  std::map<std::string, std::string> getInfo() const;
92 
93  std::size_t getNumberOfBands() const;
94 
95  int getBandDataType(std::size_t i) const;
96 
97  const Band* getBand(std::size_t i) const;
98 
99  Band* getBand(std::size_t i);
100 
101  const Band& operator[](std::size_t i) const;
102 
103  Band& operator[](std::size_t i);
104 
105  te::dt::AbstractData* clone() const;
106 
107  bool createMultiResolution( const unsigned int levels, const InterpolationMethod interpMethod )
108  {
109  return false;
110  };
111 
112  bool removeMultiResolution() { return false; };
113 
114  unsigned int getMultiResLevelsCount() const
115  {
116  return 0;
117  }
118 
119  Raster* getMultiResLevel( const unsigned int level ) const
120  {
121  return 0;
122  }
123 
124  protected:
125 
126  std::vector<RasterPtr> m_rasters; //!< The list of proxed rasters.
127  std::vector<Band*> m_bands; //!< The proxy raster bands.
128  std::map<std::string, std::string> m_rinfo; //!< Proxy raster additional information.
129  };
130 
131  typedef boost::shared_ptr<ProxyRaster> ProxyRasterPtr;
132 
133  } // end namespace rst
134 } // end namespace te
135 
136 #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:63
bool removeMultiResolution()
Remove/Destroy a sub-sampled multi-resolution pyramid, if there is one.
Definition: ProxyRaster.h:112
Raster * getMultiResLevel(const unsigned int level) const
Returns the required level of a multi-resolution pyramid or NULL if that level does not exists...
Definition: ProxyRaster.h:119
boost::shared_ptr< ProxyRaster > ProxyRasterPtr
Definition: ProxyRaster.h:131
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
bool createMultiResolution(const unsigned int levels, const InterpolationMethod interpMethod)
Create a sub-sampled multi-resolution pyramid.
Definition: ProxyRaster.h:107
std::map< std::string, std::string > m_rinfo
Proxy raster additional information.
Definition: ProxyRaster.h:128
std::vector< RasterPtr > m_rasters
The list of proxed rasters.
Definition: ProxyRaster.h:126
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:127
TerraLib.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:55
A raster band description.
Definition: Band.h:63
unsigned int getMultiResLevelsCount() const
Returns the current number of multi-resolution pyramid levels.
Definition: ProxyRaster.h:114
A proxy class for bands of several rasters over the same region.
Definition: ProxyRaster.h:43