Skip to content

Commit

Permalink
Add option to show the celestial equator
Browse files Browse the repository at this point in the history
  • Loading branch information
pchev committed Aug 14, 2019
1 parent 4e6b701 commit 29941d0
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 38 deletions.
55 changes: 55 additions & 0 deletions skychart/cu_skychart.pas
Expand Up @@ -150,6 +150,7 @@ Tskychart = class(TComponent)
function DrawHorizon: boolean;
function DrawEcliptic: boolean;
function DrawGalactic: boolean;
function DrawEquator: boolean;
function DrawPlanisphereDate: boolean;
function DrawPlanisphereTime: boolean;
procedure OptimizeLabels;
Expand Down Expand Up @@ -391,6 +392,7 @@ function Tskychart.Refresh(newtime: boolean): boolean;
DrawConstB;
DrawEcliptic;
DrawGalactic;
DrawEquator;
end;
end;
// the stars
Expand Down Expand Up @@ -427,6 +429,7 @@ function Tskychart.Refresh(newtime: boolean): boolean;
DrawConstB;
DrawEcliptic;
DrawGalactic;
DrawEquator;
end;
end;
// Finder mark
Expand Down Expand Up @@ -6662,6 +6665,58 @@ function Tskychart.DrawGalactic: boolean;
Result := True;
end;

function Tskychart.DrawEquator: boolean;
var
l, b, ar, de, xx, yy: double;
i, color, mult: integer;
x1, y1, x2, y2: single;
First: boolean;
begin
Result := False;
if not cfgsc.ShowEquator then
exit;
if VerboseMsg then
WriteTrace('SkyChart ' + cfgsc.chartname + ': draw equator line');
b := 0;
First := True;
color := Fplot.cfgplot.Color[15];
x1 := 0;
y1 := 0;
if (cfgsc.fov * rad2deg) > 180 then
mult := 5
else if (cfgsc.fov * rad2deg) > 90 then
mult := 5
else if (cfgsc.fov * rad2deg) > 30 then
mult := 5
else if (cfgsc.fov * rad2deg) > 10 then
mult := 3
else if (cfgsc.fov * rad2deg) > 5 then
mult := 2
else
mult := 1;
for i := 0 to (360 div mult) do
begin
ar := deg2rad * i * mult;
de := 0;
if cfgsc.ApparentPos then
apparent_equatorial(ar, de, cfgsc, False, False);
projection(ar, de, xx, yy, True, cfgsc);
WindowXY(xx, yy, x2, y2, cfgsc);
if First then
begin
First := False;
end
else
begin
if ((intpower(x2 - x1, 2) + intpower(y2 - y1, 2)) < cfgsc.x2) then
FPlot.PlotLine(x1, y1, x2, y2, color, cfgsc.LineWidthEqGrid, cfgsc.StyleEqGrid);
end;
x1 := x2;
y1 := y2;
end;
Result := True;
end;

{ TODO : Check FPC bug on ARM }
{$IFDEF CPUARM}
{$OPTIMIZATION NOREGVAR}
Expand Down
83 changes: 46 additions & 37 deletions skychart/fu_config_display.lfm
Expand Up @@ -25,11 +25,11 @@ object f_config_display: Tf_config_display
Height = 526
Top = 1
Width = 503
ActivePage = Page2
ActivePage = Page5
Align = alClient
ParentFont = False
ShowTabs = False
TabIndex = 1
TabIndex = 4
TabOrder = 0
OnChanging = PageControl1Changing
object Page1: TTabSheet
Expand Down Expand Up @@ -1769,18 +1769,18 @@ object f_config_display: Tf_config_display
end
object GroupBox1: TGroupBox
Left = 8
Height = 140
Top = 192
Height = 125
Top = 208
Width = 273
Caption = 'Constellation Figures'
ClientHeight = 120
ClientHeight = 105
ClientWidth = 271
ParentFont = False
TabOrder = 11
object Label132: TLabel
Left = 29
Height = 19
Top = 75
Top = 60
Width = 192
Caption = 'Constellation Figure File Name : '
ParentColor = False
Expand All @@ -1789,7 +1789,7 @@ object f_config_display: Tf_config_display
object Constl: TCheckBox
Left = 8
Height = 21
Top = 11
Top = 6
Width = 180
Caption = 'Show Constellation Figure'
OnClick = ConstlClick
Expand All @@ -1799,7 +1799,7 @@ object f_config_display: Tf_config_display
object ConstlFile: TFileNameEdit
Left = 29
Height = 26
Top = 90
Top = 78
Width = 208
OnAcceptFileName = ConstlFileAcceptFileName
DialogOptions = []
Expand All @@ -1817,7 +1817,7 @@ object f_config_display: Tf_config_display
object CFStyle: TComboBox
Left = 29
Height = 26
Top = 32
Top = 30
Width = 120
AutoSize = False
Constraints.MaxHeight = 28
Expand All @@ -1842,7 +1842,7 @@ object f_config_display: Tf_config_display
Tag = 3
Left = 165
Height = 28
Top = 32
Top = 30
Width = 50
Constraints.MaxHeight = 28
MaxValue = 10
Expand All @@ -1854,18 +1854,18 @@ object f_config_display: Tf_config_display
end
object GroupBox3: TGroupBox
Left = 8
Height = 148
Top = 336
Height = 130
Top = 345
Width = 273
Caption = 'Constellation Boundaries'
ClientHeight = 128
ClientHeight = 110
ClientWidth = 271
ParentFont = False
TabOrder = 13
object Label72: TLabel
Left = 29
Height = 19
Top = 75
Top = 60
Width = 214
Caption = 'Constellation Boundary File Name : '
ParentColor = False
Expand All @@ -1874,7 +1874,7 @@ object f_config_display: Tf_config_display
object Constb: TCheckBox
Left = 8
Height = 21
Top = 11
Top = 6
Width = 202
Caption = 'Show Constellation Boundary'
OnClick = ConstbClick
Expand All @@ -1884,7 +1884,7 @@ object f_config_display: Tf_config_display
object ConstbFile: TFileNameEdit
Left = 29
Height = 26
Top = 90
Top = 78
Width = 208
OnAcceptFileName = ConstbFileAcceptFileName
DialogOptions = []
Expand All @@ -1902,7 +1902,7 @@ object f_config_display: Tf_config_display
object CBStyle: TComboBox
Left = 29
Height = 28
Top = 32
Top = 30
Width = 120
AutoSize = False
ItemHeight = 16
Expand All @@ -1926,7 +1926,7 @@ object f_config_display: Tf_config_display
Tag = 4
Left = 165
Height = 28
Top = 32
Top = 30
Width = 50
Constraints.MaxHeight = 28
MaxValue = 10
Expand All @@ -1938,18 +1938,18 @@ object f_config_display: Tf_config_display
end
object GroupBox4: TGroupBox
Left = 293
Height = 140
Top = 192
Height = 125
Top = 208
Width = 185
Caption = 'Milky Way'
ClientHeight = 120
ClientHeight = 105
ClientWidth = 183
ParentFont = False
TabOrder = 12
object milkyway: TCheckBox
Left = 8
Height = 21
Top = 8
Top = 6
Width = 121
Caption = 'Show Milky Way'
OnClick = milkywayClick
Expand All @@ -1969,7 +1969,7 @@ object f_config_display: Tf_config_display
object linemodemilkyway: TCheckBox
Left = 8
Height = 21
Top = 40
Top = 38
Width = 136
Caption = 'linemodemilkyway'
OnClick = linemodemilkywayClick
Expand Down Expand Up @@ -2075,18 +2075,18 @@ object f_config_display: Tf_config_display
end
object GroupBox8: TGroupBox
Left = 293
Height = 148
Top = 336
Height = 130
Top = 345
Width = 185
Caption = 'Proper Motion'
ClientHeight = 128
ClientHeight = 110
ClientWidth = 183
ParentFont = False
TabOrder = 14
object Label68: TLabel
Left = 91
Left = 99
Height = 19
Top = 95
Top = 82
Width = 32
Caption = 'years'
ParentColor = False
Expand All @@ -2095,7 +2095,7 @@ object f_config_display: Tf_config_display
object Label8: TLabel
Left = 36
Height = 63
Top = 15
Top = 8
Width = 142
AutoSize = False
Caption = 'Draw a line that represent the proper motion for the next '
Expand All @@ -2106,17 +2106,17 @@ object f_config_display: Tf_config_display
object DrawPmBox: TCheckBox
Left = 8
Height = 21
Top = 11
Top = 6
Width = 21
OnClick = DrawPmBoxClick
ParentFont = False
TabOrder = 0
end
object DrawPMy: TLongEdit
Left = 22
Left = 30
Height = 26
Hint = '-99999..99999'
Top = 90
Top = 78
Width = 56
Constraints.MaxHeight = 26
ParentFont = False
Expand All @@ -2130,9 +2130,9 @@ object f_config_display: Tf_config_display
end
end
object OnlyMeridian: TCheckBox
Left = 277
Left = 16
Height = 21
Top = 160
Top = 184
Width = 194
Caption = 'Show only meridian in Alt/Az'
OnClick = OnlyMeridianClick
Expand Down Expand Up @@ -2225,6 +2225,15 @@ object f_config_display: Tf_config_display
TabOrder = 19
Value = 1
end
object ShowEquator: TCheckBox
Left = 277
Height = 21
Top = 155
Width = 160
Caption = 'Show Celestial Equator'
OnClick = ShowEquatorClick
TabOrder = 20
end
end
object Page6: TTabSheet
Caption = 'Labels'
Expand All @@ -2236,7 +2245,7 @@ object f_config_display: Tf_config_display
Height = 302
Top = 66
Width = 477
ClientHeight = 300
ClientHeight = 282
ClientWidth = 475
ParentFont = False
TabOrder = 4
Expand Down Expand Up @@ -2791,8 +2800,8 @@ object f_config_display: Tf_config_display
Top = 0
Width = 70
BevelOuter = bvNone
ClientHeight = 296
ClientWidth = 70
ClientHeight = 292
ClientWidth = 66
ParentFont = False
TabOrder = 36
object Label260: TLabel
Expand Down
9 changes: 9 additions & 0 deletions skychart/fu_config_display.pas
Expand Up @@ -47,6 +47,7 @@ Tf_config_display = class(TFrame)
Button8: TButton;
Button9: TButton;
CheckBox1: TCheckBox;
ShowEquator: TCheckBox;
DistLabel: TCheckBox;
CheckBox2: TCheckBox;
antialias: TCheckBox;
Expand Down Expand Up @@ -453,6 +454,7 @@ Tf_config_display = class(TFrame)
Shift: TShiftState; X, Y: integer);
procedure RectangleGridSelectCell(Sender: TObject; aCol, aRow: integer;
var CanSelect: boolean);
procedure ShowEquatorClick(Sender: TObject);
procedure ShowLinesClick(Sender: TObject);
procedure ShowLineShapeMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
Expand Down Expand Up @@ -675,6 +677,7 @@ procedure Tf_config_display.SetLang;
Label10.Caption := rsEditDSOLines;
ecliptic.Caption := rsShowEcliptic;
galactic.Caption := rsShowGalactic;
ShowEquator.Caption := rsShowCelestia;
GridNum.Caption := rsShowGridLabe;
GroupBox1.Caption := rsConstellatio2;
Label132.Caption := rsConstellatio3;
Expand Down Expand Up @@ -1515,6 +1518,7 @@ procedure Tf_config_display.ShowLine;
ShowLineShape.Brush.Color := clWhite;
Ecliptic.Checked := csc.ShowEcliptic;
Galactic.Checked := csc.ShowGalactic;
ShowEquator.Checked := csc.ShowEquator;
ConstlFile.Text := cmain.ConstLfile;
ConstlFile.InitialDir := ExtractFilePath(cmain.ConstLfile);
ConstbFile.Text := cmain.ConstBfile;
Expand Down Expand Up @@ -2077,6 +2081,11 @@ procedure Tf_config_display.galacticClick(Sender: TObject);
csc.Showgalactic := galactic.Checked;
end;

procedure Tf_config_display.ShowEquatorClick(Sender: TObject);
begin
csc.ShowEquator := ShowEquator.Checked;
end;

procedure Tf_config_display.ConstlClick(Sender: TObject);
begin
csc.ShowConstl := ConstL.Checked;
Expand Down

0 comments on commit 29941d0

Please sign in to comment.