Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

eclipsefinder.h

Go to the documentation of this file.
00001 // eclipsefinder.h by Christophe Teyssier <chris@teyssier.org>
00002 // adapted form wineclipses.h by Kendrix <kendrix@wanadoo.fr>
00003 // 
00004 // Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
00005 //
00006 // Compute Solar Eclipses for our Solar System planets
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
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 

Generated on Sat Jan 14 22:30:30 2006 for Celestia by  doxygen 1.4.1