1 /* Copyright 2002-2025 CS GROUP
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.files.ccsds.ndm.adm.aem;
18
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.orekit.data.DataContext;
25 import org.orekit.files.ccsds.ndm.NdmConstituent;
26 import org.orekit.files.ccsds.ndm.adm.AdmHeader;
27 import org.orekit.files.general.AttitudeEphemerisFile;
28 import org.orekit.utils.IERSConventions;
29 import org.orekit.utils.TimeStampedAngularCoordinates;
30
31 /**
32 * This class stores all the information of the Attitude Ephemeris Message (AEM) File parsed
33 * by AEMParser. It contains the header and a list of Attitude Ephemerides Blocks each
34 * containing metadata and a list of attitude ephemerides data lines.
35 * @author Bryan Cazabonne
36 * @since 10.2
37 */
38 public class Aem extends NdmConstituent<AdmHeader, AemSegment>
39 implements AttitudeEphemerisFile<TimeStampedAngularCoordinates, AemSegment> {
40
41 /** Root element for XML files. */
42 public static final String ROOT = "aem";
43
44 /** Key for format version. */
45 public static final String FORMAT_VERSION_KEY = "CCSDS_AEM_VERS";
46
47 /** Simple constructor.
48 * @param header file header
49 * @param segments file segments
50 * @param conventions IERS conventions
51 * @param dataContext used for creating frames, time scales, etc.
52 */
53 public Aem(final AdmHeader header, final List<AemSegment> segments,
54 final IERSConventions conventions, final DataContext dataContext) {
55 super(header, segments, conventions, dataContext);
56 }
57
58 /** {@inheritDoc} */
59 @Override
60 public Map<String, AemSatelliteEphemeris> getSatellites() {
61 final Map<String, List<AemSegment>> byId = new HashMap<>();
62 for (final AemSegment segment : getSegments()) {
63 final String id = segment.getMetadata().getObjectID();
64 byId.putIfAbsent(id, new ArrayList<>());
65 byId.get(id).add(segment);
66 }
67 final Map<String, AemSatelliteEphemeris> ret = new HashMap<>();
68 for (final Map.Entry<String, List<AemSegment>> entry : byId.entrySet()) {
69 ret.put(entry.getKey(), new AemSatelliteEphemeris(entry.getKey(), entry.getValue()));
70 }
71 return ret;
72 }
73
74 }