Apm.java

  1. /* Copyright 2002-2024 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.apm;

  18. import java.util.List;

  19. import org.orekit.attitudes.Attitude;
  20. import org.orekit.data.DataContext;
  21. import org.orekit.files.ccsds.ndm.NdmConstituent;
  22. import org.orekit.files.ccsds.ndm.adm.AdmMetadata;
  23. import org.orekit.files.ccsds.ndm.adm.AdmHeader;
  24. import org.orekit.files.ccsds.section.Segment;
  25. import org.orekit.frames.Frame;
  26. import org.orekit.utils.IERSConventions;
  27. import org.orekit.utils.PVCoordinatesProvider;

  28. /**
  29.  * This class stores all the information of the Attitude Parameter Message (APM) File parsed
  30.  * by APMParser. It contains the header and the metadata and a the data lines.
  31.  * @author Bryan Cazabonne
  32.  * @since 10.2
  33.  */
  34. public class Apm extends NdmConstituent<AdmHeader, Segment<AdmMetadata, ApmData>> {

  35.     /** Root element for XML files. */
  36.     public static final String ROOT = "apm";

  37.     /** Key for format version. */
  38.     public static final String FORMAT_VERSION_KEY = "CCSDS_APM_VERS";

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

  49.     /** Get the file metadata.
  50.      * @return file metadata
  51.      */
  52.     public AdmMetadata getMetadata() {
  53.         return getSegments().get(0).getMetadata();
  54.     }

  55.     /** Get the file data.
  56.      * @return file data
  57.      */
  58.     public ApmData getData() {
  59.         return getSegments().get(0).getData();
  60.     }

  61.     /** Get the attitude.
  62.      * @param frame reference frame with respect to which attitude must be defined,
  63.      * (may be null if attitude is <em>not</em> orbit-relative and one wants
  64.      * attitude in the same frame as used in the attitude message)
  65.      * @param pvProvider provider for spacecraft position and velocity
  66.      * (may be null if attitude is <em>not</em> orbit-relative)
  67.      * @return attitude
  68.      */
  69.     public Attitude getAttitude(final Frame frame, final PVCoordinatesProvider pvProvider) {
  70.         return getData().getAttitude(frame, pvProvider);
  71.     }

  72. }