33 Plugin CameraFactory::m_cameraPlugin;
53 QString spacecraft = (QString) inst[
"SpacecraftName"];
54 QString name = (QString) inst[
"InstrumentId"];
55 spacecraft = spacecraft.toUpper();
56 name = name.toUpper();
57 QString group = spacecraft +
"/" + name;
58 group = group.remove(
" ");
66 int cameraOriginalVersion = (int)kerns[
"CameraVersion"];
67 int cameraNewestVersion = CameraVersion(cube);
69 if (cameraOriginalVersion != cameraNewestVersion) {
70 string msg =
"The camera model used to create a camera for this cube is out of date, " \
71 "please re-run spiceinit on the file or process with an old Isis version " \
72 "that has the correct camera model.";
79 ptr = m_cameraPlugin.GetPlugin(group);
82 QString msg =
"Unsupported camera model, unable to find plugin for ";
83 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
93 return (*plugin)(cube);
96 string message =
"Unable to initialize camera model from group [Instrument]";
102 void CameraFactory::initPlugin() {
103 if (m_cameraPlugin.fileName() ==
"") {
104 FileName localFile(
"Camera.plugin");
105 if (localFile.fileExists())
106 m_cameraPlugin.read(localFile.expanded());
108 FileName systemFile(
"$ISISROOT/lib/Camera.plugin");
109 if (systemFile.fileExists())
110 m_cameraPlugin.read(systemFile.expanded());
122 int CameraFactory::CameraVersion(
Cube &cube) {
123 return CameraVersion(*cube.
label());
127 int CameraFactory::CameraVersion(
Pvl &lab) {
135 QString spacecraft = (QString) inst[
"SpacecraftName"];
136 QString name = (QString) inst[
"InstrumentId"];
137 spacecraft = spacecraft.toUpper();
138 name = name.toUpper();
139 QString group = spacecraft +
"/" + name;
140 group = group.remove(
" ");
144 plugin = m_cameraPlugin.findGroup(group);
146 catch(IException &e) {
147 QString msg =
"Unsupported camera model, unable to find plugin for ";
148 msg +=
"SpacecraftName [" + spacecraft +
"] with InstrumentId [";
150 throw IException(e, IException::Unknown, msg,
_FILEINFO_);
154 QString msg =
"Camera model identified by [" + group +
"] does not have a version number";
155 throw IException(IException::Programmer, msg,
_FILEINFO_);
158 return (
int)plugin[
"Version"];
160 catch(IException &e) {
161 string msg =
"Unable to locate latest camera model version number from group [Instrument]";
162 throw IException(e, IException::Unknown, msg,
_FILEINFO_);
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
File name manipulation and expansion.
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
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.
Container for cube-like labels.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
IO Handler for Isis Cubes.