10#include <QDirIterator>
14#include "CameraFactory.h"
19#include "IException.h"
21#include "Preference.h"
25#include "csm/Plugin.h"
53 if (cube.
hasBlob(
"CSMState",
"String")) {
59 QString msg =
"Unable to create CSM camera using CSMState Cube blob.";
67 QString spacecraft = (QString) inst[
"SpacecraftName"];
68 QString name = (QString) inst[
"InstrumentId"];
69 spacecraft = spacecraft.toUpper();
70 name = name.toUpper();
71 QString group = spacecraft +
"/" + name;
72 group = group.remove(
" ");
76 if (!kerns.hasKeyword(
"CameraVersion")) {
80 int cameraOriginalVersion = (int)kerns[
"CameraVersion"];
83 if (cameraOriginalVersion != cameraNewestVersion) {
84 string msg =
"The camera model used to create a camera for this cube is out of date, " \
85 "please re-run spiceinit on the file or process with an old Isis version " \
86 "that has the correct camera model.";
96 QString msg =
"Unsupported camera model, unable to find plugin for ";
97 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
107 return (*plugin)(cube);
111 string message =
"Unable to initialize camera model in Camera Factory.";
125 FileName localFile(
"Camera.plugin");
126 if (localFile.fileExists())
129 FileName systemFile(
"$ISISROOT/lib/Camera.plugin");
130 if (systemFile.fileExists())
139 for (
int i = 0; i<grp[
"CSMDirectory"].size(); i++) {
140 FileName csmDir = grp[
"CSMDirectory"][i];
142 QDirIterator csmLib(csmDir.expanded(), {
"*.so",
"*.dylib"}, QDir::Files);
143 while (csmLib.hasNext()) {
144 QString csmLibName = csmLib.next();
145 QLibrary csmDynamicLib(csmLibName);
146 csmDynamicLib.load();
181 QString spacecraft = (QString) inst[
"SpacecraftName"];
182 QString name = (QString) inst[
"InstrumentId"];
183 spacecraft = spacecraft.toUpper();
184 name = name.toUpper();
185 QString group = spacecraft +
"/" + name;
186 group = group.remove(
" ");
200 QString msg =
"Unable to find PVL group [" + group +
"].";
205 QString msg =
"Unsupported camera model, unable to find plugin for ";
206 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
211 if (!plugin.hasKeyword(
"Version")) {
212 QString msg =
"Camera model identified by [" + group +
"] does not have a version number";
216 return (
int)plugin[
"Version"];
219 string msg =
"Unable to locate latest camera model version number from group [Instrument]";
static bool m_initialized
Has the plugin list been initialized.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
static void initPlugin()
Reads the appropriate plugin file for the ISIS cameras, and scans the directories specified in IsisPr...
static int CameraVersion(Cube &cube)
This looks up the current camera model version from the cube.
static Plugin m_cameraPlugin
The plugin file for the camera.
IO Handler for Isis Cubes.
bool hasBlob(const QString &name, const QString &type)
Check to see if the cube contains a BLOB.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
File name manipulation and expansion.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ Programmer
This error is for when a programmer made an API call that was illegal.
Reads user preferences from a data file.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
@ Traverse
Search child objects.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.