00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _ECLIPSEFINDER_H_
00014 #define _ECLIPSEFINDER_H_
00015
00016 #include <vector>
00017
00018 #include "celestiacore.h"
00019
00020 class Eclipse
00021 {
00022 public:
00023 Eclipse(int Y, int M, int D);
00024 Eclipse(double JD);
00025
00026 enum Type {
00027 Solar = 0,
00028 Moon = 1
00029 };
00030
00031 public:
00032 Body* body;
00033 std::string planete;
00034 std::string sattelite;
00035 astro::Date* date;
00036 double startTime;
00037 double endTime;
00038 };
00039
00040 class EclipseFinder
00041 {
00042 public:
00043 EclipseFinder(CelestiaCore* core,
00044 const std::string& strPlaneteToFindOn_,
00045 Eclipse::Type type_,
00046 double from,
00047 double to )
00048 :appCore(core),
00049 strPlaneteToFindOn(strPlaneteToFindOn_),
00050 type(type_),
00051 JDfrom(from),
00052 JDto(to),
00053 toProcess(true) {};
00054
00055 const std::vector<Eclipse>& getEclipses() { if (toProcess) CalculateEclipses(); return Eclipses_; };
00056
00057 private:
00058 CelestiaCore* appCore;
00059 std::vector<Eclipse> Eclipses_;
00060
00061 std::string strPlaneteToFindOn;
00062 Eclipse::Type type;
00063 double JDfrom, JDto;
00064
00065 bool toProcess;
00066
00067 int CalculateEclipses();
00068 bool testEclipse(const Body& receiver, const Body& caster, double now) const;
00069 double findEclipseSpan(const Body& receiver, const Body& caster, double now, double dt) const;
00070
00071 };
00072 #endif // _ECLIPSEFINDER_H_
00073