/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/examples/Delphi/EclipseU.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/examples/Delphi/EclipseU.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 6293 byte(s)
Added tpsystools component
1 (* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is TurboPower SysTools
15 *
16 * The Initial Developer of the Original Code is
17 * TurboPower Software
18 *
19 * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * ***** END LICENSE BLOCK ***** *)
25
26 unit EclipseU;
27
28 interface
29
30 uses
31 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
32 StBase, StDate, StList, StEclpse;
33
34 type
35 TForm1 = class(TForm)
36 Memo1: TMemo;
37 Button1: TButton;
38 YearEF: TEdit;
39 procedure Button1Click(Sender: TObject);
40 procedure FormCreate(Sender: TObject);
41 private
42 { Private declarations }
43 public
44 { Public declarations }
45
46 procedure WriteLunarData(Eclipse : TStEclipseRecord; SL : TStrings);
47 procedure WriteSolarData(Eclipse : TStEclipseRecord; SL : TStrings);
48 end;
49
50 var
51 Form1: TForm1;
52
53 implementation
54
55 {$R *.DFM}
56
57 procedure TForm1.FormCreate(Sender: TObject);
58 begin
59 YearEF.Text := '1998';
60 end;
61
62 {-----------------------------------------------------------------------------}
63
64 procedure TForm1.Button1Click(Sender: TObject);
65 var
66 I : integer;
67 Data : TStEclipses;
68 Eclipse : TStEclipseRecord;
69 begin
70 Memo1.Clear;
71 Data := TStEclipses.Create(TStListNode);
72 try
73 Data.FindEclipses(StrToInt(YearEF.Text));
74 for I := 0 to pred(Data.Count) do begin
75 Eclipse := TStEclipseRecord(Data.Eclipses[I]^);
76 if (Eclipse.Etype in [etLunarPenumbral, etLunarPartial, etLunarTotal]) then
77 WriteLunarData(Eclipse, Memo1.Lines)
78 else
79 WriteSolarData(Eclipse, Memo1.Lines);
80 end;
81 finally
82 Data.Free;
83 end;
84 end;
85
86 {-----------------------------------------------------------------------------}
87
88 procedure TForm1.WriteLunarData(Eclipse : TStEclipseRecord; SL : TStrings);
89 var
90 S : string[255];
91 begin
92 case Eclipse.EType of
93 etLunarPenumbral : SL.Add('Lunar - Penumbra');
94 etLunarPartial : SL.Add('Lunar - Partial');
95 etLunarTotal : SL.Add('Lunar - Total');
96 end;
97 Str(Eclipse.Magnitude : 5 : 3, S);
98 SL.Add('Mag: ' + S);
99
100 SL.Add('Penumbral Starts: ' + DateTimeToStr(Eclipse.LContacts.UT1));
101 SL.Add('First Contact: ' + DateTimeToStr(Eclipse.LContacts.FirstContact));
102 SL.Add('Second Contact: ' + DateTimeToStr(Eclipse.LContacts.SecondContact));
103 SL.Add('Mid Eclipse ' + DateTimeToStr(Eclipse.LContacts.MidEclipse));
104 SL.Add('Third Contact: ' + DateTimeToStr(Eclipse.LContacts.ThirdContact));
105 SL.Add('Fourth Contact: ' + DateTimeToStr(Eclipse.LContacts.FourthContact));
106 SL.Add('Penumbral Ends: ' + DateTimeToStr(Eclipse.LContacts.UT2));
107
108 SL.Add('');
109 SL.Add('');
110 SL.Add('');
111 end;
112
113 {-----------------------------------------------------------------------------}
114
115 procedure TForm1.WriteSolarData(Eclipse : TStEclipseRecord; SL : TStrings);
116 var
117 I : integer;
118 S,
119 P : string[255];
120 LL : TStLongLat;
121 begin
122 case Eclipse.EType of
123 etSolarPartial : begin
124 SL.Add('Solar - Partial');
125 Str(Eclipse.Magnitude : 5 : 3, S);
126 SL.Add('Mag: ' + S);
127 if Eclipse.Hemisphere = htNorthern then
128 SL.Add('Hemisphere: Northern')
129 else
130 SL.Add('Hemisphere: Southern');
131 SL.Add('Mid Eclipse: ' +
132 DateTimeToStr(Eclipse.LContacts.MidEclipse));
133 end;
134 etSolarTotal : begin
135 SL.Add('Solar - Total');
136 SL.Add('Mag: N/A');
137 if Eclipse.Hemisphere = htNorthern then
138 SL.Add('Hemisphere: Northern')
139 else
140 SL.Add('Hemisphere: Southern');
141 SL.Add('Mid Eclipse: ' +
142 DateTimeToStr(Eclipse.LContacts.MidEclipse));
143 end;
144
145 etSolarAnnularTotal : begin
146 Str(Eclipse.Magnitude : 5 : 3, S);
147 SL.Add('Mag: N/A');
148 if Eclipse.Hemisphere = htNorthern then
149 SL.Add('Hemisphere: Northern')
150 else
151 SL.Add('Hemisphere: Southern');
152 SL.Add('Mid Eclipse: ' +
153 DateTimeToStr(Eclipse.LContacts.MidEclipse));
154 end;
155
156 etSolarAnnular : begin
157 SL.Add('Solar - Annular');
158 SL.Add('Mag: N/A');
159 if Eclipse.Hemisphere = htNorthern then
160 SL.Add('Hemisphere: Northern')
161 else
162 SL.Add('Hemisphere: Southern');
163 SL.Add('Mid Eclipse: ' +
164 DateTimeToStr(Eclipse.LContacts.MidEclipse));
165 end;
166 end;
167 if Assigned(Eclipse.Path) then begin
168 for I := 0 to pred(Eclipse.Path.Count) do begin
169 LL := TStLongLat(Eclipse.Path.Items[I].Data^);
170 P := ' ' + DateTimeToStr(LL.JD) + ' ';
171
172 Str(LL.Longitude : 7 : 2, S);
173 P := P + S + ' ';
174
175 Str(LL.Latitude : 6 : 2, S);
176 P := P + S + ' ';
177
178 Str(LL.Duration : 4 : 2, S);
179 P := P + S;
180 SL.Add(P);
181 end;
182 end;
183 SL.Add('');
184 SL.Add('');
185 SL.Add('');
186 end;
187
188
189
190 end.

  ViewVC Help
Powered by ViewVC 1.1.20