1   /* Copyright 2002-2026 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.List;
20  
21  import org.orekit.attitudes.BoundedAttitudeProvider;
22  import org.orekit.attitudes.TabulatedProvider;
23  import org.orekit.files.ccsds.section.Segment;
24  import org.orekit.files.general.AttitudeEphemerisFile;
25  import org.orekit.frames.Frame;
26  import org.orekit.time.AbsoluteDate;
27  import org.orekit.utils.AngularDerivativesFilter;
28  import org.orekit.utils.TimeStampedAngularCoordinates;
29  
30  /**
31   * This class stores the metadata and data for one attitude segment.
32   * @author Luc Maisonobe
33   * @since 11.0
34   */
35  public class AemSegment extends Segment<AemMetadata, AemData>
36      implements AttitudeEphemerisFile.AttitudeEphemerisSegment<TimeStampedAngularCoordinates> {
37  
38      /** Simple constructor.
39       * @param metadata segment metadata
40       * @param data segment data
41       */
42      public AemSegment(final AemMetadata metadata, final AemData data) {
43          super(metadata, data);
44      }
45  
46      /** {@inheritDoc} */
47      @Override
48      public List<TimeStampedAngularCoordinates> getAngularCoordinates() {
49          return getData().getAngularCoordinates();
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      public Frame getReferenceFrame() {
55          return getMetadata().getEndpoints().getExternal();
56      }
57  
58      /** {@inheritDoc} */
59      @Override
60      public AbsoluteDate getStart() {
61          return getMetadata().getStart();
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      public AbsoluteDate getStop() {
67          return getMetadata().getStop();
68      }
69  
70      /** {@inheritDoc} */
71      @Override
72      public String getInterpolationMethod() {
73          return getMetadata().getInterpolationMethod();
74      }
75  
76      /** {@inheritDoc} */
77      @Override
78      public int getInterpolationSamples() {
79          return getMetadata().getInterpolationSamples();
80      }
81  
82      /** {@inheritDoc} */
83      @Override
84      public AngularDerivativesFilter getAvailableDerivatives() {
85          return getMetadata().getAttitudeType().getAngularDerivativesFilter();
86      }
87  
88      /** {@inheritDoc} */
89      @Override
90      public BoundedAttitudeProvider getAttitudeProvider() {
91          return new TabulatedProvider(getAngularCoordinates(), getInterpolationSamples(),
92                                       getAvailableDerivatives(), getStart(), getStop(),
93                                       getMetadata().getEndpoints());
94      }
95  
96  }