Isis 3.0
Back | Home
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 
282  class Spice {
283  public:
284  // constructors
285  Spice(Pvl &cubeLabel);
286  Spice(Cube &cube);
287  Spice(Cube &cube, bool noTables);
288 
289  // destructor
290  virtual ~Spice();
291 
292  // Methods
293  void setTime(const iTime &time);
294  void instrumentPosition(double p[3]) const;
295  void instrumentBodyFixedPosition(double p[3]) const;
296  void sunPosition(double p[3]) const;
297  double targetCenterDistance() const;
299  void instrumentBodyFixedVelocity(double v[3]) const;
300  iTime time() const;
301 
302  void radii(Distance r[3]) const;
303 
304  void createCache(iTime startTime, iTime endTime,
305  const int size, double tol);
306  iTime cacheStartTime() const;
307  iTime cacheEndTime() const;
308 
309  void subSpacecraftPoint(double &lat, double &lon);
310  void subSolarPoint(double &lat, double &lon);
311 
312  Target *target() const;
313  QString targetName() const;
314 
315  iTime getClockTime(QString clockValue,
316  int sclkCode = -1);
317  SpiceDouble getDouble(const QString &key, int index = 0);
318  SpiceInt getInteger(const QString &key, int index = 0);
319  QString getString(const QString &key, int index = 0);
320 
321  SpicePosition *sunPosition() const;
323  SpiceRotation *bodyRotation() const;
325 
326  bool hasKernels(Pvl &lab);
327  bool isTimeSet();
328 
329  SpiceInt naifBodyCode() const;
330  SpiceInt naifSpkCode() const;
331  SpiceInt naifCkCode() const;
332  SpiceInt naifIkCode() const;
333  SpiceInt naifSclkCode() const;
334  SpiceInt naifBodyFrameCode() const;
335 
337  virtual double resolution();
338 
339  protected:
349  };
350 
351  QVariant readValue(QString key, SpiceValueType type, int index = 0);
352 
353  void storeResult(QString name, SpiceValueType type, QVariant value);
354  QVariant getStoredResult(QString name, SpiceValueType type);
355 
356  void storeValue(QString key, int index, SpiceValueType type,
357  QVariant value);
358  QVariant readStoredValue(QString key, SpiceValueType type, int index);
359 
360  // Leave these protected so that inheriting classes don't
361  // have to convert between double and spicedouble
362  // None of the below data elements are usable (except
363  // m_radii) until SetEphemerisTime is invoked
364  SpiceDouble m_uB[3];
369  SpiceDouble m_BJ[3][3];
378  private:
379  // Don't allow copies
380  Spice(const Spice &other);
381  Spice &operator=(const Spice &other);
382 
383  void init(Pvl &lab, bool noTables);
384 
385  void load(PvlKeyword &key, bool notab);
386  void computeSolarLongitude(iTime et);
387 
388  Longitude *m_solarLongitude;
389  iTime *m_et;
390  QVector<QString> * m_kernels;
391  Target *m_target;
392 
393  // cache stuff
394  iTime *m_startTime;
395  iTime *m_endTime;
396  SpiceDouble *m_cacheSize;
397 
398  SpiceDouble *m_startTimePadding;
399  SpiceDouble *m_endTimePadding;
400 
401  SpicePosition *m_instrumentPosition;
402  SpiceRotation *m_instrumentRotation;
403  SpicePosition *m_sunPosition;
404  SpiceRotation *m_bodyRotation;
405 
406  bool m_allowDownsizing;
407 
408  // Constants
409  // SpiceInt *m_bodyCode; /**< The NaifBodyCode value, if it exists in the
410  // labels. Otherwise, if the target is sky,
411  // it's the SPK code and if not sky then it's
412  // calculated by the naifBodyCode() method.*/
413  SpiceInt *m_spkCode;
414  SpiceInt *m_ckCode;
415  SpiceInt *m_ikCode;
416  SpiceInt *m_sclkCode;
417  SpiceInt *m_spkBodyCode;
418  SpiceInt *m_bodyFrameCode;
422  PvlObject *m_naifKeywords;
423 
424  bool m_usingNaif;
426  };
427 }
428 
429 #endif
void instrumentBodyFixedVelocity(double v[3]) const
Returns the spacecraft velocity in body-fixed frame km/sec units.
Definition: Spice.cpp:773
virtual ~Spice()
Destroys the Spice object.
Definition: Spice.cpp:430
SpiceInt naifBodyFrameCode() const
This returns the NAIF body frame code.
Definition: Spice.cpp:909
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:918
Parse and return pieces of a time string.
Definition: iTime.h:74
SpicePosition * sunPosition() const
Accessor method for the sun position.
Definition: Spice.cpp:1443
void storeValue(QString key, int index, SpiceValueType type, QVariant value)
Definition: Spice.cpp:1101
SpiceByteCode type.
Definition: Spice.h:348
SpiceInt getInteger(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:944
SpiceRotation * instrumentRotation() const
Accessor method for the instrument rotation.
Definition: Spice.cpp:1476
SpiceValueType
NAIF value primitive type.
Definition: Spice.h:344
void radii(Distance r[3]) const
Returns the radii of the body in km.
Definition: Spice.cpp:850
SpiceInt naifBodyCode() const
This returns the NAIF body code of the target indicated in the labels.
Definition: Spice.cpp:861
virtual double resolution()
Virtual method that returns the pixel resolution of the sensor in meters/pix.
Definition: Spice.cpp:928
SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition: Spice.cpp:1454
SpiceDouble m_BJ[3][3]
This contains the transformation matrix from J2000 (J) to Body fixed (B).
Definition: Spice.h:369
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:569
Distance measurement, usually in meters.
Definition: Distance.h:47
SpiceInt naifSpkCode() const
This returns the NAIF SPK code to use when reading from SPK kernels.
Definition: Spice.cpp:870
void instrumentBodyFixedPosition(double p[3]) const
Returns the spacecraft position in body-fixed frame km units.
Definition: Spice.cpp:755
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
Target * target() const
Returns a pointer to the target object.
Definition: Spice.cpp:1277
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...
Definition: Spice.cpp:804
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:1380
SpiceInt naifCkCode() const
This returns the NAIF CK code to use when reading from CK kernels.
Definition: Spice.cpp:879
SpiceRotation * bodyRotation() const
Accessor method for the body rotation.
Definition: Spice.cpp:1465
void subSolarPoint(double &lat, double &lon)
Returns the sub-solar latitude/longitude in universal coordinates (0-360 positive east...
Definition: Spice.cpp:1238
QVariant getStoredResult(QString name, SpiceValueType type)
Definition: Spice.cpp:1080
A single keyword-value pair.
Definition: PvlKeyword.h:98
iTime cacheEndTime() const
Accessor method for the cache end time.
Definition: Spice.cpp:678
Obtain SPICE rotation information for a body.
Definition: SpiceRotation.h:214
Container for cube-like labels.
Definition: Pvl.h:135
This class is used to create and store valid Isis3 targets.
Definition: Target.h:63
QString getString(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:1172
SpiceInt naifSclkCode() const
This returns the NAIF SCLK code to use when reading from instrument kernels.
Definition: Spice.cpp:898
SpiceString type.
Definition: Spice.h:346
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:888
Obtain SPICE position information for a body.
Definition: SpicePosition.h:180
bool isTimeSet()
Returns true if time has been initialized.
Definition: Spice.cpp:1431
QVariant readStoredValue(QString key, SpiceValueType type, int index)
Definition: Spice.cpp:1132
iTime getClockTime(QString clockValue, int sclkCode=-1)
This converts the spacecraft clock ticks value (clockValue) to an iTime.
Definition: Spice.cpp:969
iTime cacheStartTime() const
Accessor method for the cache start time.
Definition: Spice.cpp:663
Obtain SPICE information for a spacecraft.
Definition: Spice.h:282
SpiceDouble type.
Definition: Spice.h:345
SpiceDouble m_uB[3]
This contains the sun position (u) in the bodyfixed reference frame (B).
Definition: Spice.h:364
QVariant readValue(QString key, SpiceValueType type, int index=0)
This should be used for reading ALL text naif kernel values.
Definition: Spice.cpp:1004
void storeResult(QString name, SpiceValueType type, QVariant value)
Definition: Spice.cpp:1065
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
Longitude solarLongitude()
Returns the solar longitude.
Definition: Spice.cpp:1363
QString targetName() const
Returns the QString name of the target.
Definition: Spice.cpp:1287
double targetCenterDistance() const
Calculates and returns the distance from the spacecraft to the target center.
Definition: Spice.cpp:838
SpiceInt type.
Definition: Spice.h:347
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:700
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
Definition: Spice.cpp:958
IO Handler for Isis Cubes.
Definition: Cube.h:158
void subSpacecraftPoint(double &lat, double &lon)
Returns the sub-spacecraft latitude/longitude in universal coordinates (0-360 positive east...
Definition: Spice.cpp:1189

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 ISIS Support Center
File Modified: 07/12/2023 23:29:17