File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
 |
Isis 3 Programmer Reference
|
14 #include "CameraFactory.h"
16 #include "IException.h"
20 #include "Preference.h"
21 #include "Preference.h"
23 #include "PvlKeyword.h"
24 #include "PvlObject.h"
48 KernelDb::KernelDb(
const unsigned int allowedKernelTypes) {
50 m_allowedKernelTypes = allowedKernelTypes;
51 m_kernelDbFiles.clear();
76 KernelDb::KernelDb(
const QString &dbName,
const unsigned int allowedKernelTypes) :
77 m_kernelData(dbName) {
156 return findLast(
"TargetAttitudeShape", lab);
177 return findLast(
"TargetPosition", lab);
198 return findAll(
"SpacecraftPointing", lab);
218 return findLast(
"SpacecraftClock", lab);
239 return findLast(
"SpacecraftPosition", lab);
301 return findLast(
"InstrumentAddendum", lab);
343 if (queues.size() > 0 && queues.at(0).size() > 0) {
344 lastKernel = queues.at(0).top();
370 int cameraVersion = -1;
380 priority_queue<Kernel> emptyKernelQueue;
381 emptyKernelQueue.push(
Kernel());
382 queues.push_back(emptyKernelQueue);
391 start = (QString) cube.
findGroup(
"Instrument")[
"StartTime"];
393 if (cube.
findGroup(
"Instrument").hasKeyword(
"StopTime")) {
394 end = ((QString) cube.
findGroup(
"Instrument")[
"StopTime"]);
397 end = ((QString) cube.
findGroup(
"Instrument")[
"StartTime"]);
404 priority_queue<Kernel> filesFound;
407 for (
int groupIndex = obj.
groups() - 1; groupIndex >= 0; groupIndex--) {
413 if (!grp.
isNamed(
"Selection"))
continue;
419 type = (QString) grp[
"Type"];
431 bool startMatches =
matches(lab, grp, start, cameraVersion);
432 bool endMatches =
matches(lab, grp, end, cameraVersion);
434 if (startMatches && endMatches) {
439 else if (startMatches) {
442 for (
int endTimeIndex = obj.
groups() - 1;
456 if (endTimeIndex == groupIndex)
continue;
457 if (!endTimeGrp.
isNamed(
"Selection"))
continue;
460 grp[
"Type"] != endTimeGrp[
"Type"])
continue;
461 if (!
matches(lab, endTimeGrp, end, cameraVersion))
continue;
464 bool betterMatch =
false;
467 bool endTimesMatch =
true;
470 for (
int keyIndex = 0;
471 !betterMatch && keyIndex < grp.
keywords();
475 if (!key.
isNamed(
"Time"))
continue;
477 iTime timeRangeStart((QString)key[0]);
478 iTime timeRangeEnd((QString)key[1]);
480 bool thisEndMatches =
matches(lab, endTimeGrp,
481 timeRangeEnd, cameraVersion);
482 endTimesMatch = endTimesMatch && thisEndMatches;
484 if (
matches(lab, endTimeGrp, start, cameraVersion)
485 &&
matches(lab, endTimeGrp, end, cameraVersion)) {
493 if (!betterMatch && endTimesMatch) {
497 while (endMatchFiles.size()) {
498 startMatchFiles.push_back(endMatchFiles[endMatchFiles.size() - 1]);
499 endMatchFiles.pop_back();
506 else if (betterMatch) {
514 queues.push_back(filesFound);
518 if (queues.size() == 0) {
519 priority_queue<Kernel> emptyKernelQueue;
520 emptyKernelQueue.push(
Kernel());
521 queues.push_back(emptyKernelQueue);
571 iTime timeToMatch,
int cameraVersion) {
582 bool matchKeywords =
true;
587 for (
int keyword = 0; keyword < grp.
keywords(); keyword++) {
592 iTime kernelStart = (QString) key[0];
593 iTime kernelEnd = (QString) key[1];
597 if ((kernelStart <= timeToMatch) && (kernelEnd >= timeToMatch)) {
601 else if (key.
isNamed(
"Match")) {
603 QString matchGroup = key[0];
604 QString matchKey = key[1];
605 QString matchValue = key[2];
607 QString cubeValue = cube.
findGroup(matchGroup)[matchKey];
608 cubeValue = cubeValue.simplified().trimmed().toUpper();
609 matchValue = matchValue.simplified().trimmed().toUpper();
612 if (cubeValue.compare(matchValue) != 0) {
613 matchKeywords =
false;
618 matchKeywords =
false;
621 else if (key.
isNamed(
"CameraVersion")) {
623 for (
int camVersionKeyIndex = 0;
624 camVersionKeyIndex < key.
size();
625 camVersionKeyIndex++) {
627 bool versionMatch =
false;
628 IString val = key[camVersionKeyIndex];
631 while ((commaTok = val.
Token(
",")).ToQt().length() > 0) {
632 if (commaTok.find(
'-') != string::npos) {
637 direction = (start <= end) ? 1 : -1;
639 for (
int version = start;
640 version != end + direction;
641 version += direction) {
642 if (version == cameraVersion) {
649 if (commaTok.
ToInteger() == cameraVersion) {
656 matchKeywords =
false;
661 matchKeywords =
false;
666 return matchKeywords && matchTime;
709 PvlGroup &dataDir = Preference::Preferences().findGroup(
"DataDirectory");
710 QString baseDir = dataDir[
"Base"];
713 QString missionDir = dataDir[mission];
718 FileName tasDbPath(missionDir +
"/kernels/pck");
726 FileName tpDbPath(missionDir +
"/kernels/tspk");
779 QString directory,
const Pvl &lab) {
781 FileName configFile = directory +
"/kernels.????.conf";
782 bool noConfigFile =
false;
791 FileName kernelDb(directory +
"/kernels.????.db");
796 bool foundMatch =
false;
798 for (
int groupIndex = 0; groupIndex < inst.
groups(); groupIndex++) {
806 for (
int keyIndex = 0; keyIndex < grp.
keywords(); keyIndex++) {
809 QString dir = dataDir[keyword[0]];
810 FileName kernelDb( dir +
"/" + keyword[1]);
846 QString msg =
"Unable to read kernel database file ["
877 for (
int i = 0; i < grp.
keywords(); i++) {
879 if (kfile.
name() !=
"File")
continue;
884 if (kfile.
size() == 2) {
885 QString pref = kfile[0];
886 QString version = kfile[1];
887 FileName filename(
"$" + pref +
"/" + version);
893 else if (kfile.
size() == 1) {
900 QString msg =
"Invalid File keyword value in [Group = ";
901 msg += grp.
name() +
"] in database file [";
QString originalPath() const
Returns the path of the original file name.
QString name() const
Returns the keyword name.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
PvlGroup & group(const int index)
Return the group at the specified index.
Kernel targetAttitudeShape(Pvl &lab)
This method finds the highest version of all Target Attitude Shape kernels (pck) identified by the da...
Contains Pvl Groups and Pvl Objects.
A single keyword-value pair.
KernelDb(const unsigned int allowedKernelTypes)
Constructs a new KernelDb object with a given integer value representing the Kernel::Type enumeration...
QStringList files(PvlGroup &grp)
This method retrieves the values of all of the "File" keywords in the given PvlGroup.
This is free and unencumbered software released into the public domain.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Parse and return pieces of a time string.
File name manipulation and expansion.
@ Unknown
A type of error that cannot be classified as any of the other error types.
int groups() const
Returns the number of groups contained.
bool fileExists() const
Returns true if the file exists; false otherwise.
Kernel instrument(Pvl &lab)
This method finds the last Instrument kernel found that matches the (ik) criteria in the database and...
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Container for cube-like labels.
int objects() const
Returns the number of objects.
Kernel targetPosition(Pvl &lab)
This method finds the highest version of all Target Position kernels (tspk) identified by the databas...
~KernelDb()
Destructs KernelDb object.
int ToInteger() const
Returns the object string as an integer.
void loadSystemDb(const QString &mission, const Pvl &lab)
Loads the appropriate kernel database files with the defined BASE and MISSION info for each type of k...
PvlObject & object(const int index)
Return the object at the specified index.
Kernel dem(Pvl &lab)
This method finds the highest version of all Digital Terrain Models (DEMs) found that match the crite...
QList< FileName > m_kernelDbFiles
List of the kernel database file names that were read in when the loadSystemDb() method is called.
Pvl m_kernelData
Pvl containing the information in the kernel database(s) that is read in from the constructor and whe...
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Contains multiple PvlContainers.
Kernel instrumentAddendum(Pvl &lab)
This method finds the highest version of all Instrument Addendum kernels (iak) identified by the data...
void read(const QString &file)
Loads PVL information from a stream.
static int CameraVersion(Cube &cube)
This looks up the current camera model version from the cube.
bool isNamed(const QString &match) const
Returns whether the given string is equal to the container name or not.
Kernel spacecraftClock(Pvl &lab)
This method finds the highest version of all Spacecraft Clock kernels (sclk) identified by the databa...
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
QString name() const
Returns the container name.
bool isNamed(QString name) const
Determines whether two PvlKeywords have the same name or not.
QList< FileName > kernelDbFiles()
Accessor method to retrieve the list of kernel database files that were read in when loadSystemDb() i...
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not.
QString m_filename
The name of the kernel database file.
void readKernelDbFiles()
This method is called by loadSystemDb() to read kernel database file list compiled by loadKernelDbFil...
static bool matches(const Pvl &lab, PvlGroup &kernelDbGrp, iTime timeToMatch, int cameraVersion)
This static method determines whether the given cube label matches the given criteria.
Namespace for the standard library.
Kernel findLast(const QString &entry, Pvl &lab)
Finds the highest priority Kernel object for the given entry based on the allowed Kernel types.
IString Token(const IString &separator)
Returns the first token in the IString.
int size() const
Returns the number of values stored in this keyword.
QList< std::priority_queue< Kernel > > findAll(const QString &entry, Pvl &lab)
Finds all of the Kernel objects for the given entry value based on the allowed Kernel types.
This class stores Kernel information, including Type and kernel file names.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
bool isVersioned() const
Checks to see if a file name is versioned by date or numerically.
Kernel frame(Pvl &lab)
This method finds the highest version of all Frame kernels (fk) identified by the database and the al...
Adds specific functionality to C++ strings.
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name.
Kernel spacecraftPosition(Pvl &lab)
This method finds the highest version of all Spacecraft Position kernels (spk) identified by the data...
static Type typeEnum(const QString &type)
Converts the given string to a character as follows.
void loadKernelDbFiles(PvlGroup &dataDir, QString directory, const Pvl &lab)
This method is called by loadSystemDb() to create a list of all appropriate kernel database files to ...
QList< std::priority_queue< Kernel > > spacecraftPointing(Pvl &lab)
This method finds a list of the highest versions of all Spacecraft Pointing kernels (ck) identified b...
Kernel leapSecond(Pvl &lab)
This method finds the top priority of all Leap Second kernels (lsk) identified by the database and th...
This is free and unencumbered software released into the public domain.
unsigned int m_allowedKernelTypes
This integer value represents which Kernel::Types are allowed.