All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IdlBand.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/IdlBand.h
22 
23  \brief A adaptor to an external existent raster in a idl array form.
24 */
25 
26 #ifndef __TERRALIB_IDL_INTERNAL_IDLBAND_H
27 #define __TERRALIB_IDL_INTERNAL_IDLBAND_H
28 
29 // TerraLib
30 #include "Config.h"
31 #include "../raster/Band.h"
32 #include "../raster/BlockUtils.h"
33 
34 #include <cstddef>
35 #include <cassert>
36 
37 namespace te
38 {
39  namespace idl
40  {
41 // Forward declaration
42  class Raster;
43 
44  /*!
45  \class IdlBand
46 
47  \brief A adaptor to an external existent raster in a idl array form.
48 
49  \details A adaptor to an external existent raster in a idl array form.
50  */
52  {
53  public:
54 
55  /*!
56  \brief Constructor.
57 
58  \param rasterPtr The parent raster pointer.
59 
60  \param idx The band index.
61 
62  \param allBandsDataPtr A pointer to the unique global raster data.
63 
64  \param dataType The pixel data type (terralib type).
65 
66  \param nBands The parent raster number of bands.
67 
68  \param nLines The parent raster number of lines.
69 
70  \param nCols The parent raster number of columns.
71  */
72  IdlBand( const te::rst::Raster* rasterPtr, const void* allBandsDataPtr,
73  std::size_t idx, int dataType, const unsigned int nBands,
74  const unsigned int nLines, const unsigned int nCols );
75 
76  ~IdlBand();
77 
78  inline te::rst::Raster* getRaster() const
79  {
80  return m_rasterPtr;
81  };
82 
83  void getValue(unsigned int c, unsigned int r, double& value) const;
84 
85  void setValue(unsigned int c, unsigned int r, const double value);
86 
87  void getIValue(unsigned int c, unsigned int r, double& value) const;
88 
89  void setIValue(unsigned int c, unsigned int r, const double value);
90 
91  void read(int x, int y, void* buffer) const;
92 
93  inline void* read(int x, int y)
94  {
95  return m_allBandsDataPtr;
96  };
97 
98  void write(int x, int y, void* buffer);
99 
100  protected :
101 
102  te::rst::Raster* m_rasterPtr; //!< A pointer to the parent raster instance.
103 
104  void* m_allBandsDataPtr; //!< Data buffer pointer.
105 
106  unsigned int m_nLines; //!< The parent raster number of lines.
107 
108  unsigned int m_nCols; //!< The parent raster number of columns.
109 
110  unsigned int m_nBands; //!< The parent raster number of bands.
111 
112  te::rst::GetBufferValueFPtr m_getBuff; //!< A pointer to a function that helps to extract a double or complex value from a specific buffer data type (char, int16, int32, float, ...).
113  te::rst::GetBufferValueFPtr m_getBuffI; //!< A pointer to a function that helps to extract the imaginary part value from a specific buffer data type (cint16, cint32, cfloat, cdouble).
114  te::rst::SetBufferValueFPtr m_setBuff; //!< A pointer to a function that helps to insert a double or complex value into a specific buffer data type (char, int16, int32, float, ...).
115  te::rst::SetBufferValueFPtr m_setBuffI; //!< A pointer to a function that helps to insert the imaginary part value into a specific buffer data type (cint16, cint32, cfloat, cdouble).
116 
117  // Variable used by setValue/getValue methods
118  mutable unsigned int m_bufferOffset;
119 
120  private :
121 
122  IdlBand();
123 
124  IdlBand(const IdlBand& );
125  };
126 
127  } // end namespace idl
128 } // end namespace te
129 
130 #endif // __TERRALIB_IDL_INTERNAL_IDLBAND_H
131 
unsigned int m_nBands
The parent raster number of bands.
Definition: IdlBand.h:110
#define TEIDLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:84
te::rst::GetBufferValueFPtr m_getBuffI
A pointer to a function that helps to extract the imaginary part value from a specific buffer data ty...
Definition: IdlBand.h:113
void * m_allBandsDataPtr
Data buffer pointer.
Definition: IdlBand.h:104
void(* GetBufferValueFPtr)(int index, void *buffer, double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:37
te::rst::SetBufferValueFPtr m_setBuffI
A pointer to a function that helps to insert the imaginary part value into a specific buffer data typ...
Definition: IdlBand.h:115
te::rst::SetBufferValueFPtr m_setBuff
A pointer to a function that helps to insert a double or complex value into a specific buffer data ty...
Definition: IdlBand.h:114
te::rst::GetBufferValueFPtr m_getBuff
A pointer to a function that helps to extract a double or complex value from a specific buffer data t...
Definition: IdlBand.h:112
void * read(int x, int y)
It reads and returns a data block.
Definition: IdlBand.h:93
void(* SetBufferValueFPtr)(int index, void *buffer, const double *value)
The type of function used to extract data from a buffer.
Definition: BlockUtils.h:40
Configuration flags for the IDL module of TerraLib.
A raster band description.
Definition: Band.h:63
unsigned int m_nCols
The parent raster number of columns.
Definition: IdlBand.h:108
te::rst::Raster * m_rasterPtr
A pointer to the parent raster instance.
Definition: IdlBand.h:102
te::rst::Raster * getRaster() const
Returns the associated raster.
Definition: IdlBand.h:78
unsigned int m_bufferOffset
Definition: IdlBand.h:118
An abstract class for raster data strucutures.
Definition: Raster.h:70
unsigned int m_nLines
The parent raster number of lines.
Definition: IdlBand.h:106
A adaptor to an external existent raster in a idl array form.
Definition: IdlBand.h:51