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.apm;
18
19 import java.util.List;
20
21 import org.orekit.attitudes.Attitude;
22 import org.orekit.data.DataContext;
23 import org.orekit.files.ccsds.ndm.NdmConstituent;
24 import org.orekit.files.ccsds.ndm.adm.AdmMetadata;
25 import org.orekit.files.ccsds.ndm.adm.AdmHeader;
26 import org.orekit.files.ccsds.section.Segment;
27 import org.orekit.frames.Frame;
28 import org.orekit.utils.IERSConventions;
29 import org.orekit.utils.PVCoordinatesProvider;
30
31 /**
32 * This class stores all the information of the Attitude Parameter Message (APM) File parsed
33 * by APMParser. It contains the header and the metadata and a the data lines.
34 * @author Bryan Cazabonne
35 * @since 10.2
36 */
37 public class Apm extends NdmConstituent<AdmHeader, Segment<AdmMetadata, ApmData>> {
38
39 /** Root element for XML files. */
40 public static final String ROOT = "apm";
41
42 /** Key for format version. */
43 public static final String FORMAT_VERSION_KEY = "CCSDS_APM_VERS";
44
45 /** Simple constructor.
46 * @param header file header
47 * @param segments file segments
48 * @param conventions IERS conventions
49 * @param dataContext used for creating frames, time scales, etc.
50 */
51 public Apm(final AdmHeader header, final List<Segment<AdmMetadata, ApmData>> segments,
52 final IERSConventions conventions, final DataContext dataContext) {
53 super(header, segments, conventions, dataContext);
54 }
55
56 /** Get the file metadata.
57 * @return file metadata
58 */
59 public AdmMetadata getMetadata() {
60 return getSegments().get(0).getMetadata();
61 }
62
63 /** Get the file data.
64 * @return file data
65 */
66 public ApmData getData() {
67 return getSegments().get(0).getData();
68 }
69
70 /** Get the attitude.
71 * @param frame reference frame with respect to which attitude must be defined,
72 * (may be null if attitude is <em>not</em> orbit-relative and one wants
73 * attitude in the same frame as used in the attitude message)
74 * @param pvProvider provider for spacecraft position and velocity
75 * (may be null if attitude is <em>not</em> orbit-relative)
76 * @return attitude
77 */
78 public Attitude getAttitude(final Frame frame, final PVCoordinatesProvider pvProvider) {
79 return getData().getAttitude(frame, pvProvider);
80 }
81
82 }