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
18 package org.orekit.files.ccsds.ndm.odm.oem;
19
20 import java.util.ArrayList;
21 import java.util.Collections;
22 import java.util.List;
23
24 import org.orekit.files.ccsds.ndm.odm.CartesianCovariance;
25 import org.orekit.files.ccsds.section.CommentsContainer;
26 import org.orekit.files.ccsds.section.Data;
27 import org.orekit.utils.CartesianDerivativesFilter;
28 import org.orekit.utils.TimeStampedPVCoordinates;
29
30 /**
31 * The Ephemerides data blocks class contain list of orbital data points.
32 * <p>
33 * Beware that the Orekit getters and setters all rely on SI units. The parsers
34 * and writers take care of converting these SI units into CCSDS mandatory units.
35 * The {@link org.orekit.utils.units.Unit Unit} class provides useful
36 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
37 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
38 * already use CCSDS units instead of the API SI units. The general-purpose
39 * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
40 * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
41 * (with an 's') also provide some predefined units. These predefined units and the
42 * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
43 * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
44 * what the parsers and writers use for the conversions.
45 * </p>
46 * @author sports
47 */
48 public class OemData extends CommentsContainer implements Data {
49
50 /** List of ephemerides data lines. */
51 private final List<TimeStampedPVCoordinates> ephemeridesDataLines;
52
53 /** Enumerate for selecting which derivatives to use in {@link #ephemeridesDataLines}. */
54 private CartesianDerivativesFilter cartesianDerivativesFilter;
55
56 /** List of covariance matrices. */
57 private final List<CartesianCovariance> covarianceMatrices;
58
59 /** EphemeridesBlock constructor. */
60 public OemData() {
61 ephemeridesDataLines = new ArrayList<>();
62 covarianceMatrices = new ArrayList<>();
63 cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PVA;
64 }
65
66 /** Add a data point.
67 * @param data data point to add
68 * @param hasAcceleration true if the current data point has acceleration data.
69 * @return always return {@code true}
70 */
71 public boolean addData(final TimeStampedPVCoordinates data, final boolean hasAcceleration) {
72 ephemeridesDataLines.add(data);
73 if (!hasAcceleration) {
74 // as soon as one point misses acceleration we consider it is not available at all
75 cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PV;
76 }
77 return true;
78 }
79
80 /** Add a covariance matrix.
81 * @param covarianceMatrix covariance matrix to dd
82 */
83 public void addCovarianceMatrix(final CartesianCovariance covarianceMatrix) {
84 covarianceMatrices.add(covarianceMatrix);
85 }
86
87 /** Get the list of Ephemerides data lines.
88 * @return a reference to the internal list of Ephemerides data lines
89 */
90 public List<TimeStampedPVCoordinates> getEphemeridesDataLines() {
91 return Collections.unmodifiableList(ephemeridesDataLines);
92 }
93
94 /** Get the derivatives available in the block.
95 * @return derivatives available in the block
96 */
97 public CartesianDerivativesFilter getAvailableDerivatives() {
98 return cartesianDerivativesFilter;
99 }
100
101 /** Get an unmodifiable view of the data points.
102 * @return unmodifiable view of the data points
103 */
104 public List<TimeStampedPVCoordinates> getCoordinates() {
105 return Collections.unmodifiableList(ephemeridesDataLines);
106 }
107
108 /** Get an unmodifiable view of Covariance Matrices.
109 * @return unmodifiable view of Covariance Matrices
110 */
111 public List<CartesianCovariance> getCovarianceMatrices() {
112 return Collections.unmodifiableList(covarianceMatrices);
113 }
114
115 }