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
18 package org.orekit.files.ccsds.ndm.odm.oem;
19
20 import java.util.List;
21
22 import org.orekit.files.ccsds.ndm.odm.CartesianCovariance;
23 import org.orekit.files.ccsds.section.Segment;
24 import org.orekit.files.general.EphemerisFile;
25 import org.orekit.frames.Frame;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.utils.CartesianDerivativesFilter;
28 import org.orekit.utils.TimeStampedPVCoordinates;
29
30 /** The Ephemerides Blocks class contain metadata, the list of ephemerides data
31 * lines and optional covariance matrices (and their metadata). The reason
32 * for which the ephemerides have been separated into blocks is that the
33 * ephemerides of two different blocks are not suited for interpolation.
34 * @author sports
35 */
36 public class OemSegment extends Segment<OemMetadata, OemData>
37 implements EphemerisFile.EphemerisSegment<TimeStampedPVCoordinates> {
38
39 /** Gravitational parameter in m³/s². */
40 private final double mu;
41
42 /** Simple constructor.
43 * @param metadata segment metadata
44 * @param data segment data
45 * @param mu gravitational parameter in m³/s²
46 */
47 public OemSegment(final OemMetadata metadata, final OemData data, final double mu) {
48 super(metadata, data);
49 this.mu = mu;
50 }
51
52 /** {@inheritDoc} */
53 @Override
54 public double getMu() {
55 return mu;
56 }
57
58 /** {@inheritDoc} */
59 @Override
60 public List<TimeStampedPVCoordinates> getCoordinates() {
61 return getData().getCoordinates();
62 }
63
64 /** {@inheritDoc} */
65 @Override
66 public CartesianDerivativesFilter getAvailableDerivatives() {
67 return getData().getAvailableDerivatives();
68 }
69
70 /** Get an unmodifiable view of Covariance Matrices.
71 * @return unmodifiable view of Covariance Matrices
72 */
73 public List<CartesianCovariance> getCovarianceMatrices() {
74 return getData().getCovarianceMatrices();
75 }
76
77 /** {@inheritDoc} */
78 @Override
79 public Frame getFrame() {
80 return getMetadata().getFrame();
81 }
82
83 /** {@inheritDoc} */
84 @Override
85 public AbsoluteDate getStart() {
86 // useable start time overrides start time if it is set
87 final AbsoluteDate start = getMetadata().getUseableStartTime();
88 if (start != null) {
89 return start;
90 } else {
91 return getMetadata().getStartTime();
92 }
93 }
94
95 /** {@inheritDoc} */
96 @Override
97 public AbsoluteDate getStop() {
98 // useable stop time overrides stop time if it is set
99 final AbsoluteDate stop = getMetadata().getUseableStopTime();
100 if (stop != null) {
101 return stop;
102 } else {
103 return getMetadata().getStopTime();
104 }
105 }
106
107 /** {@inheritDoc} */
108 @Override
109 public int getInterpolationSamples() {
110 // From the standard it is not entirely clear how to interpret the degree.
111 return getMetadata().getInterpolationDegree() + 1;
112 }
113
114 }