IdlRaster.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/idl/IdlRaster.h
22 
23  \brief A adaptor to an external existent raster in a idl array form.
24 */
25 
26 #ifndef __TERRALIB_IDL_INTERNAL_CACHEDRASTER_H
27 #define __TERRALIB_IDL_INTERNAL_CACHEDRASTER_H
28 
29 #include "Config.h"
30 #include "IdlBand.h"
31 
32 #include "../raster/Raster.h"
33 
34 #include <idl_export.h>
35 
36 #include <vector>
37 #include <cassert>
38 
39 namespace te
40 {
41  namespace idl
42  {
43  /*!
44  \class IdlRaster
45 
46  \brief A adaptor to an external existent raster in a idl array form.
47 
48  \details A adaptor to an external existent raster in a idl array form.
49  */
51  {
52  public:
53 
54  /*!
55  \brief Constructor.
56 
57  \param idlValuePointer A pointer to a valid idl array structure.
58 
59  \param takeBufferOwnership if True the data buffer will be deleted by this raster instance, when necessary.
60  */
61  IdlRaster( const IDL_VPTR& idlValuePointer, const bool takeBufferOwnership );
62 
63 
64  ~IdlRaster();
65 
66 
67  std::map<std::string, std::string> getInfo() const;
68 
69  inline std::size_t getNumberOfBands() const
70  {
71  return m_bands.size();
72  };
73 
74  inline int getBandDataType(std::size_t i) const
75  {
76  return m_dataType;
77  };
78 
79  inline const te::rst::Band* getBand(std::size_t i) const
80  {
81  assert( i < m_bands.size() );
82  return m_bands[ i ];
83  };
84 
85  inline te::rst::Band* getBand(std::size_t i)
86  {
87  assert( i < m_bands.size() );
88  return m_bands[ i ];
89  };
90 
91  inline const te::rst::Band& operator[](std::size_t i) const
92  {
93  assert( i < m_bands.size() );
94  return *(m_bands[ i ]);
95  };
96 
97  inline te::rst::Band& operator[](std::size_t i)
98  {
99  assert( i < m_bands.size() );
100  return *(m_bands[ i ]);
101  };
102 
103  bool createMultiResolution( const unsigned int levels, const te::rst::InterpolationMethod interpMethod )
104  {
105  return false;
106  };
107 
108  bool removeMultiResolution() { return false; };
109 
110  unsigned int getMultiResLevelsCount() const
111  {
112  return 0;
113  }
114 
115  te::rst::Raster* getMultiResLevel( const unsigned int level ) const
116  {
117  return 0;
118  }
119 
120  protected :
121 
122  unsigned char* m_allBandsDataPtr; //!< Data buffer pointer.
123 
124  bool m_takeBufferOwnership; //!< If true, the data buffer will be deleted when necessary.
125 
126  int m_dataType; //!< Data type used by all bands.
127 
128  std::vector< te::idl::IdlBand* > m_bands; //!< Internal raster bands.
129 
130  private :
131 
132  IdlRaster();
133 
134  IdlRaster( const te::rst::Raster& rhs );
135 
137 
138  void open(const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess);
139 
140  te::dt::AbstractData* clone() const;
141  };
142 
143  } // end namespace idl
144 } // end namespace te
145 
146 #endif //__TERRALIB_IDL_INTERNAL_CACHEDRASTER_H
A adaptor to an external existent raster in a idl array form.
const te::rst::Band & operator[](std::size_t i) const
Access band in i position.
Definition: IdlRaster.h:91
const te::rst::Band * getBand(std::size_t i) const
Returns the raster i-th band.
Definition: IdlRaster.h:79
std::size_t getNumberOfBands() const
Returns the number of bands (dimension of cells attribute values) in the raster.
Definition: IdlRaster.h:69
int m_dataType
Data type used by all bands.
Definition: IdlRaster.h:126
bool createMultiResolution(const unsigned int levels, const te::rst::InterpolationMethod interpMethod)
Create a sub-sampled multi-resolution pyramid.
Definition: IdlRaster.h:103
bool m_takeBufferOwnership
If true, the data buffer will be deleted when necessary.
Definition: IdlRaster.h:124
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
unsigned int getMultiResLevelsCount() const
Returns the current number of multi-resolution pyramid levels.
Definition: IdlRaster.h:110
std::vector< te::idl::IdlBand * > m_bands
Internal raster bands.
Definition: IdlRaster.h:128
#define TEIDLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:81
Configuration flags for the IDL module of TerraLib.
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
An abstract class for raster data strucutures.
Definition: Raster.h:71
unsigned char * m_allBandsDataPtr
Data buffer pointer.
Definition: IdlRaster.h:122
URI C++ Library.
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
te::rst::Band & operator[](std::size_t i)
Access band in i position.
Definition: IdlRaster.h:97
te::rst::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: IdlRaster.h:115
A adaptor to an external existent raster in a idl array form.
Definition: IdlRaster.h:50
bool removeMultiResolution()
Remove/Destroy a sub-sampled multi-resolution pyramid, if there is one.
Definition: IdlRaster.h:108
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
int getBandDataType(std::size_t i) const
Returns the data type in a particular band (or dimension).
Definition: IdlRaster.h:74
te::rst::Band * getBand(std::size_t i)
Returns the raster i-th band.
Definition: IdlRaster.h:85