1   /* Contributed in the public domain.
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.general;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.orekit.attitudes.AggregateBoundedAttitudeProvider;
24  import org.orekit.attitudes.BoundedAttitudeProvider;
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   * An interface for accessing the data stored in an attitude ephemeris file.
32   *
33   * <p> An {@link AttitudeEphemerisFile} consists of one or more satellites each with a unique ID
34   * within the file. The ephemeris for each satellite consists of one or more segments.
35   *
36   * <p> Some attitude ephemeris file formats may supply additional information that is not available
37   * via this interface. In those cases it is recommended that the parser return a subclass
38   * of this interface to provide access to the additional information.
39   *
40   * @param <C> type of the angular coordinates
41   * @param <S> type of the segment
42   * @author Raphaël Fermé
43   * @see SatelliteAttitudeEphemeris
44   * @see AttitudeEphemerisSegment
45   * @since 10.3
46   */
47  public interface AttitudeEphemerisFile<C extends TimeStampedAngularCoordinates,
48                                         S extends AttitudeEphemerisFile.AttitudeEphemerisSegment<C>> {
49  
50      /**
51       * Get the loaded ephemeris for each satellite in the file.
52       *
53       * @return a map from the satellite's ID to the information about that satellite
54       * contained in the file.
55       */
56      Map<String, ? extends SatelliteAttitudeEphemeris<C, S>> getSatellites();
57  
58      /**
59       * Contains the information about a single satellite from an {@link AttitudeEphemerisFile}.
60       *
61       * <p> A satellite ephemeris consists of one or more {@link AttitudeEphemerisSegment}.
62       * Segments are typically used to split up an ephemeris at discontinuous events.
63       * @param <C> type of the angular coordinates
64       * @param <S> type of the segment
65       * @author Raphaël Fermé
66       * @see AttitudeEphemerisFile
67       * @see AttitudeEphemerisSegment
68       * @since 10.3
69       */
70      interface SatelliteAttitudeEphemeris<C extends TimeStampedAngularCoordinates,
71                                           S extends AttitudeEphemerisSegment<C>> {
72  
73          /**
74           * Get the satellite ID. The satellite ID is unique only within the same ephemeris
75           * file.
76           *
77           * @return the satellite's ID, never {@code null}.
78           */
79          String getId();
80  
81          /**
82           * Get the segments of the attitude ephemeris.
83           *
84           * <p> Attitude ephemeris segments are typically used to split an ephemeris around
85           * discontinuous events.
86           *
87           * @return the segments contained in the attitude ephemeris file for this satellite.
88           */
89          List<S> getSegments();
90  
91          /**
92           * Get the start date of the ephemeris.
93           *
94           * @return ephemeris start date.
95           */
96          AbsoluteDate getStart();
97  
98          /**
99           * Get the end date of the ephemeris.
100          *
101          * @return ephemeris end date.
102          */
103         AbsoluteDate getStop();
104 
105         /**
106          * Get the attitude provider corresponding to this ephemeris, combining data from all {@link
107          * #getSegments() segments}.
108          *
109          * @return an attitude provider for all the data in this attitude ephemeris file.
110          */
111         default BoundedAttitudeProvider getAttitudeProvider() {
112             final List<BoundedAttitudeProvider> providers = new ArrayList<>();
113             for (final AttitudeEphemerisSegment<C> attitudeSegment : this.getSegments()) {
114                 providers.add(attitudeSegment.getAttitudeProvider());
115             }
116             return new AggregateBoundedAttitudeProvider(providers);
117         }
118 
119     }
120 
121     /**
122      * A segment of an attitude ephemeris for a satellite.
123      *
124      * <p> Segments are typically used to split an ephemeris around discontinuous events
125      * such as maneuvers.
126      * @param <C> type of the angular coordinates
127      * @author Raphaël Fermé
128      * @see AttitudeEphemerisFile
129      * @see SatelliteAttitudeEphemeris
130      * @since 10.3
131      */
132     interface AttitudeEphemerisSegment<C extends TimeStampedAngularCoordinates> {
133 
134         /**
135          * Get an unmodifiable list of attitude data lines.
136          *
137          * @return a list of attitude data
138          */
139         List<C> getAngularCoordinates();
140 
141         /**
142          * Get the reference frame from which attitude is defined.
143          *
144          * @return the reference frame from which attitude is defined
145          */
146         Frame getReferenceFrame();
147 
148         /**
149          * Get the start date of this ephemeris segment.
150          *
151          * @return ephemeris segment start date.
152          */
153         AbsoluteDate getStart();
154 
155         /**
156          * Get the end date of this ephemeris segment.
157          *
158          * @return ephemeris segment end date.
159          */
160         AbsoluteDate getStop();
161 
162         /**
163          * Get the interpolation method to be used.
164          *
165          * @return the interpolation method
166          */
167         String getInterpolationMethod();
168 
169         /**
170          * Get the number of samples to use in interpolation.
171          *
172          * @return the number of points to use for interpolation.
173          */
174         int getInterpolationSamples();
175 
176         /**
177          * Get which derivatives of angular data are available in this attitude ephemeris segment.
178          *
179          * @return a value indicating if the file contains rotation and/or rotation rate
180          *         and/or acceleration data.
181          */
182         AngularDerivativesFilter getAvailableDerivatives();
183 
184         /**
185          * Get the attitude provider for this attitude ephemeris segment.
186          *
187          * @return the attitude provider for this attitude ephemeris segment.
188          */
189         BoundedAttitudeProvider getAttitudeProvider();
190 
191     }
192 
193 }