Isis 3 Programmer Reference
Kernel.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "Kernel.h"
10
11#include <QString>
12#include <QStringList>
13
14using namespace std;
15namespace Isis {
20 m_kernelType = static_cast<Type>(0);
21 m_kernels.clear();
22 }
23
29
37 Kernel::Kernel(Type type, const QStringList &data) {
39 m_kernels = data;
40 }
41
57 Kernel::Type Kernel::typeEnum(const QString &type) {
58 QString strng = type.simplified().trimmed().toUpper();
59 if (strng == "PREDICTED") return Predicted;
60 if (strng == "NADIR") return Nadir;
61 if (strng == "RECONSTRUCTED") return Reconstructed;
62 if (strng == "SMITHED") return Smithed;
63
64 return static_cast<Kernel::Type>(0);
65 };
66
80 const char *Kernel::typeEnum(const Type &type) {
81 if (type == Predicted) return "Predicted";
82 if (type == Nadir) return "Nadir";
83 if (type == Reconstructed) return "Reconstructed";
84 if (type == Smithed) return "Smithed";
85
86 return "Unknown";
87 };
88
96
104
110 m_kernels = data;
111 }
112
117 void Kernel::setType(const Type &type) {
119 }
120
126 return m_kernels.size();
127 }
128
133 void Kernel::push_back(const QString &str) {
134 m_kernels.push_back(str);
135 }
136
144 QString &Kernel::operator[](const int index) {
145 return m_kernels[index];
146 }
147
156 QString Kernel::operator[](const int index) const {
157 return m_kernels[index];
158 }
159
168 bool Kernel::operator<(const Kernel &other) const {
169 return (this->m_kernelType < other.m_kernelType);
170 }
171
172
182 return static_cast<Kernel::Type>(static_cast<int>(a) | static_cast<int>(b));
183 }
184} //end namespace isis
This class stores Kernel information, including Type and kernel file names.
Definition Kernel.h:36
void setType(const Type &type)
Sets the Kernel type.
Definition Kernel.cpp:117
~Kernel()
Destructs Kernel object.
Definition Kernel.cpp:27
void push_back(const QString &str)
Adds the string (file name) to the kernel data file list.
Definition Kernel.cpp:133
QStringList kernels()
Returns the list of kernel data file names.
Definition Kernel.cpp:93
QStringList m_kernels
List of kernel file names.
Definition Kernel.h:74
static Type typeEnum(const QString &type)
Converts the given string to a character as follows.
Definition Kernel.cpp:57
Type m_kernelType
Enumeration value indicating the kernel type.
Definition Kernel.h:75
int size()
Accessor method to determine the number of kernel files.
Definition Kernel.cpp:125
Kernel()
Constructs a Kernel object with "Unknown" Type.
Definition Kernel.cpp:19
QString & operator[](const int index)
Returns the value (file name) in the kernel data list at the given index value.
Definition Kernel.cpp:144
Type type()
Returns the stored Kernel::Type.
Definition Kernel.cpp:101
bool operator<(const Kernel &other) const
Compares which Kernel object has a higher quality Type, i.e.
Definition Kernel.cpp:168
void setKernels(QStringList data)
Sets the kernel data file names to the given list.
Definition Kernel.cpp:109
Type
Enumeration for type of kernel.
Definition Kernel.h:41
@ Predicted
Predicted Kernels are based on predicted location of the spacecraft.
Definition Kernel.h:42
@ Reconstructed
Reconstructed Kernels are supplemented with information on the actual position of targets and/or spac...
Definition Kernel.h:45
@ Smithed
Smithed Kernels are generally reconstructed kernels that have been corrected.
Definition Kernel.h:48
@ Nadir
Nadir Kernels mimic spacecraft pointing.
Definition Kernel.h:44
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Kernel::Type operator|(Kernel::Type a, Kernel::Type b)
Logical operator for combining Type flags.
Definition Kernel.cpp:181
Namespace for the standard library.