33 Plugin CameraFactory::m_cameraPlugin;
55 QString spacecraft = (QString) inst[
"SpacecraftName"];
56 QString name = (QString) inst[
"InstrumentId"];
57 spacecraft = spacecraft.toUpper();
58 name = name.toUpper();
59 QString group = spacecraft +
"/" + name;
60 group = group.remove(
" ");
68 int cameraOriginalVersion = (int)kerns[
"CameraVersion"];
69 int cameraNewestVersion = CameraVersion(cube);
71 if (cameraOriginalVersion != cameraNewestVersion) {
72 string msg =
"The camera model used to create a camera for this cube is out of date, " \
73 "please re-run spiceinit on the file or process with an old Isis version " \
74 "that has the correct camera model.";
81 ptr = m_cameraPlugin.GetPlugin(group);
84 QString msg =
"Unsupported camera model, unable to find plugin for ";
85 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
95 return (*plugin)(cube);
98 string message =
"Unable to initialize camera model from group [Instrument]";
107 void CameraFactory::initPlugin() {
108 if (m_cameraPlugin.fileName() ==
"") {
109 FileName localFile(
"Camera.plugin");
111 m_cameraPlugin.read(localFile.
expanded());
113 FileName systemFile(
"$ISISROOT/lib/Camera.plugin");
115 m_cameraPlugin.read(systemFile.
expanded());
127 int CameraFactory::CameraVersion(
Cube &cube) {
128 return CameraVersion(*cube.
label());
139 int CameraFactory::CameraVersion(
Pvl &lab) {
147 QString spacecraft = (QString) inst[
"SpacecraftName"];
148 QString name = (QString) inst[
"InstrumentId"];
149 spacecraft = spacecraft.toUpper();
150 name = name.toUpper();
151 QString group = spacecraft +
"/" + name;
152 group = group.remove(
" ");
158 for (
int i = m_cameraPlugin.groups() - 1; i >= 0; i--) {
159 if (m_cameraPlugin.group(i) == group) {
160 plugin = m_cameraPlugin.group(i);
166 QString msg =
"Unable to find PVL group [" + group +
"].";
171 QString msg =
"Unsupported camera model, unable to find plugin for ";
172 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
178 QString msg =
"Camera model identified by [" + group +
"] does not have a version number";
182 return (
int)plugin[
"Version"];
185 string msg =
"Unable to locate latest camera model version number from group [Instrument]";
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
File name manipulation and expansion.
Namespace for the standard library.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A single keyword-value pair.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Container for cube-like labels.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Namespace for ISIS/Bullet specific routines.
bool fileExists() const
Returns true if the file exists; false otherwise.
IO Handler for Isis Cubes.