All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Band.cpp
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/terralib4/Band.cpp
22 
23  \brief Band implementation for TerraLib 4.x.
24 */
25 
26 // TerraLib
27 #include "../common/Translator.h"
28 #include "Band.h"
29 #include "Exception.h"
30 #include "Raster.h"
31 
32 // TerraLib 4.x
33 #include <terralib/kernel/TeRaster.h>
34 
36 {
37  public:
38 
39  Impl(Raster* parent, TeRaster* iraster);
40 
42  TeRaster* m_raster;
43 };
44 
45 terralib4::Band::Impl::Impl(Raster* parent, TeRaster* iraster)
46  : m_parent(parent), m_raster(iraster)
47 {
48 }
49 
50 terralib4::Band::Band(Raster* parent, TeRaster* iraster, te::rst::BandProperty* bp, std::size_t idx)
51  : te::rst::Band(bp, idx), m_pImpl(0)
52 {
53  m_pImpl = new Impl(parent, iraster);
54 }
55 
57 {
58  delete m_pImpl;
59 }
60 
62 {
63  return m_pImpl->m_parent;
64 }
65 
66 void terralib4::Band::getValue(unsigned int c, unsigned int r, double& value) const
67 {
68  m_pImpl->m_raster->getElement(c, r, value, m_idx);
69 }
70 
71 void terralib4::Band::setValue(unsigned int /*c*/, unsigned int /*r*/, const double /*value*/)
72 {
73  throw Exception(TR_TERRALIB4("This method is not supported by TerraLib 4.x driver!"));
74 }
75 
76 void terralib4::Band::getIValue(unsigned int /*c*/, unsigned int /*r*/, double& value) const
77 {
78  value = 0.0;
79 }
80 
81 void terralib4::Band::setIValue(unsigned int /*c*/, unsigned int /*r*/, const double /*value*/)
82 {
83  throw Exception(TR_TERRALIB4("This method is not supported by TerraLib 4.x driver!"));
84 }
85 
86 void terralib4::Band::read(int x, int y, void* buffer) const
87 {
88  throw;
89 }
90 
91 void* terralib4::Band::read(int x, int y)
92 {
93  throw;
94 }
95 
96 void terralib4::Band::write(int /*x*/, int /*y*/, void* /*buffer*/)
97 {
98  throw Exception(TR_TERRALIB4("This method is not supported by TerraLib 4.x driver!"));
99 }
100 
Impl(Raster *parent, TeRaster *iraster)
Definition: Band.cpp:45
TeRaster * m_raster
Definition: Band.cpp:42
Band(Raster *parent, TeRaster *iraster, te::rst::BandProperty *bp, std::size_t idx)
Definition: Band.cpp:50
#define TR_TERRALIB4(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:119
~Band()
Virtual destructor.
Definition: Band.cpp:56
void getIValue(unsigned int c, unsigned int r, double &value) const
Returns the imaginary attribute value in a complex band of a cell.
Definition: Band.cpp:76
void setValue(unsigned int c, unsigned int r, const double value)
Sets the cell attribute value.
Definition: Band.cpp:71
Raster implementaton for TerraLib 4.x.
Band implementation for TerraLib 4.x.
A raster band description.
Definition: BandProperty.h:61
void getValue(unsigned int c, unsigned int r, double &value) const
Returns the cell attribute value.
Definition: Band.cpp:66
void write(int x, int y, void *buffer)
It writes a data block from the specified buffer.
Definition: Band.cpp:96
void setIValue(unsigned int c, unsigned int r, const double value)
Sets the imaginary attribute value in a complex band of a cell.
Definition: Band.cpp:81
Impl * m_pImpl
Definition: Band.h:64
void read(int x, int y, void *buffer) const
It reads a data block to the specified buffer.
Definition: Band.cpp:86
An abstract class for raster data strucutures.
Definition: Raster.h:70
Raster * m_parent
Definition: Band.cpp:41
te::rst::Raster * getRaster() const
Returns the associated raster.
Definition: Band.cpp:61