Isis 3 Programmer Reference
BandManager.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "BandManager.h"
8 #include "IException.h"
9 
10 using namespace std;
11 namespace Isis {
12 
24  BandManager::BandManager(const Isis::Cube &cube, const bool reverse) :
25  Isis::BufferManager(cube.sampleCount(), cube.lineCount(),
26  cube.bandCount(), 1, 1, cube.bandCount(),
27  cube.pixelType(), reverse) {
28  }
29 
40  bool BandManager::SetBand(const int sample, const int line) {
41  if(sample < 1) {
42  string message = "Invalid value for argument [sample]";
43  throw IException(IException::Programmer, message, _FILEINFO_);
44  }
45 
46  if(line < 1) {
47  string message = "Invalid value for argument [line]";
48  throw IException(IException::Programmer, message, _FILEINFO_);
49  }
50 
51  int map = (line - 1) * MaxBands() + sample - 1;
52  return setpos(map);
53  }
54 
55 } // end namespace isis
Isis::BufferManager::setpos
bool setpos(BigInt map)
Sets the position of the shape in the cube.
Definition: BufferManager.cpp:219
Isis::BufferManager
Manages a Buffer over a cube.
Definition: BufferManager.h:52
Isis::BandManager::SetBand
bool SetBand(const int sample, const int line=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
Definition: BandManager.cpp:40
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::BufferManager::MaxBands
int MaxBands() const
Returns the number of bands in the cube.
Definition: BufferManager.h:152
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
std
Namespace for the standard library.
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16