IdlBand.cpp
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/IdlBand.cpp
22 
23  \brief A adaptor to an external existent raster in a idl array form.
24 */
25 
26 // TerraLib
27 #include "IdlBand.h"
28 #include "Exception.h"
29 #include "../raster/BandProperty.h"
30 #include "../raster/Utils.h"
31 
32 #include <cstring>
33 
35  const void* allBandsDataPtr, std::size_t idx, int dataType,
36  const unsigned int nBands, const unsigned int nLines, const unsigned int nCols )
37 : te::rst::Band( new te::rst::BandProperty( idx, dataType, "" ), idx )
38 {
44 
45  m_allBandsDataPtr = (void*)allBandsDataPtr;
46  m_nLines = nLines;
47  m_nCols = nCols;
48  m_nBands = nBands;
49 
51  dataType );
52 }
53 
55 : te::rst::Band( new te::rst::BandProperty( 0, 0 ), 0 )
56 {
57  throw te::idl::Exception( "Not implemented" );
58 }
59 
61 : te::rst::Band( new te::rst::BandProperty( 0, 0 ), 0 )
62 {
63  throw te::idl::Exception( "Not implemented" );
64 }
65 
67 {
68 }
69 
70 void te::idl::IdlBand::getValue(unsigned int c, unsigned int r, double& value) const
71 {
72  m_bufferOffset = m_nBands * ( ( m_nCols * r ) + c ) + m_idx;
74 }
75 
76 void te::idl::IdlBand::setValue(unsigned int c, unsigned int r, const double value)
77 {
78  m_bufferOffset = m_nBands * ( ( m_nCols * r ) + c ) + m_idx;
80 }
81 
82 void te::idl::IdlBand::getIValue(unsigned int c, unsigned int r, double& value) const
83 {
84  m_bufferOffset = m_nBands * ( ( m_nCols * r ) + c ) + m_idx;
86 }
87 
88 void te::idl::IdlBand::setIValue(unsigned int c, unsigned int r, const double value)
89 {
90  m_bufferOffset = m_nBands * ( ( m_nCols * r ) + c ) + m_idx;
92 }
93 
94 void te::idl::IdlBand::read(int x, int y, void* buffer) const
95 {
96  assert( x == 0 );
97  assert( y == 0 );
100 }
101 
102 void te::idl::IdlBand::write(int x, int y, void* buffer)
103 {
104  assert( x == 0 );
105  assert( y == 0 );
107  m_nLines * m_nCols * m_nBands );
108 }
109 
110 
111 
112 
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
Definition: IdlBand.cpp:70
Band(BandProperty *p, std::size_t idx)
Constructor.
Index into a lookup table.
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
unsigned int m_nLines
The parent raster number of lines.
Definition: IdlBand.h:106
int m_nblocksx
The number of blocks in x.
Definition: BandProperty.h:145
int m_nblocksy
The number of blocks in y.
Definition: BandProperty.h:146
int m_type
The data type of the elements in the band ( See te::dt namespace basic data types for reference )...
Definition: BandProperty.h:133
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
unsigned int unsigned int nCols
unsigned int m_nBands
The parent raster number of bands.
Definition: IdlBand.h:110
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
Definition: IdlBand.cpp:102
An abstract class for raster data strucutures.
unsigned int m_nCols
The parent raster number of columns.
Definition: IdlBand.h:108
A adaptor to an external existent raster in a idl array form.
Definition: IdlBand.h:51
URI C++ Library.
Definition: Attributes.h:37
int m_blkw
Block width (pixels).
Definition: BandProperty.h:143
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
Definition: IdlBand.cpp:88
void * m_allBandsDataPtr
Data buffer pointer.
Definition: IdlBand.h:104
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
Definition: IdlBand.cpp:94
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
Definition: IdlBand.cpp:76
TERASTEREXPORT int GetPixelSize(int datatype)
Returns the byte size of a given datatype.
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 getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
Definition: IdlBand.cpp:82
std::size_t m_idx
The band index.
unsigned int m_bufferOffset
Definition: IdlBand.h:118
int m_blkh
Block height (pixels).
Definition: BandProperty.h:144
ColorInterp m_colorInterp
The color interpretation.
Definition: BandProperty.h:140
unsigned int nLines
TERASTEREXPORT void SetBlockFunctions(GetBufferValueFPtr *gb, GetBufferValueFPtr *gbi, SetBufferValueFPtr *sb, SetBufferValueFPtr *sbi, int type)
Sets the pointers to functions that helps to extract a double or complex value from a specific buffer...
Definition: BlockUtils.cpp:295
BandProperty * m_property
The band information.
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