Isis 3 Programmer Reference
LineManager.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "LineManager.h"
8 
9 #include "IException.h"
10 #include "IString.h"
11 
12 using namespace std;
13 
14 namespace Isis {
15 
27  LineManager::LineManager(const Isis::Cube &cube, const bool reverse) :
28  Isis::BufferManager(cube.sampleCount(), cube.lineCount(),
29  cube.bandCount(), cube.sampleCount(), 1, 1,
30  cube.pixelType(), reverse) {
31  }
32 
44  bool LineManager::SetLine(const int line, const int band) {
45  if(line < 1) {
46  QString message = "LineManager is unable to set the line to ["
47  + toString(line) + "]. Minimum line value is 1.";
48  throw IException(IException::Programmer, message, _FILEINFO_);
49  }
50 
51  if(band < 1) {
52  string message = "LineManager is unable to set the line for band ["
53  + IString(band) + "]. Minimum band value is 1.";
54  throw IException(IException::Programmer, message, _FILEINFO_);
55  }
56 
57  int map = (band - 1) * MaxLines() + line - 1;
58  return setpos(map);
59  }
60 
61 } // end namespace isis
Isis::BufferManager::setpos
bool setpos(BigInt map)
Sets the position of the shape in the cube.
Definition: BufferManager.cpp:219
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::BufferManager
Manages a Buffer over a cube.
Definition: BufferManager.h:52
Isis::BufferManager::MaxLines
int MaxLines() const
Returns the number of lines in the cube.
Definition: BufferManager.h:143
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::LineManager::SetLine
bool SetLine(const int line, const int band=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
Definition: LineManager.cpp:44
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::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16