1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.orekit.gnss;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.orekit.errors.OrekitIllegalArgumentException;
23 import org.orekit.errors.OrekitMessages;
24 import org.orekit.time.TimeScale;
25 import org.orekit.time.TimeScales;
26
27
28
29
30
31
32
33 public enum SatelliteSystem {
34
35
36 GPS('G'),
37
38
39 GLONASS('R'),
40
41
42 GALILEO('E'),
43
44
45 BEIDOU('C'),
46
47
48 QZSS('J'),
49
50
51 IRNSS('I'),
52
53
54 SBAS('S'),
55
56
57 MIXED('M');
58
59
60 private static final Map<Character, SatelliteSystem> KEYS_MAP = new HashMap<>();
61 static {
62 for (final SatelliteSystem satelliteSystem : values()) {
63 KEYS_MAP.put(satelliteSystem.getKey(), satelliteSystem);
64 }
65 }
66
67
68 private final char key;
69
70
71
72
73 SatelliteSystem(final char key) {
74 this.key = key;
75 }
76
77
78
79
80 public char getKey() {
81 return key;
82 }
83
84
85
86
87
88
89
90
91
92 public static SatelliteSystem parseSatelliteSystem(final String s)
93 throws OrekitIllegalArgumentException {
94 final SatelliteSystem satelliteSystem = KEYS_MAP.get(s.charAt(0));
95 if (satelliteSystem == null) {
96 throw new OrekitIllegalArgumentException(OrekitMessages.UNKNOWN_SATELLITE_SYSTEM, s.charAt(0));
97 }
98 return satelliteSystem;
99 }
100
101
102
103
104
105
106 public TimeScale getDefaultTimeSystem(final TimeScales timeScales) {
107
108 TimeScale timeScale = null;
109 switch (this) {
110 case GPS:
111 timeScale = timeScales.getGPS();
112 break;
113
114 case GALILEO:
115 timeScale = timeScales.getGST();
116 break;
117
118 case GLONASS:
119 timeScale = timeScales.getGLONASS();
120 break;
121
122 case QZSS:
123 timeScale = timeScales.getQZSS();
124 break;
125
126 case BEIDOU:
127 timeScale = timeScales.getBDT();
128 break;
129
130 case IRNSS:
131 timeScale = timeScales.getIRNSS();
132 break;
133
134
135 default:
136 timeScale = null;
137 break;
138 }
139
140 return timeScale;
141 }
142
143 }