diff options
Diffstat (limited to 'src/calendar.h')
-rw-r--r-- | src/calendar.h | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/src/calendar.h b/src/calendar.h index c87531d..b17e0d5 100644 --- a/src/calendar.h +++ b/src/calendar.h | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef _CALENDAR_H_ | 1 | #ifndef _CALENDAR_H_ |
2 | #define _CALENDAR_H_ | 2 | #define _CALENDAR_H_ |
3 | 3 | ||
4 | |||
5 | #include <iostream> | 4 | #include <iostream> |
6 | #include <string> | 5 | #include <string> |
7 | #include <ctime> | 6 | #include <ctime> |
@@ -10,10 +9,38 @@ | |||
10 | #include <math.h> | 9 | #include <math.h> |
11 | using namespace std; | 10 | using namespace std; |
12 | 11 | ||
13 | typedef struct tm Date; | ||
14 | |||
15 | extern double pi; | 12 | extern double pi; |
16 | extern double delta; | 13 | extern double delta; |
14 | extern char jieqi[25][10]; | ||
15 | |||
16 | typedef struct tm Date; | ||
17 | struct point | ||
18 | { | ||
19 | int year,mon,day,hour,min,sec; | ||
20 | bool isShuo,isJieqi,isZhongqi; | ||
21 | int JieqiIndex,MonthIndex; | ||
22 | bool RunYue; | ||
23 | double time; | ||
24 | point* next; | ||
25 | |||
26 | 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) | ||
27 | { | ||
28 | this->year=year; | ||
29 | this->mon=mon; | ||
30 | this->day=day; | ||
31 | this->hour=hour; | ||
32 | this->min=min; | ||
33 | this->sec=sec; | ||
34 | this->isShuo=isShuo; | ||
35 | this->isJieqi=isJieqi; | ||
36 | this->isZhongqi=isZhongqi; | ||
37 | this->JieqiIndex=JieqiIndex; | ||
38 | this->MonthIndex=MonthIndex; | ||
39 | this->RunYue=RunYue; | ||
40 | this->time=time; | ||
41 | this->next=NULL; | ||
42 | } | ||
43 | }; | ||
17 | 44 | ||
18 | class Julian | 45 | class Julian |
19 | { | 46 | { |
@@ -36,7 +63,8 @@ class Julian | |||
36 | }; | 63 | }; |
37 | 64 | ||
38 | 65 | ||
39 | class parameter{ | 66 | class parameter |
67 | { | ||
40 | private: | 68 | private: |
41 | 69 | ||
42 | // 计算地球日心黄经 | 70 | // 计算地球日心黄经 |
@@ -53,9 +81,8 @@ class parameter{ | |||
53 | //获取章动有关角 | 81 | //获取章动有关角 |
54 | vector<double> get_angle(double T); | 82 | vector<double> get_angle(double T); |
55 | 83 | ||
56 | |||
57 | //章动修正 | 84 | //章动修正 |
58 | double nution(double T); | 85 | double nutation(double T); |
59 | 86 | ||
60 | //光行差修正,返回弧度制 | 87 | //光行差修正,返回弧度制 |
61 | double aberration(double R); | 88 | double aberration(double R); |
@@ -66,6 +93,35 @@ class parameter{ | |||
66 | public: | 93 | public: |
67 | 94 | ||
68 | double sun_longitude(double t); | 95 | double sun_longitude(double t); |
96 | |||
97 | double moon_longitude(double t); | ||
98 | }; | ||
99 | |||
100 | class List | ||
101 | { | ||
102 | private: | ||
103 | point *head,*tail;//链表头尾指针 | ||
104 | |||
105 | bool later(point* a,point* b); | ||
106 | |||
107 | public: | ||
108 | vector<point*> shuori_vec; //记录各朔日的地址 | ||
109 | vector<point*> zhongqi_vec;//记录各中气的地址 | ||
110 | |||
111 | List(); | ||
112 | ~List(); | ||
113 | |||
114 | // 链表尾部插入 | ||
115 | void append(Date* date,bool isShuo,bool isJieqi,bool isZhongqi,int JieqiIndex,double time); | ||
116 | |||
117 | //对链表进行“排序” | ||
118 | void lunar_sort(); | ||
119 | |||
120 | //置闰月 | ||
121 | void Run(); | ||
122 | |||
123 | //输出链表内容 | ||
124 | void output(); | ||
69 | }; | 125 | }; |
70 | 126 | ||
71 | #endif | 127 | #endif |