11#include "EllipsoidShape.h"
13#include "IException.h"
14#include "NaifStatus.h"
17#include "ShapeModelFactory.h"
18#include "SpecialPixel.h"
53 *
m_name = inst[
"TargetName"][0];
54 QString trykey =
"NaifIkCode";
59 trykey =
"NaifFrameCode";
62 if (
name().toUpper() ==
"SKY") {
65 int ikCode =
toInt(kernels[trykey][0]);
73 (*m_systemName).append(
"THE COSMOS");
82 SpiceChar naifBuf[40];
84 bodc2n_c((SpiceInt) *
m_systemCode,
sizeof(naifBuf), naifBuf, &found);
87 (*m_systemName).append(s.c_str());
120 QString targetName = inst[
"TargetName"][0];
125 QString trykey =
"NaifIkCode";
130 trykey =
"NaifFrameCode";
136 int ikCode =
toInt(kernels[trykey][0]);
144 (*m_systemName).append(
"THE COSMOS");
236 code =
m_spice->getInteger(
"BODY_CODE", 0);
241 && lab.
findObject(
"NaifKeywords").hasKeyword(
"BODY_CODE") ) {
242 code = int(lab.
findObject(
"NaifKeywords").findKeyword(
"BODY_CODE"));
248 "BODY_CODE not found for this Target.",
256 "Unable to look up NAIF body code for this Target.",
274 bodn2c_c(
name.toLatin1().data(), &code, &found);
276 QString msg =
"Could not convert Target [" +
name +
277 "] to NAIF body code";
316 target = mapping[
"TargetName"][0];
320 if (target.isEmpty()) {
321 bool hasInstrumentGroup = cubeLab.
findObject(
"IsisCube").hasGroup(
"Instrument");
322 if (hasInstrumentGroup) {
325 target = inst[
"TargetName"][0];
332 if (target.isEmpty()) {
334 "Unable to find a TargetName keyword in the given PVL.",
345 mapping.
addKeyword(
radii.findKeyword(
"EquatorialRadius"), PvlContainer::Replace );
346 mapping.
addKeyword(
radii.findKeyword(
"PolarRadius"), PvlContainer::Replace );
363 SpiceInt bodyCode = 0;
371 QString radiiKeyword =
"BODY" +
toString(
int(bodyCode)) +
"_RADII";
377 PvlContainer::Replace);
380 PvlContainer::Replace);
386 if (naifKeywords.
hasKeyword(
"BODY_FRAME_CODE")) {
389 QString radiiKeyword =
"BODY" + bodyFrame[0] +
"_RADII";
396 PvlContainer::Replace);
400 PvlContainer::Replace);
409 QString msg =
"Unable to find Equatorial and Polar radii for target [" + target +
"].";
430 if (target.isEmpty()) {
432 "Unable to find TargetRadii. The given TargetName is empty.",
439 if (cachedResults.contains(target)) {
440 mapping = cachedResults[target];
444 SpiceInt bodyCode = 0;
449 QString msg =
"Unable to find target radii for given target ["
456 mapping +=
radiiGroup.findKeyword(
"EquatorialRadius");
457 mapping +=
radiiGroup.findKeyword(
"PolarRadius");
458 cachedResults[target] = mapping;
479 static bool pckLoaded =
false;
483 FileName kern(
"$base/kernels/pck/pck?????.tpc");
488 furnsh_c(kernName.toLatin1().data());
494 SpiceDouble
radii[3];
495 bodvar_c(bodyCode,
"RADII", &n,
radii);
501 QString msg =
"Unable to find radii for target code [" +
toString(bodyCode)
502 +
"]. Target code was not found in furnished kernels.";
562 int Target::frameType() {
567 std::vector<Angle> Target::poleRaCoefs() {
572 std::vector<Angle> Target::poleDecCoefs() {
577 std::vector<Angle> Target::pmCoefs() {
582 std::vector<double> Target::poleRaNutPrecCoefs() {
587 std::vector<double> Target::poleDecNutPrecCoefs() {
592 std::vector<double> Target::pmNutPrecCoefs() {
597 std::vector<Angle> Target::sysNutPrecConstants() {
602 std::vector<Angle> Target::sysNutPrecCoefs() {
611 if (
m_shape->name() !=
"Ellipsoid") {
Distance measurement, usually in meters.
@ Meters
The distance is being specified in meters.
Define shapes and provide utilities for ISIS targets.
File name manipulation and expansion.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ Io
A type of error that occurred when performing an actual I/O operation.
const char * what() const
Returns a string representation of this exception in its current state.
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
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.
Contains Pvl Groups and Pvl Objects.
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.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
@ Traverse
Search child objects.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
static ShapeModel * create(Target *target, Pvl &pvl)
Construct a valid shape model from the given target and contents of kernels group.
Define shapes and provide utilities for Isis targets.
Obtain SPICE information for a spacecraft.
virtual SpiceRotation * bodyRotation() const
Accessor method for the body rotation.
FrameType getFrameType()
Accessor method to get the rotation frame type.
std::vector< Angle > poleDecCoefs()
Return the coefficients used to calculate the target body pole dec.
std::vector< Angle > sysNutPrecCoefs()
Return the coefficients used to calculate the target body system nut/prec angles.
std::vector< Angle > sysNutPrecConstants()
Return the constants used to calculate the target body system nut/prec angles.
std::vector< double > poleRaNutPrecCoefs()
Return the coefficients used to calculate the target body pole ra nut/prec coefficients.
std::vector< Angle > poleRaCoefs()
Return the coefficients used to calculate the target body pole ra.
std::vector< double > pmNutPrecCoefs()
Return the coefficients used to calculate the target body pm nut/prec coefficients.
std::vector< double > poleDecNutPrecCoefs()
Return the coefficients used to calculate the target body pole dec nut/prec coefficients.
std::vector< Angle > pmCoefs()
Return the coefficients used to calculate the target body prime meridian.
SpiceInt naifBodyCode() const
This returns the NAIF body code of the target.
SpiceInt * m_systemCode
The NaifBodyCode of the targets planetary system If the target is sky, then what should this be?
~Target()
Destroys the Target.
void init()
Initialize member variables.
Target()
Constructs an empty Target object.
QString * m_systemName
name of the planetary system of the target
void setSpice(Spice *spice)
Set the Spice pointer for the Target.
void setRadii(std::vector< Distance > radii)
Sets the radii of the body.
QString * m_name
target name
Spice * spice() const
Return the spice object.
static PvlGroup radiiGroup(QString target)
Creates a Pvl Group with keywords TargetName, EquitorialRadius, and PolarRadius.
std::vector< Distance > m_radii
target radii
void setShapeEllipsoid()
Set the shape to the ellipsoid and save the original shape.
std::vector< Distance > radii() const
Returns the radii of the body in km.
ShapeModel * m_shape
target shape model
ShapeModel * shape() const
Return the shape.
static SpiceInt lookupNaifBodyCode(QString name)
This returns the NAIF body code of the target indicated in the labels.
SpiceInt naifPlanetSystemCode() const
This returns the NAIF planet system body code of the target.
SpiceInt * m_bodyCode
The NaifBodyCode value, if it exists in the labels.
bool isSky() const
Return if our target is the sky.
QString name() const
Return target name.
Spice * m_spice
parent Spice object, needed to get pixel resolution in ShapeModels
void restoreShape()
Restores the shape to the original after setShapeEllipsoid has overridden it.
QString systemName() const
Return planet system name.
bool m_sky
flag indicating target is the sky
ShapeModel * m_originalShape
target original shape model
void setName(QString name)
Set the name for the Target.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int toInt(const QString &string)
Global function to convert from a string to an integer.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Namespace for the standard library.