Isis 3 Programmer Reference
Spice.h
Go to the documentation of this file.
1 #ifndef Spice_h
2 #define Spice_h
3 
24 #include <string>
25 #include <vector>
26 
27 #include <SpiceUsr.h>
28 #include <SpiceZfc.h>
29 #include <SpiceZmc.h>
30 
31 #include "Pvl.h"
32 #include "ShapeModel.h"
33 #include "SpicePosition.h"
34 #include "SpiceRotation.h"
35 
36 namespace Isis {
37  class Cube;
38  class iTime;
39  class Distance;
40  class EllipsoidShape;
41  class Longitude;
42  class Target;
43 
294  class Spice {
295  public:
296  // constructors
297  Spice(Pvl &cubeLabel);
298  Spice(Cube &cube);
299  Spice(Cube &cube, bool noTables);
300 
301  // destructor
302  virtual ~Spice();
303 
304  // Methods
305  void setTime(const iTime &time);
306  void instrumentPosition(double p[3]) const;
307  void instrumentBodyFixedPosition(double p[3]) const;
308  void sunPosition(double p[3]) const;
309  double targetCenterDistance() const;
311  void instrumentBodyFixedVelocity(double v[3]) const;
312  iTime time() const;
313 
314  void radii(Distance r[3]) const;
315 
316  void createCache(iTime startTime, iTime endTime,
317  const int size, double tol);
318  iTime cacheStartTime() const;
319  iTime cacheEndTime() const;
320 
321  void subSpacecraftPoint(double &lat, double &lon);
322  void subSolarPoint(double &lat, double &lon);
323 
324  Target *target() const;
325  QString targetName() const;
326 
327  iTime getClockTime(QString clockValue,
328  int sclkCode = -1,
329  bool clockTicks=false);
330  SpiceDouble getDouble(const QString &key, int index = 0);
331  SpiceInt getInteger(const QString &key, int index = 0);
332  QString getString(const QString &key, int index = 0);
333 
334  SpicePosition *sunPosition() const;
336  SpiceRotation *bodyRotation() const;
338 
339  bool hasKernels(Pvl &lab);
340  bool isTimeSet();
341 
342  SpiceInt naifBodyCode() const;
343  SpiceInt naifSpkCode() const;
344  SpiceInt naifCkCode() const;
345  SpiceInt naifIkCode() const;
346  SpiceInt naifSclkCode() const;
347  SpiceInt naifBodyFrameCode() const;
348 
350  virtual double resolution();
351 
352  protected:
362  };
363 
364  QVariant readValue(QString key, SpiceValueType type, int index = 0);
365 
366  void storeResult(QString name, SpiceValueType type, QVariant value);
367  QVariant getStoredResult(QString name, SpiceValueType type);
368 
369  void storeValue(QString key, int index, SpiceValueType type,
370  QVariant value);
371  QVariant readStoredValue(QString key, SpiceValueType type, int index);
372 
373  // Leave these protected so that inheriting classes don't
374  // have to convert between double and spicedouble
375  // None of the below data elements are usable (except
376  // m_radii) until SetEphemerisTime is invoked
377  SpiceDouble m_uB[3];
382  SpiceDouble m_BJ[3][3];
391  private:
392  // Don't allow copies
393  Spice(const Spice &other);
394  Spice &operator=(const Spice &other);
395 
396  void init(Pvl &lab, bool noTables);
397 
398  void load(PvlKeyword &key, bool notab);
399  void computeSolarLongitude(iTime et);
400 
405 
406  // cache stuff
409  SpiceDouble *m_cacheSize;
410 
411  SpiceDouble *m_startTimePadding;
412  SpiceDouble *m_endTimePadding;
413 
418 
420 
421  // Constants
422  // SpiceInt *m_bodyCode; /**< The NaifBodyCode value, if it exists in the
423  // labels. Otherwise, if the target is sky,
424  // it's the SPK code and if not sky then it's
425  // calculated by the naifBodyCode() method.*/
426  SpiceInt *m_spkCode;
427  SpiceInt *m_ckCode;
428  SpiceInt *m_ikCode;
429  SpiceInt *m_sclkCode;
430  SpiceInt *m_spkBodyCode;
431  SpiceInt *m_bodyFrameCode;
436 
437  bool m_usingNaif;
439  };
440 }
441 
442 #endif
SpiceDouble * m_cacheSize
Cache size. Note: This value is 1 for Framing cameras.
Definition: Spice.h:409
SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition: Spice.cpp:1467
void computeSolarLongitude(iTime et)
Computes the solar longitude for the given ephemeris time.
Definition: Spice.cpp:1311
virtual ~Spice()
Destroys the Spice object.
Definition: Spice.cpp:435
SpicePosition * m_sunPosition
Sun spice position.
Definition: Spice.h:416
PvlObject * m_naifKeywords
NaifKeywords PvlObject from cube.
Definition: Spice.h:435
void load(PvlKeyword &key, bool notab)
Loads/furnishes NAIF kernel(s)
Definition: Spice.cpp:410
Parse and return pieces of a time string.
Definition: iTime.h:78
SpiceByteCode type.
Definition: Spice.h:361
iTime * m_et
Ephemeris time (read NAIF documentation for a detailed description)
Definition: Spice.h:402
void instrumentBodyFixedVelocity(double v[3]) const
Returns the spacecraft velocity in body-fixed frame km/sec units.
Definition: Spice.cpp:778
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:949
SpiceValueType
NAIF value primitive type.
Definition: Spice.h:357
bool m_usingNaif
Indicates whether we are reading values from the NaifKeywords PvlObject in cube.
Definition: Spice.h:437
SpiceRotation * bodyRotation() const
Accessor method for the body rotation.
Definition: Spice.cpp:1478
QVector< QString > * m_kernels
Vector containing kernels filenames.
Definition: Spice.h:403
virtual double resolution()
Virtual method that returns the pixel resolution of the sensor in meters/pix.
Definition: Spice.cpp:933
SpicePosition * m_instrumentPosition
Instrument spice position.
Definition: Spice.h:414
SpiceDouble m_BJ[3][3]
This contains the transformation matrix from J2000 (J) to Body fixed (B).
Definition: Spice.h:382
SpiceDouble * m_startTimePadding
Kernels pvl group StartPadding keyword value.
Definition: Spice.h:411
SpiceInt naifSclkCode() const
This returns the NAIF SCLK code to use when reading from instrument kernels.
Definition: Spice.cpp:903
QString targetName() const
Returns the QString name of the target.
Definition: Spice.cpp:1300
void createCache(iTime startTime, iTime endTime, const int size, double tol)
This method creates an internal cache of spacecraft and sun positions over a specified time range...
Definition: Spice.cpp:574
SpiceInt * m_spkBodyCode
Spacecraft and planet ephemeris kernel (SPK) body code.
Definition: Spice.h:430
Distance measurement, usually in meters.
Definition: Distance.h:47
Longitude * m_solarLongitude
Body rotation solar longitude value.
Definition: Spice.h:401
iTime * m_endTime
Corrected end (shutter close) time of the observation.
Definition: Spice.h:408
SpiceRotation * m_bodyRotation
Body spice rotation.
Definition: Spice.h:417
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
iTime cacheEndTime() const
Accessor method for the cache end time.
Definition: Spice.cpp:683
Spice(Pvl &cubeLabel)
Constructs a Spice object and loads SPICE kernels using information from the label object...
Definition: Spice.cpp:59
bool hasKernels(Pvl &lab)
Returns true if the kernel group has kernel files.
Definition: Spice.cpp:1393
Target * target() const
Returns a pointer to the target object.
Definition: Spice.cpp:1290
void subSolarPoint(double &lat, double &lon)
Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east...
Definition: Spice.cpp:1251
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:893
SpicePosition * sunPosition() const
Accessor method for the sun position.
Definition: Spice.cpp:1456
A single keyword-value pair.
Definition: PvlKeyword.h:98
iTime getClockTime(QString clockValue, int sclkCode=-1, bool clockTicks=false)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:977
SpiceRotation * m_instrumentRotation
Instrument spice rotation.
Definition: Spice.h:415
iTime * m_startTime
Corrected start (shutter open) time of the observation.
Definition: Spice.h:407
Obtain SPICE rotation information for a body.
Container for cube-like labels.
Definition: Pvl.h:135
This class is used to create and store valid Isis3 targets.
Definition: Target.h:76
SpiceInt * m_ikCode
Instrument kernel (IK) code.
Definition: Spice.h:428
void instrumentBodyFixedPosition(double p[3]) const
Returns the spacecraft position in body-fixed frame km units.
Definition: Spice.cpp:760
SpiceInt * m_sclkCode
Spacecraft clock correlation kernel (SCLK) code.
Definition: Spice.h:429
QString getString(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1185
SpiceDouble * m_endTimePadding
Kernels pvl group EndPadding keyword value.
Definition: Spice.h:412
SpiceInt naifBodyFrameCode() const
This returns the NAIF body frame code.
Definition: Spice.cpp:914
SpiceString type.
Definition: Spice.h:359
bool m_allowDownsizing
Indicates whether to allow downsizing.
Definition: Spice.h:419
Obtain SPICE position information for a body.
SpiceInt naifBodyCode() const
This returns the NAIF body code of the target indicated in the labels.
Definition: Spice.cpp:866
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1489
bool isTimeSet()
Returns true if time has been initialized.
Definition: Spice.cpp:1444
Obtain SPICE information for a spacecraft.
Definition: Spice.h:294
void init(Pvl &lab, bool noTables)
Initialization of Spice object.
Definition: Spice.cpp:120
PvlObject getStoredNaifKeywords() const
This returns the PvlObject that stores all of the requested Naif data and can be a replacement for fu...
Definition: Spice.cpp:923
SpiceDouble type.
Definition: Spice.h:358
SpiceInt naifSpkCode() const
This returns the NAIF SPK code to use when reading from SPK kernels.
Definition: Spice.cpp:875
Target * m_target
Target of the observation.
Definition: Spice.h:404
SpiceDouble m_uB[3]
This contains the sun position (u) in the bodyfixed reference frame (B).
Definition: Spice.h:377
QVariant readValue(QString key, SpiceValueType type, int index=0)
This should be used for reading ALL text naif kernel values.
Definition: Spice.cpp:1017
void radii(Distance r[3]) const
Returns the radii of the body in km.
Definition: Spice.cpp:855
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
iTime cacheStartTime() const
Accessor method for the cache start time.
Definition: Spice.cpp:668
SpiceInt naifCkCode() const
This returns the NAIF CK code to use when reading from CK kernels.
Definition: Spice.cpp:884
SpiceInt * m_ckCode
Camera kernel (CK) code.
Definition: Spice.h:427
Longitude solarLongitude()
Returns the solar longitude.
Definition: Spice.cpp:1376
double targetCenterDistance() const
Calculates and returns the distance from the spacecraft to the target center.
Definition: Spice.cpp:843
SpiceInt type.
Definition: Spice.h:360
void setTime(const iTime &time)
Sets the ephemeris time and reads the spacecraft and sun position from the kernels at that instant in...
Definition: Spice.cpp:705
SpiceInt * m_spkCode
Spacecraft and planet ephemeris kernel (SPK) code.
Definition: Spice.h:426
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:963
SpiceInt * m_bodyFrameCode
Naif&#39;s BODY_FRAME_CODE value.
Definition: Spice.h:431
IO Handler for Isis Cubes.
Definition: Cube.h:170
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:809
void subSpacecraftPoint(double &lat, double &lon)
Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east...
Definition: Spice.cpp:1202