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
12using namespace std;
13
14namespace 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
Manages a Buffer over a cube.
int MaxLines() const
Returns the number of lines in the cube.
bool setpos(BigInt map)
Sets the position of the shape in the cube.
IO Handler for Isis Cubes.
Definition Cube.h:168
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
Adds specific functionality to C++ strings.
Definition IString.h:165
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...
LineManager(const Isis::Cube &cube, const bool reverse=false)
Constructs a LineManager object.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
Namespace for the standard library.