File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
PhotoModelFactory.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "PhotoModelFactory.h"
9 #include "PhotoModel.h"
10 #include "Plugin.h"
11 #include "IException.h"
12 #include "FileName.h"
13 
14 namespace Isis {
36  // Get the algorithm name to create
37  PvlGroup &algo = pvl.findObject("PhotometricModel")
38  .findGroup("Algorithm", Pvl::Traverse);
39 
40  QString algorithm = "";
41  if (algo.hasKeyword("PhtName")) {
42  algorithm = algo["PhtName"][0];
43  }
44  else if (algo.hasKeyword("Name")) {
45  algorithm = algo["Name"][0];
46  }
47  else {
48  QString msg = "Keyword [Name] or keyword [PhtName] must ";
49  msg += "exist in [Group = Algorithm]";
50  throw IException(IException::User, msg, _FILEINFO_);
51  }
52 
53  // Open the factory plugin file
54  Plugin *p = new Plugin;
55  FileName f("PhotoModel.plugin");
56  if(f.fileExists()) {
57  p->read("PhotoModel.plugin");
58  }
59  else {
60  p->read("$ISISROOT/lib/PhotoModel.plugin");
61  }
62 
63  // Get the algorithm specific plugin and return it
64  PhotoModel * (*plugin)(Pvl & pvl);
65  plugin = (PhotoModel * ( *)(Pvl & pvl)) p->GetPlugin(algorithm);
66  return (*plugin)(pvl);
67  }
68 } // end namespace isis
Isis::PhotoModel
Definition: PhotoModel.h:41
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::FileName::fileExists
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:449
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::Pvl::read
void read(const QString &file)
Loads PVL information from a stream.
Definition: Pvl.cpp:90
Isis::PhotoModelFactory::Create
static PhotoModel * Create(Pvl &pvl)
Create a PhotoModel object using a PVL specification.
Definition: PhotoModelFactory.cpp:35
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::Plugin::GetPlugin
QFunctionPointer GetPlugin(const QString &group)
This method returns a void pointer to a C function (i.e., the plugin) It does this by looking in itse...
Definition: Plugin.cpp:39
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::Plugin
Loads plugins from a shared library.
Definition: Plugin.h:55

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:59