Loading...
Searching...
No Matches
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
32namespace 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 */
83
84 /*! \brief Destructor. */
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
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
129 /*!
130 \brief This instance info.
131 */
132 std::map<std::string, std::string> m_rasterInfo;
133
134 /*!
135 \brief update This instance raster info.
136 */
138 };
139
140 typedef boost::shared_ptr<ProxyRaster> ProxyRasterPtr;
141
142 } // end namespace rst
143} // end namespace te
144
145#endif //__TERRALIB_RASTER_INTERNAL_PROXYRASTER_H
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
A raster band description.
Definition: Band.h:64
A proxy class for bands of several rasters over the same region.
Definition: ProxyRaster.h:44
unsigned int getMultiResLevelsCount() const
Returns the current number of multi-resolution pyramid levels.
Definition: ProxyRaster.h:114
int getBandDataType(std::size_t i) const
Returns the data type in a particular band (or dimension).
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
bool createMultiResolution(const unsigned int levels, const InterpolationMethod interpMethod)
Create a sub-sampled multi-resolution pyramid.
Definition: ProxyRaster.h:107
ProxyRaster(const ProxyRaster &rhs)
Copy constructor.
std::size_t getNumberOfBands() const
Returns the number of bands (dimension of cells attribute values) in the raster.
ProxyRaster(const std::vector< te::rst::Raster * > &rasters, const bool takeRastersOwnership)
Constructor from a set of rasters.
std::vector< Band * > m_bands
The proxy raster bands.
Definition: ProxyRaster.h:127
std::map< std::string, std::string > m_rasterInfo
This instance info.
Definition: ProxyRaster.h:132
ProxyRaster(const std::vector< RasterPtr > &rasters)
Constructor from a set of rasters.
void swap(std::size_t first, std::size_t second)
void open(const std::map< std::string, std::string > &rinfo, te::common::AccessPolicy p=te::common::RAccess)
Opens a raster.
Band * getBand(std::size_t i)
Returns the raster i-th band.
te::dt::AbstractData * clone() const
It returns a clone of this object.
~ProxyRaster()
Destructor.
const Band & operator[](std::size_t i) const
Access band in i position.
Band & operator[](std::size_t i)
Access band in i position.
bool removeMultiResolution()
Remove/Destroy a sub-sampled multi-resolution pyramid, if there is one.
Definition: ProxyRaster.h:112
std::vector< RasterPtr > m_rasters
The list of proxed rasters.
Definition: ProxyRaster.h:126
void updateRasterInfo()
update This instance raster info.
const Band * getBand(std::size_t i) const
Returns the raster i-th band.
std::map< std::string, std::string > getInfo() const
It returns additional information about the raster.
An abstract class for raster data strucutures.
Definition: Raster.h:72
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:41
@ RAccess
Definition: Enums.h:43
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
boost::shared_ptr< ProxyRaster > ProxyRasterPtr
Definition: ProxyRaster.h:140
TerraLib.
Raster implementaton for TerraLib 4.x.
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63