-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathTLE_Satellite_Orbit_Visualizer.java
129 lines (110 loc) · 4.9 KB
/
TLE_Satellite_Orbit_Visualizer.java
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Cylinder;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
public class SatelliteOrbits extends Application {
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/M/d H:mm:ss");
private List<Cylinder> satellites = new ArrayList<>();
private static final String[] satelliteNames = {
"ISS (ZARYA)", "Hubble Space Telescope", "GPS IIR-10 (M)", "Terra", "Aqua"
};
private static final String[][] tleData = {
{
"ISS (ZARYA)",
"1 25544U 98067A 21186.47390511 .00000500 00000-0 13696-4 0 9994",
"2 25544 51.6431 283.7920 0009298 204.6780 155.3723 15.49061430341806"
},
{
"Hubble Space Telescope",
"1 20580U 90037B 21187.51485065 .00000700 00000-0 26089-4 0 9992",
"2 20580 28.4693 132.2321 0001726 352.6060 7.4753 15.09123027248244"
},
{
"GPS IIR-10 (M)",
"1 30793U 07015M 21186.29253259 -.00000037 00000-0 00000-0 0 9999",
"2 30793 56.1985 60.4463 0064704 249.4686 109.0947 2.00567978134673"
},
{
"Terra",
"1 25994U 99068A 21187.36675641 .00000052 00000-0 12124-4 0 9992",
"2 25994 98.2025 202.0731 0001307 86.8101 273.3496 14.57198865489823"
},
{
"Aqua",
"1 27424U 02022A 21187.42292448 .00000100 00000-0 98692-4 0 9999",
"2 27424 98.2027 189.4386 0001339 88.5354 271.6320 14.57198322495156"
}
};
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
Group root = new Group();
Scene scene = new Scene(root, 800, 600, Color.BLACK);
// Initialize the Earth
Cylinder earth = new Cylinder(1, 0.02);
earth.setTranslateY(0.02);
// Add the Earth to the scene
root.getChildren().add(earth);
// Add satellites and their orbits to the scene
for (int i = 0; i < satelliteNames.length; i++) {
String name = satelliteNames[i];
String line1 = tleData[i][1];
String line2 = tleData[i][2];
List<Point3D> satPositions = new ArrayList<>();
for (int j = 0; j < 360; j += 5) {
LocalDateTime dateTime = LocalDateTime.of(2023, 7, 11, j, 0, 0);
Point3D position = computeSatellitePosition(name, line1, line2, dateTime);
satPositions.add(position);
}
// Create satellite orbit path
List<Cylinder> orbitPath = createOrbitPath(satPositions);
root.getChildren().addAll(orbitPath);
// Create satellite label
Text label = createSatelliteLabel(name, satPositions.get(satPositions.size() - 1));
root.getChildren().add(label);
satellites.add(orbitPath.get(0));
}
primaryStage.setTitle("Satellite Orbits");
primaryStage.setScene(scene);
primaryStage.show();
// Animate the satellites
AnimationTimer timer = new AnimationTimer() {
@Override
public void handle(long now) {
for (Cylinder satellite : satellites) {
satellite.getTransforms().add(satellite.getTransforms().remove(0));
}
}
};
timer.start();
}
private Point3D computeSatellitePosition(String name, String line1, String line2, LocalDateTime dateTime) {
// TODO: Implement satellite position computation using the TLE data and the provided date and time.
// You can use a suitable library or algorithm to perform the computations.
// Return the computed satellite position as a JavaFX Point3D object.
return null;
}
private List<Cylinder> createOrbitPath(List<Point3D> positions) {
// TODO: Create a list of cylinders representing the orbit path using the given positions.
// Set appropriate dimensions, color, and transformations for each cylinder.
// Return the list of cylinders.
return null;
}
private Text createSatelliteLabel(String name, Point3D position) {
// TODO: Create a JavaFX Text object representing the satellite label.
// Set the position, font, color, and other properties for the text.
// Return the created Text object.
return null;
}
}