systools: Add astronomy units and corresponding demos

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6145 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-01-17 12:01:19 +00:00
parent 1b82e06d6b
commit d01c4e2db4
28 changed files with 11010 additions and 11 deletions

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="astcal"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="laz_systools"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="astcal.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Astcal"/>
</Unit0>
<Unit1>
<Filename Value="astcalu.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="AstCalU"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="astcal"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,46 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
program Astcal;
uses
Interfaces,
Forms, lclversion,
AstCalU in 'AstCalU.pas' {Form1};
{$R *.res}
begin
{$IF LCL_FULLVERSION >= 1080000}
Application.Scaled := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,494 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
unit AstCalU;
interface
uses
{$IFNDEF FPC}
Windows,
{$ENDIF}
SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
StConst,
StDate,
StDateSt,
StAstro,
StAstroP;
type
TForm1 = class(TForm)
Panel1: TPanel;
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Label3: TLabel;
MonthEF: TEdit;
DateEF: TEdit;
YearEF: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
GB1: TGroupBox;
Label7: TLabel;
Label8: TLabel;
LocalTimeEF: TEdit;
SiderealTimeEF: TEdit;
GB2: TGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
SunRiseEF: TEdit;
MoonRiseEF: TEdit;
SunSetEF: TEdit;
MoonSetEF: TEdit;
TwiStartEF: TEdit;
TwiEndEF: TEdit;
GB3: TGroupBox;
PositionsLB: TListBox;
Header1: THeaderControl;
GB4: TGroupBox;
NMFirstDate: TEdit;
FQFirstDate: TEdit;
NMFirstTime: TEdit;
FQFirstTime: TEdit;
FMFirstDate: TEdit;
LQFirstDate: TEdit;
LQFirstTime: TEdit;
FMFirstTime: TEdit;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
NMSecondDate: TEdit;
NMSecondTime: TEdit;
FQSecondDate: TEdit;
FQSecondTime: TEdit;
FMSecondDate: TEdit;
FMSecondTime: TEdit;
LQSecondTime: TEdit;
LQSecondDate: TEdit;
NMPrevDate: TEdit;
FQPrevDate: TEdit;
FMPrevDate: TEdit;
LQPrevDate: TEdit;
LQPrevTime: TEdit;
FMPrevTime: TEdit;
FQPrevTime: TEdit;
NMPrevTime: TEdit;
NMNextDate: TEdit;
FQNextDate: TEdit;
FMNextDate: TEdit;
LQNextDate: TEdit;
LQNextTime: TEdit;
FMNextTime: TEdit;
FQNextTime: TEdit;
NMNextTime: TEdit;
Header2: THeaderControl;
GB5: TGroupBox;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
SpringTime: TEdit;
SummerTime: TEdit;
SummerDate: TEdit;
SpringDate: TEdit;
FallTime: TEdit;
WinterTime: TEdit;
WinterDate: TEdit;
FallDate: TEdit;
EasterEF: TEdit;
PhaseLabel: TLabel;
Label23: TLabel;
SunlightEF: TEdit;
LongEF: TEdit;
LatEF: TEdit;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
TheDT : TStDateTimeRec;
RS : TStRiseSetRec;
D, M, Y : Integer;
ObsLat,
ObsLong : Double;
procedure DoCalcTimes;
procedure DoFixedCalcs;
procedure DoCalcs(ObsLong, ObsLat : Double);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.DoCalcTimes;
var
TT : TStTime;
begin
LocalTimeEF.Text := CurrentTimeString('hh:mm:ss', False);
TheDT.T := CurrentTime;
TT := Round(SiderealTime(TheDT) * 240);
SiderealTimeEF.Text := StTimeToTimeString('hh:mm:ss', TT, False);
end;
procedure TForm1.DoFixedCalcs;
var
Y,
M ,
D : integer;
DTR : TStDateTimeRec;
MPR : TStMoonPosRec;
SPR : TStPosRec;
LR : TStLunarRecord;
PA : TStPlanetsArray;
begin
{Calculate Positions}
SPR := SunPos(TheDT);
PositionsLB.Items.Add('Sun ' + HoursMin(SPR.RA) + ' ' + DegsMin(SPR.DC));
MPR := MoonPos(TheDT);
PositionsLB.Items.Add('Moon ' + HoursMin(MPR.RA) + ' ' + DegsMin(MPR.DC));
PlanetsPos(AstJulianDate(TheDT.D) + TheDT.T/86400, PA);
PositionsLB.Items.Add('Mercury ' + HoursMin(PA[1].RA) + ' ' + DegsMin(PA[1].DC));
PositionsLB.Items.Add('Venus ' + HoursMin(PA[2].RA) + ' ' + DegsMin(PA[2].DC));
PositionsLB.Items.Add('Mars ' + HoursMin(PA[3].RA) + ' ' + DegsMin(PA[3].DC));
PositionsLB.Items.Add('Jupiter ' + HoursMin(PA[4].RA) + ' ' + DegsMin(PA[4].DC));
PositionsLB.Items.Add('Saturn ' + HoursMin(PA[5].RA) + ' ' + DegsMin(PA[5].DC));
PositionsLB.Items.Add('Uranus ' + HoursMin(PA[6].RA) + ' ' + DegsMin(PA[6].DC));
PositionsLB.Items.Add('Neptune ' + HoursMin(PA[7].RA) + ' ' + DegsMin(PA[7].DC));
PositionsLB.Items.Add('Pluto ' + HoursMin(PA[8].RA) + ' ' + DegsMin(PA[8].DC));
{Calculate lunar phases}
if LunarPhase(TheDT) >= 0 then
PhaseLabel.Caption := 'Waxing'
else
PhaseLabel.Caption := 'Waning';
LR := NewMoon(TheDT.D);
NMFirstDate.Text := StDateToDateString('mm/dd', LR.T[0].D, False);
NMFirstTime.Text := StTimeToTimeString('hh:mm', LR.T[0].T, False);
if LR.T[1].D <> BadDate then
begin
NMSecondDate.Text := StDateToDateString('mm/dd', LR.T[1].D, False);
NMSecondTime.Text := StTimeToTimeString('hh:mm', LR.T[1].T, False);
end else
begin
NMSecondDate.Text := '';
NMSecondTime.Text := '';
end;
LR := FirstQuarter(TheDT.D);
FQFirstDate.Text := StDateToDateString('mm/dd', LR.T[0].D, False);
FQFirstTime.Text := StTimeToTimeString('hh:mm', LR.T[0].T, False);
if LR.T[1].D <> BadDate then
begin
FQSecondDate.Text := StDateToDateString('mm/dd', LR.T[1].D, False);
FQSecondTime.Text := StTimeToTimeString('hh:mm', LR.T[1].T, False);
end else
begin
FQSecondDate.Text := '';
FQSecondTime.Text := '';
end;
LR := FullMoon(TheDT.D);
FMFirstDate.Text := StDateToDateString('mm/dd', LR.T[0].D, False);
FMFirstTime.Text := StTimeToTimeString('hh:mm', LR.T[0].T, False);
if LR.T[1].D <> BadDate then
begin
FMSecondDate.Text := StDateToDateString('mm/dd', LR.T[1].D, False);
FMSecondTime.Text := StTimeToTimeString('hh:mm', LR.T[1].T, False);
end else
begin
FMSecondDate.Text := '';
FMSecondTime.Text := '';
end;
LR := LastQuarter(TheDT.D);
LQFirstDate.Text := StDateToDateString('mm/dd', LR.T[0].D, False);
LQFirstTime.Text := StTimeToTimeString('hh:mm', LR.T[0].T, False);
if LR.T[1].D <> BadDate then
begin
LQSecondDate.Text := StDateToDateString('mm/dd', LR.T[1].D, False);
LQSecondTime.Text := StTimeToTimeString('hh:mm', LR.T[1].T, False);
end else
begin
LQSecondDate.Text := '';
LQSecondTime.Text := '';
end;
{Calculate Next/Previous}
DTR := PrevNewMoon(TheDT.D);
if DTR.D <> BadDate then
begin
NMPrevDate.Text := StDateToDateString('mm/dd', DTR.D, False);
NMPrevTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
NMPrevDate.Text := '';
NMPrevTime.Text := '';
end;
DTR := NextNewMoon(TheDT.D);
if DTR.D <> BadDate then
begin
NMNextDate.Text := StDateToDateString('mm/dd', DTR.D, False);
NMNextTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
NMNextDate.Text := '';
NMNextTime.Text := '';
end;
DTR := PrevFirstQuarter(TheDT.D);
if DTR.D <> BadDate then
begin
FQPrevDate.Text := StDateToDateString('mm/dd', DTR.D, False);
FQPrevTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
FQPrevDate.Text := '';
FQPrevTime.Text := '';
end;
DTR := NextFirstQuarter(TheDT.D);
if DTR.D <> BadDate then
begin
FQNextDate.Text := StDateToDateString('mm/dd', DTR.D, False);
FQNextTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
FQNextDate.Text := '';
FQNextTime.Text := '';
end;
DTR := PrevFullMoon(TheDT.D);
if DTR.D <> BadDate then
begin
FMPrevDate.Text := StDateToDateString('mm/dd', DTR.D, False);
FMPrevTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
FMPrevDate.Text := '';
FMPrevTime.Text := '';
end;
DTR := NextFullMoon(TheDT.D);
if DTR.D <> BadDate then
begin
FMNextDate.Text := StDateToDateString('mm/dd', DTR.D, False);
FMNextTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
FMNextDate.Text := '';
FMNextTime.Text := '';
end;
DTR := PrevLastQuarter(TheDT.D);
if DTR.D <> BadDate then
begin
LQPrevDate.Text := StDateToDateString('mm/dd', DTR.D, False);
LQPrevTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
LQPrevDate.Text := '';
LQPrevTime.Text := '';
end;
DTR := NextLastQuarter(TheDT.D);
if DTR.D <> BadDate then
begin
LQNextDate.Text := StDateToDateString('mm/dd', DTR.D, False);
LQNextTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end else
begin
LQNextDate.Text := '';
LQNextTime.Text := '';
end;
{Calculate Other Events}
StDateToDMY(TheDT.D, D, M, Y);
EasterEF.Text := StDateToDateString('mm/dd', Easter(Y, 0), False);
DTR := Equinox(Y, 0, True);
SpringDate.Text := StDateToDateString('mm/dd', DTR.D, False);
SpringTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
DTR := Equinox(Y, 0, False);
FallDate.Text := StDateToDateString('mm/dd', DTR.D, False);
FallTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
DTR := Solstice(Y, 0, True);
SummerDate.Text := StDateToDateString('mm/dd', DTR.D, False);
SummerTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
DTR := Solstice(Y, 0, False);
WinterDate.Text := StDateToDateString('mm/dd', DTR.D, False);
WinterTime.Text := StTimeToTimeString('hh:mm', DTR.T, False);
end;
procedure TForm1.DoCalcs(ObsLong, ObsLat : Double);
begin
SunlightEF.Text := StTimeToTimeString('hh:mm',
AmountOfSunlight(TheDT.D, ObsLong, ObsLat), False);
RS := SunRiseSet(TheDT.D, ObsLong, ObsLat);
SunRiseEF.Text := StTimeToTimeString('hh:mm', RS.ORise, False);
SunSetEF.Text := StTimeToTimeString('hh:mm', RS.OSet, False);
RS := MoonRiseSet(TheDT.D, ObsLong, ObsLat);
MoonRiseEF.Text := StTimeToTimeString('hh:mm', RS.ORise, False);
MoonSetEF.Text := StTimeToTimeString('hh:mm', RS.OSet, False);
RS := Twilight(TheDT.D, ObsLong, ObsLat, ttAstronomical);
TwiStartEF.Text := StTimeToTimeString('hh:mm', RS.ORise, False);
TwiEndEF.Text := StTimeToTimeString('hh:mm', RS.OSet, False);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
M := StrToInt(MonthEF.Text);
if not (M in [1..12]) then
begin
ShowMessage('Month value out of range (1..12)');
Exit;
end;
D := StrToInt(DateEF.Text);
if not (D in [1..31]) then
begin
ShowMessage('Date value out of range (1..31)');
Exit;
end;
Y := StrToInt(YearEF.Text);
if (Y < 1800) or (Y > 2200) then
begin
ShowMessage('Year value out of range (1800..2200)');
Exit;
end;
TheDT.D := DMYToStDate(D, M, Y, 0);
if TheDT.D = BadDate then
begin
ShowMessage('Invalid date');
Exit;
end;
TheDT.T := CurrentTime;
ObsLong := StrToFloat(LongEF.Text);
if (ObsLong < -180) or (ObsLong > 180) then
begin
ShowMessage('Longitude out of range (-180..180)');
Exit;
end;
ObsLat := StrToFloat(LatEF.Text);
if (ObsLat < -90) or (ObsLat > 90) then
begin
ShowMessage('Latitude out of range (-90..90)');
Exit;
end;
PositionsLB.Clear;
DoFixedCalcs;
DoCalcs(ObsLong, ObsLat);
except
ShowMessage('One or more entry fields has illegal data');
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TheDT.D := CurrentDate;
TheDT.T := CurrentTime;
StDateToDMY(TheDT.D, D, M, Y);
MonthEF.Text := IntToStr(M);
DateEF.Text := IntToStr(D);
YearEF.Text := IntToStr(Y);
LongEF.Text := FloatToStr(-105.27);
LatEF.Text := FloatToStr(38.87);
DoCalcTimes;
Button1Click(Button1);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
DoCalcTimes;
end;
end.

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="eclipse"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="laz_systools"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="eclipse.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="eclipseu.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="EclipseU"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="eclipse"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,46 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
program eclipse;
uses
Interfaces,
Forms, lclversion,
eclipseu in 'eclipseu.pas' {Form1};
{$R *.res}
begin
{$IF LCL_FULLVERSION >= 1080000}
Application.Scaled := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,68 @@
object Form1: TForm1
Left = 325
Height = 283
Top = 192
Width = 430
ActiveControl = Button1
Caption = 'Eclipse Example'
ClientHeight = 283
ClientWidth = 430
Color = clBtnFace
Font.Color = clBlack
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object Memo1: TMemo
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = YearEF
Left = 4
Height = 219
Top = 4
Width = 422
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 4
BorderSpacing.Right = 4
BorderSpacing.Bottom = 4
Font.Color = clBlack
Font.Height = -11
Font.Name = 'Courier New'
ParentFont = False
ScrollBars = ssVertical
TabOrder = 1
end
object Button1: TButton
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 112
Height = 25
Top = 254
Width = 206
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 4
Caption = 'Generate Eclipse Information'
OnClick = Button1Click
TabOrder = 0
end
object YearEF: TSpinEdit
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = Button1
Left = 179
Height = 23
Top = 227
Width = 72
Alignment = taCenter
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 4
MaxValue = 32000
MinValue = -32000
TabOrder = 2
Value = 2017
end
end

View File

@@ -0,0 +1,200 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
unit EclipseU;
interface
uses
{$IFNDEF FPC}
Windows, Messages,
{$ENDIF}
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Spin,
StBase, StDate, StList, StEclpse;
type
{ TForm1 }
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
YearEF: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure WriteLunarData(Eclipse : TStEclipseRecord; SL : TStrings);
procedure WriteSolarData(Eclipse : TStEclipseRecord; SL : TStrings);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
YearEF.Text := '2017';
end;
{-----------------------------------------------------------------------------}
procedure TForm1.Button1Click(Sender: TObject);
var
I : integer;
Data : TStEclipses;
Eclipse : TStEclipseRecord;
begin
Memo1.Clear;
Data := TStEclipses.Create(TStListNode);
try
Data.FindEclipses(StrToInt(YearEF.Text));
for I := 0 to pred(Data.Count) do begin
Eclipse := TStEclipseRecord(Data.Eclipses[I]^);
if (Eclipse.Etype in [etLunarPenumbral, etLunarPartial, etLunarTotal]) then
WriteLunarData(Eclipse, Memo1.Lines)
else
WriteSolarData(Eclipse, Memo1.Lines);
end;
finally
Data.Free;
end;
end;
{-----------------------------------------------------------------------------}
procedure TForm1.WriteLunarData(Eclipse : TStEclipseRecord; SL : TStrings);
var
S : string[255];
begin
case Eclipse.EType of
etLunarPenumbral : SL.Add('Lunar - Penumbra');
etLunarPartial : SL.Add('Lunar - Partial');
etLunarTotal : SL.Add('Lunar - Total');
end;
Str(Eclipse.Magnitude : 5 : 3, S);
SL.Add('Mag: ' + S);
SL.Add('Penumbral Starts: ' + DateTimeToStr(Eclipse.LContacts.UT1));
SL.Add('First Contact: ' + DateTimeToStr(Eclipse.LContacts.FirstContact));
SL.Add('Second Contact: ' + DateTimeToStr(Eclipse.LContacts.SecondContact));
SL.Add('Mid Eclipse ' + DateTimeToStr(Eclipse.LContacts.MidEclipse));
SL.Add('Third Contact: ' + DateTimeToStr(Eclipse.LContacts.ThirdContact));
SL.Add('Fourth Contact: ' + DateTimeToStr(Eclipse.LContacts.FourthContact));
SL.Add('Penumbral Ends: ' + DateTimeToStr(Eclipse.LContacts.UT2));
SL.Add('');
SL.Add('');
SL.Add('');
end;
{-----------------------------------------------------------------------------}
procedure TForm1.WriteSolarData(Eclipse : TStEclipseRecord; SL : TStrings);
var
I : integer;
S,
P : string[255];
LL : TStLongLat;
begin
case Eclipse.EType of
etSolarPartial : begin
SL.Add('Solar - Partial');
Str(Eclipse.Magnitude : 5 : 3, S);
SL.Add('Mag: ' + S);
if Eclipse.Hemisphere = htNorthern then
SL.Add('Hemisphere: Northern')
else
SL.Add('Hemisphere: Southern');
SL.Add('Mid Eclipse: ' +
DateTimeToStr(Eclipse.LContacts.MidEclipse));
end;
etSolarTotal : begin
SL.Add('Solar - Total');
SL.Add('Mag: N/A');
if Eclipse.Hemisphere = htNorthern then
SL.Add('Hemisphere: Northern')
else
SL.Add('Hemisphere: Southern');
SL.Add('Mid Eclipse: ' +
DateTimeToStr(Eclipse.LContacts.MidEclipse));
end;
etSolarAnnularTotal : begin
Str(Eclipse.Magnitude : 5 : 3, S);
SL.Add('Mag: N/A');
if Eclipse.Hemisphere = htNorthern then
SL.Add('Hemisphere: Northern')
else
SL.Add('Hemisphere: Southern');
SL.Add('Mid Eclipse: ' +
DateTimeToStr(Eclipse.LContacts.MidEclipse));
end;
etSolarAnnular : begin
SL.Add('Solar - Annular');
SL.Add('Mag: N/A');
if Eclipse.Hemisphere = htNorthern then
SL.Add('Hemisphere: Northern')
else
SL.Add('Hemisphere: Southern');
SL.Add('Mid Eclipse: ' +
DateTimeToStr(Eclipse.LContacts.MidEclipse));
end;
end;
if Assigned(Eclipse.Path) then begin
for I := 0 to pred(Eclipse.Path.Count) do begin
LL := TStLongLat(Eclipse.Path.Items[I].Data^);
P := ' ' + DateTimeToStr(LL.JD) + ' ';
Str(LL.Longitude : 7 : 2, S);
P := P + S + ' ';
Str(LL.Latitude : 6 : 2, S);
P := P + S + ' ';
Str(LL.Duration : 4 : 2, S);
P := P + S;
SL.Add(P);
end;
end;
SL.Add('');
SL.Add('');
SL.Add('');
end;
end.

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="exjupst"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="laz_systools"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="exjupst.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ExJupSt"/>
</Unit0>
<Unit1>
<Filename Value="exjupstu.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ExJupStU"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="exjupst"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,46 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
program ExJupSt;
uses
Interfaces,
Forms, lclversion,
exjupstu in 'exjupstu.pas' {Form1};
{$R *.res}
begin
{$IF LCL_FULLVERSION >= 1080000}
Application.Scaled := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,82 @@
object Form1: TForm1
Left = 247
Height = 320
Top = 125
Width = 296
Caption = 'Jupiter''s "Gallilean" Moon Data'
ClientHeight = 320
ClientWidth = 296
Color = clBtnFace
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object Label1: TLabel
Left = 42
Height = 13
Top = 258
Width = 23
Caption = 'Date'
ParentColor = False
end
object Label2: TLabel
Left = 171
Height = 13
Top = 258
Width = 15
Caption = 'UT'
ParentColor = False
end
object Button1: TButton
Left = 108
Height = 30
Top = 285
Width = 89
Caption = 'Compute'
Default = True
OnClick = Button1Click
TabOrder = 3
end
object Memo1: TMemo
Left = 5
Height = 240
Top = 7
Width = 290
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Courier New'
Lines.Strings = (
''
)
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
WordWrap = False
end
object edDate: TEdit
Cursor = crIBeam
Left = 71
Height = 21
Hint = 'mm/dd/yyyy'
Top = 255
Width = 66
MaxLength = 10
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object edTime: TEdit
Cursor = crIBeam
Left = 191
Height = 21
Hint = 'hh:mm:ss'
Top = 255
Width = 53
MaxLength = 8
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
end

View File

@@ -0,0 +1,152 @@
(* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is TurboPower SysTools
*
* The Initial Developer of the Original Code is
* TurboPower Software
*
* Portions created by the Initial Developer are Copyright (C) 1996-2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* ***** END LICENSE BLOCK ***** *)
{$IFDEF FPC}
{$mode DELPHI}
{$ENDIF}
unit ExJupStU;
interface
uses
{$IFNDEF FPC}
Windows, Messages,
{$ENDIF}
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
edDate: TEdit;
edTime: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
uses
StDate, StDateSt, StAstro, StJupSat;
procedure TForm1.Button1Click(Sender: TObject);
var
D : TDateTime;
XS,
YS : string[20];
JS : TStJupSats;
begin
Memo1.Clear;
D := StrToDate(edDate.Text);
if edTime.Text > '' then
D := D + StrToTime(edTime.Text);
JS := GetJupSats(D, False, False);
Memo1.Lines.Add('Low Precision');
Memo1.Lines.Add('--------------------------------');
Str(JS.Io.X:6:2, XS);
Str(JS.Io.Y:6:2, YS);
Memo1.Lines.Add('Io ' + XS + ' ' + YS);
Str(JS.Europa.X:6:2, XS);
Str(JS.Europa.Y:6:2, YS);
Memo1.Lines.Add('Europa ' + XS + ' ' + YS);
Str(JS.Ganymede.X:6:2, XS);
Str(JS.Ganymede.Y:6:2, YS);
Memo1.Lines.Add('Ganymede ' + XS + ' ' + YS);
Str(JS.Callisto.X:6:2, XS);
Str(JS.Callisto.Y:6:2, YS);
Memo1.Lines.Add('Callisto ' + XS + ' ' + YS);
Memo1.Lines.Add(' ');
JS := GetJupSats(D, True, False);
Memo1.Lines.Add('High Precision - Non Shadow');
Memo1.Lines.Add('--------------------------------');
Str(JS.Io.X:8:4, XS);
Str(JS.Io.Y:8:4, YS);
Memo1.Lines.Add('Io ' + XS + ' ' + YS);
Str(JS.Europa.X:8:4, XS);
Str(JS.Europa.Y:8:4, YS);
Memo1.Lines.Add('Europa ' + XS + ' ' + YS);
Str(JS.Ganymede.X:8:4, XS);
Str(JS.Ganymede.Y:8:4, YS);
Memo1.Lines.Add('Ganymede ' + XS + ' ' + YS);
Str(JS.Callisto.X:8:4, XS);
Str(JS.Callisto.Y:8:4, YS);
Memo1.Lines.Add('Callisto ' + XS + ' ' + YS);
Memo1.Lines.Add(' ');
JS := GetJupSats(D, True, True);
Memo1.Lines.Add('High Precision - Shadow');
Memo1.Lines.Add('--------------------------------');
Str(JS.Io.X:8:4, XS);
Str(JS.Io.Y:8:4, YS);
Memo1.Lines.Add('Io ' + XS + ' ' + YS);
Str(JS.Europa.X:8:4, XS);
Str(JS.Europa.Y:8:4, YS);
Memo1.Lines.Add('Europa ' + XS + ' ' + YS);
Str(JS.Ganymede.X:8:4, XS);
Str(JS.Ganymede.Y:8:4, YS);
Memo1.Lines.Add('Ganymede ' + XS + ' ' + YS);
Str(JS.Callisto.X:8:4, XS);
Str(JS.Callisto.Y:8:4, YS);
Memo1.Lines.Add('Callisto ' + XS + ' ' + YS);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
edDate.Text := DateToStr(Date);
edTime.Text := '';
end;
end.