-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinitializeSkyMap.m
115 lines (85 loc) · 2.87 KB
/
initializeSkyMap.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
% --- Initialization of 2D View / Executes on load
%
function initializeSkyMap(visible)
import org.orekit.time.*;
% locate ISSTracker
hObject = findall(0,'Tag','ISSTracker');
handles = guidata(hObject);
% read catalog
fid=fopen(fullfile('data', simulation_parameters.skyMapCatalog));
M=textscan(fid, simulation_parameters.catalogRegEx, 'headerlines', 1);
% parse and keep stars over min magnitude
ct = getCurrentTime(TimeScalesFactory.getUTC);
c = ct.getComponents(TimeScalesFactory.getUTC).getDate.getYear;
YYYY = c(1);
sao=M{1};
mvis=M{2};
RA=(M{3}+(M{5}*(YYYY-2000)))/15;
DEC=(M{4}+(M{6}*(YYYY-2000)));
minMag = simulation_parameters.minMag;
inf4idxs = mvis < minMag;
sao = sao(inf4idxs);
mvis = mvis(inf4idxs);
RA = RA(inf4idxs);
DEC = DEC(inf4idxs);
starData{1} = sao;
starData{2} = RA;
starData{3} = DEC;
set(handles.skyMap, 'UserData', starData);
% select axes
axes(handles.skyMap);
% start drawing
hold on
blueGray = [103 219 244]/255;
darkBlueGray = [5 56 67]/255;
rectangle('Position', [-90 -90 180 180], 'Curvature', [1 1], ...
'EdgeColor', darkBlueGray, 'FaceColor', 'k');
handles.skyLines(1) = plot([0 0 0],[-90 90 -90],'Color',darkBlueGray,'linewidth',1);
handles.skyLines(2) = plot([-90 90 -90],[0 0 0],'Color',darkBlueGray,'linewidth',1);
rs = linspace(30, 70, 3);
angs = linspace(0, 2*pi, 100);
ca = cos(angs);
sa = sin(angs);
for i = 1:length(rs)
r = rs(i);
xs = r * ca;
ys = r * sa;
plot(xs, ys,'Color',darkBlueGray)
end
angs = [30 60 120 150 210 240 300 330];
rmi = min(rs);
rma = 90;
for i = 1:length(angs)
ca = cos(angs(i) * pi / 180);
sa = sin(angs(i) * pi / 180);
xs = [rmi * ca, rma * ca];
ys = [rmi * sa, rma * sa];
plot(xs, ys,'Color',darkBlueGray);
end
handles.star = zeros(length(sao), 1);
for i=1:length(sao)
handles.star(i) = scatter(0,0,((minMag-mvis(i))*2),'*','filled','MarkerEdgeColor','white', 'MarkerFaceColor', 'white');
end
% iss trajectory
handles.ISSTrail1 = plot(0, 0, 'Color', blueGray,...
'LineWidth', 1.5, 'Visible', 'off');
handles.ISSTrail2 = plot(0, 0, 'Color', blueGray,...
'LineWidth', 1.5, 'Visible', 'off');
handles.ISSTrail3 = plot(0, 0, 'Color', blueGray,...
'LineWidth', 1.5, 'Visible', 'off');
handles.ISSTrail4 = plot(0, 0, 'Color', blueGray,...
'LineWidth', 1.5, 'Visible', 'off');
handles.ISSTrail5 = plot(0, 0, 'Color', blueGray,...
'LineWidth', 1.5, 'Visible', 'off');
handles.ISSSky = plot(0, 0, 'Color', blueGray, 'Marker', '^', ...
'LineWidth', 1, 'Visible', 'off');
axis equal tight;
axis off;
axis([-90 90 -90 90])
% make a list of all elements belonging to this plot
handles.skyMapChildren = [allchild(handles.skyMap); handles.star];
% upload new handles
guidata(hObject, handles);
% initial position of stars
updateSkyMapStars(TimeScalesFactory.getUTC);
end