All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
IdlRaster.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2011 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  protected :
104 
105  unsigned char* m_allBandsDataPtr; //!< Data buffer pointer.
106 
107  bool m_takeBufferOwnership; //!< If true, the data buffer will be deleted when necessary.
108 
109  int m_dataType; //!< Data type used by all bands.
110 
111  std::vector< te::idl::IdlBand* > m_bands; //!< Internal raster bands.
112 
113  private :
114 
115  IdlRaster();
116 
117  IdlRaster( const te::rst::Raster& rhs );
118 
120 
121  void open(const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess);
122 
123  te::dt::AbstractData* clone() const;
124  };
125 
126  } // end namespace idl
127 } // end namespace te
128 
129 #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:109
bool m_takeBufferOwnership
If true, the data buffer will be deleted when necessary.
Definition: IdlRaster.h:107
std::vector< te::idl::IdlBand * > m_bands
Internal raster bands.
Definition: IdlRaster.h:111
#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
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
A adaptor to an external existent raster in a idl array form.
Definition: IdlRaster.h:50
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