#ifndef _CALENDAR_H_ #define _CALENDAR_H_ #include #include #include #include #include #include using namespace std; extern double pi; extern double delta; extern char jieqi[25][10]; typedef struct tm Date; struct point { int year, mon, day, hour, min, sec; bool isShuo, isJieqi, isZhongqi; int JieqiIndex, MonthIndex; bool RunYue; double time; point *next; point(int year, int mon, int day, int hour, int min, int sec, bool isShuo, bool isJieqi, bool isZhongqi, int JieqiIndex, int MonthIndex, bool RunYue, double time) { this->year = year; this->mon = mon; this->day = day; this->hour = hour; this->min = min; this->sec = sec; this->isShuo = isShuo; this->isJieqi = isJieqi; this->isZhongqi = isZhongqi; this->JieqiIndex = JieqiIndex; this->MonthIndex = MonthIndex; this->RunYue = RunYue; this->time = time; this->next = NULL; } }; class Julian { private: static double d[23][5]; double dt_ext(int y, double jsd); //计算力学时与世界时之差,传入年份 double delta_t(int y); public: // 计算儒略日 double getJulianDay(time_t time); // 计算儒略千年数 double getJulianKiloYear(time_t time); //儒略千年数转时间戳 time_t kiloYearToTime(double t, int year); }; class parameter { private: // 计算地球日心黄经 double get_longitude(vector l, double t); // 计算地球日心黄纬 double get_latitude(vector b, double t); double get_R(vector r, double t); // 转换FK5误差,返回弧度制 double delta_FK5(double L, double B, double T); //获取章动有关角 vector get_angle(double T); //章动修正 double nutation(double T); //光行差修正,返回弧度制 double aberration(double R); // 获取地日运行参数,L为地球日心黄经,B为地球日心黄纬,R为地日距离 vector> get_parameters(double t); public: double sun_longitude(double t); double moon_longitude(double t); }; class List { private: point *head, *tail; //链表头尾指针 bool later(point *a, point *b); public: vector shuori_vec; //记录各朔日的地址 vector zhongqi_vec; //记录各中气的地址 List(); ~List(); // 链表尾部插入 void append(Date *date, bool isShuo, bool isJieqi, bool isZhongqi, int JieqiIndex, double time); //对链表进行“排序” void lunar_sort(); //置闰月 void Run(); //输出链表内容 void output(); }; #endif