57 m_bodyCode =
new SpiceInt;
58 m_systemCode =
new SpiceInt;
68 *m_name = inst[
"TargetName"][0];
69 QString trykey =
"NaifIkCode";
71 m_systemName =
new QString;
74 trykey =
"NaifFrameCode";
77 if (name().toUpper() ==
"SKY") {
78 m_radii[0] = m_radii[1] = m_radii[2] =
Distance(1000.0, Distance::Meters);
80 int ikCode =
toInt(kernels[trykey][0]);
81 *m_bodyCode = ikCode / 1000;
84 *m_bodyCode = (int) kernels[
"NaifSpkCode"];
88 (*m_systemName).append(
"THE COSMOS");
92 *m_bodyCode = lookupNaifBodyCode(lab);
95 *m_systemCode = (*m_bodyCode/100)*100 + 99;
97 SpiceChar naifBuf[40];
99 bodc2n_c((SpiceInt) *m_systemCode,
sizeof(naifBuf), naifBuf, &found);
101 (*m_systemName).append(s.c_str());
110 *m_bodyCode = (int) kernels[
"NaifBodyCode"];
112 m_shape = ShapeModelFactory::create(
this, lab);
142 void Target::init() {
144 m_originalShape = NULL;
153 NaifStatus::CheckErrors();
167 if (m_radii.size() != 0) {
171 delete m_originalShape;
172 m_originalShape = NULL;
180 bool Target::isSky()
const {
191 SpiceInt Target::lookupNaifBodyCode(
Pvl &lab)
const {
194 code = lookupNaifBodyCode(*m_name);
201 code = m_spice->getInteger(
"BODY_CODE", 0);
206 && lab.
findObject(
"NaifKeywords").hasKeyword(
"BODY_CODE") ) {
207 code = int(lab.
findObject(
"NaifKeywords").findKeyword(
"BODY_CODE"));
213 "BODY_CODE not found for this Target.",
221 "Unable to look up NAIF body code for this Target.",
234 SpiceInt Target::lookupNaifBodyCode(QString name) {
236 NaifStatus::CheckErrors();
239 bodn2c_c(name.toLatin1().data(), &code, &found);
241 QString msg =
"Could not convert Target [" + name +
242 "] to NAIF body code";
245 NaifStatus::CheckErrors();
281 target = mapping[
"TargetName"][0];
285 if (target.isEmpty()) {
286 bool hasInstrumentGroup = cubeLab.
findObject(
"IsisCube").hasGroup(
"Instrument");
287 if (hasInstrumentGroup) {
290 target = inst[
"TargetName"][0];
297 if (target.isEmpty()) {
299 "Unable to find a TargetName keyword in the given PVL.",
306 PvlGroup radii = Target::radiiGroup(target);
328 SpiceInt bodyCode = 0;
331 bodyCode = lookupNaifBodyCode(target);
336 QString radiiKeyword =
"BODY" +
toString(
int(bodyCode)) +
"_RADII";
342 PvlContainer::Replace);
345 PvlContainer::Replace);
351 if (naifKeywords.
hasKeyword(
"BODY_FRAME_CODE")) {
354 QString radiiKeyword =
"BODY" + bodyFrame[0] +
"_RADII";
361 PvlContainer::Replace);
365 PvlContainer::Replace);
374 QString msg =
"Unable to find Equatorial and Polar radii for target [" + target +
"].";
395 if (target.isEmpty()) {
397 "Unable to find TargetRadii. The given TargetName is empty.",
404 if (cachedResults.contains(target)) {
405 mapping = cachedResults[target];
409 SpiceInt bodyCode = 0;
411 bodyCode = lookupNaifBodyCode(target);
414 QString msg =
"Unable to find target radii for given target [" 419 PvlGroup radiiGroup = Target::radiiGroup(
int(bodyCode));
421 mapping += radiiGroup.
findKeyword(
"EquatorialRadius");
423 cachedResults[target] = mapping;
444 static bool pckLoaded =
false;
446 NaifStatus::CheckErrors();
448 FileName kern(
"$base/kernels/pck/pck?????.tpc");
453 furnsh_c(kernName.toLatin1().data());
459 SpiceDouble radii[3];
460 bodvar_c(bodyCode,
"RADII", &n, radii);
463 NaifStatus::CheckErrors();
466 QString msg =
"Unable to find radii for target code [" +
toString(bodyCode)
467 +
"]. Target code was not found in furnished kernels.";
487 SpiceInt Target::naifBodyCode()
const {
500 SpiceInt Target::naifPlanetSystemCode()
const {
501 return *m_systemCode;
506 QString Target::name()
const {
512 QString Target::systemName()
const {
513 return *m_systemName;
522 std::vector<Distance> Target::radii()
const {
527 int Target::frameType() {
528 return spice()->bodyRotation()->getFrameType();
532 std::vector<Angle> Target::poleRaCoefs() {
533 return spice()->bodyRotation()->poleRaCoefs();
537 std::vector<Angle> Target::poleDecCoefs() {
538 return spice()->bodyRotation()->poleDecCoefs();
542 std::vector<Angle> Target::pmCoefs() {
543 return spice()->bodyRotation()->pmCoefs();
547 std::vector<double> Target::poleRaNutPrecCoefs() {
548 return spice()->bodyRotation()->poleRaNutPrecCoefs();
552 std::vector<double> Target::poleDecNutPrecCoefs() {
553 return spice()->bodyRotation()->poleDecNutPrecCoefs();
557 std::vector<double> Target::pmNutPrecCoefs() {
558 return spice()->bodyRotation()->pmNutPrecCoefs();
562 std::vector<Angle> Target::sysNutPrecConstants() {
563 return spice()->bodyRotation()->sysNutPrecConstants();
567 std::vector<Angle> Target::sysNutPrecCoefs() {
568 return spice()->bodyRotation()->sysNutPrecCoefs();
575 void Target::restoreShape() {
576 if (m_shape->name() !=
"Ellipsoid") {
581 else if (m_originalShape == NULL) {
585 m_shape = m_originalShape;
586 m_originalShape = NULL;
593 void Target::setShapeEllipsoid() {
595 m_originalShape = m_shape;
605 void Target::setRadii(std::vector<Distance> radii) {
606 m_radii[0] = radii[0];
607 m_radii[1] = radii[1];
608 m_radii[2] = radii[2];
const char * what() const
Returns a string representation of this exception in its current state.
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.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
int toInt(const QString &string)
Global function to convert from a string to an integer.
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
Namespace for the standard library.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Define shapes and provide utilities for Isis3 targets.
Distance measurement, usually in meters.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not...
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
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.
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Define shapes and provide utilities for Isis3 targets.
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name...
Namespace for ISIS/Bullet specific routines.
Obtain SPICE information for a spacecraft.
Contains Pvl Groups and Pvl Objects.