00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _ORSA_FILE_JPL_H_
00026 #define _ORSA_FILE_JPL_H_
00027
00028 namespace orsa {
00029
00030 enum JPL_planets {
00031 NONE=0,
00032 MERCURY=1,
00033 VENUS=2,
00034 EARTH=3,
00035 MARS=4,
00036 JUPITER=5,
00037 SATURN=6,
00038 URANUS=7,
00039 NEPTUNE=8,
00040 PLUTO=9,
00041 MOON=10,
00042 SUN=11,
00043 SOLAR_SYSTEM_BARYCENTER=12,
00044 EARTH_MOON_BARYCENTER=13,
00045 NUTATIONS=14,
00046 LIBRATIONS=15,
00047 EARTH_AND_MOON=1000
00048 };
00049
00050
00051
00052 }
00053
00054 #include <string>
00055 #include <map>
00056 #include <list>
00057
00058 #include "orsa_units.h"
00059 #include "orsa_coord.h"
00060
00061
00062 namespace orsa {
00063
00064 class Body;
00065 class BodyWithEpoch;
00066 class JPLBody;
00067 class Frame;
00068 class Date;
00069 class UniverseTypeAwareTime;
00070
00071 inline void convert(JPL_planets & jp, const unsigned int i) {
00072 switch(i) {
00073 case 0: jp = NONE; break;
00074
00075 case 1: jp = MERCURY; break;
00076 case 2: jp = VENUS; break;
00077 case 3: jp = EARTH; break;
00078 case 4: jp = MARS; break;
00079 case 5: jp = JUPITER; break;
00080 case 6: jp = SATURN; break;
00081 case 7: jp = URANUS; break;
00082 case 8: jp = NEPTUNE; break;
00083 case 9: jp = PLUTO; break;
00084 case 10: jp = MOON; break;
00085 case 11: jp = SUN; break;
00086 case 12: jp = SOLAR_SYSTEM_BARYCENTER; break;
00087 case 13: jp = EARTH_MOON_BARYCENTER; break;
00088 case 14: jp = NUTATIONS; break;
00089 case 15: jp = LIBRATIONS; break;
00090
00091 case 1000: jp = EARTH_AND_MOON; break;
00092
00093 default:
00094 ORSA_ERROR("conversion problem: i = %i",i);
00095 break;
00096 }
00097 }
00098
00099
00100 class JPLFile {
00101 public:
00102 JPLFile(std::string);
00103 ~JPLFile();
00104
00105 public:
00106
00107 bool GoodFile() const {
00108 return (jpl_database != 0);
00109 }
00110
00111 public:
00112 void GetEph(const UniverseTypeAwareTime & date, JPL_planets target, JPL_planets center, Vector & position, Vector & velocity);
00113 inline void GetEph(const UniverseTypeAwareTime & date, JPL_planets target, Vector & position, Vector & velocity) {
00114 GetEph(date, target, default_ephem_center, position, velocity);
00115 }
00116
00117 const UniverseTypeAwareTime & EphemStart();
00118 const UniverseTypeAwareTime & EphemEnd();
00119
00120 double GetMass(JPL_planets planet);
00121
00122 double GetAU_MKS();
00123 double GetMSun_MKS();
00124 double GetMJupiter_MKS();
00125 double GetMEarth_MKS();
00126 double GetMMoon_MKS();
00127 double GetC_MKS();
00128 double GetREarth_MKS();
00129 double GetRMoon_MKS();
00130
00131 public:
00132 double GetTag(std::string);
00133
00134 private:
00135 std::map <std::string,double> * map_tag;
00136
00137 private:
00138 bool bool_ephem_start_computed;
00139 bool bool_ephem_end_computed;
00140 void ComputeEphemStart();
00141 void ComputeEphemEnd();
00142
00143 private:
00144 static const JPL_planets default_ephem_center;
00145
00146 private:
00147 void * jpl_database;
00148 bool calc_velocity;
00149
00150 UniverseTypeAwareTime ephem_start;
00151 UniverseTypeAwareTime ephem_end;
00152 };
00153
00154
00155 extern JPLFile * jpl_file;
00156
00157 class JPLCache {
00158 public:
00159 JPLCache();
00160 ~JPLCache();
00161 public:
00162 const JPLBody & GetJPLBody(const JPL_planets, const UniverseTypeAwareTime &);
00163 public:
00164 void Clear();
00165 private:
00166 typedef std::map <UniverseTypeAwareTime,JPLBody> data_map_type;
00167 typedef std::map <JPL_planets,data_map_type> big_map_type;
00168 big_map_type big_map;
00169 };
00170
00171
00172 extern JPLCache * jpl_cache;
00173
00174
00175
00176 std::string JPL_planet_name(const JPL_planets p);
00177
00178 double radius(const JPL_planets p);
00179
00180 void SetupSolarSystem(Frame &, const std::list<JPL_planets> &, const UniverseTypeAwareTime &);
00181
00182 }
00183
00184 #endif // _ORSA_FILE_JPL_H_