Aem.java

  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. import java.util.ArrayList;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;

  22. import org.orekit.data.DataContext;
  23. import org.orekit.files.ccsds.ndm.NdmConstituent;
  24. import org.orekit.files.ccsds.ndm.adm.AdmHeader;
  25. import org.orekit.files.general.AttitudeEphemerisFile;
  26. import org.orekit.utils.IERSConventions;
  27. import org.orekit.utils.TimeStampedAngularCoordinates;

  28. /**
  29.  * This class stores all the information of the Attitude Ephemeris Message (AEM) File parsed
  30.  * by AEMParser. It contains the header and a list of Attitude Ephemerides Blocks each
  31.  * containing metadata and a list of attitude ephemerides data lines.
  32.  * @author Bryan Cazabonne
  33.  * @since 10.2
  34.  */
  35. public class Aem extends NdmConstituent<AdmHeader, AemSegment>
  36.     implements AttitudeEphemerisFile<TimeStampedAngularCoordinates, AemSegment> {

  37.     /** Root element for XML files. */
  38.     public static final String ROOT = "aem";

  39.     /** Key for format version. */
  40.     public static final String FORMAT_VERSION_KEY = "CCSDS_AEM_VERS";

  41.     /** Simple constructor.
  42.      * @param header file header
  43.      * @param segments file segments
  44.      * @param conventions IERS conventions
  45.      * @param dataContext used for creating frames, time scales, etc.
  46.      */
  47.     public Aem(final AdmHeader header, final List<AemSegment> segments,
  48.                final IERSConventions conventions, final DataContext dataContext) {
  49.         super(header, segments, conventions, dataContext);
  50.     }

  51.     /** {@inheritDoc} */
  52.     @Override
  53.     public Map<String, AemSatelliteEphemeris> getSatellites() {
  54.         final Map<String, List<AemSegment>> byId = new HashMap<>();
  55.         for (final AemSegment segment : getSegments()) {
  56.             final String id = segment.getMetadata().getObjectID();
  57.             byId.putIfAbsent(id, new ArrayList<>());
  58.             byId.get(id).add(segment);
  59.         }
  60.         final Map<String, AemSatelliteEphemeris> ret = new HashMap<>();
  61.         for (final Map.Entry<String, List<AemSegment>> entry : byId.entrySet()) {
  62.             ret.put(entry.getKey(), new AemSatelliteEphemeris(entry.getKey(), entry.getValue()));
  63.         }
  64.         return ret;
  65.     }

  66. }