OemData.java

  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.odm.oem;

  18. import java.util.ArrayList;
  19. import java.util.Collections;
  20. import java.util.List;

  21. import org.orekit.files.ccsds.ndm.odm.CartesianCovariance;
  22. import org.orekit.files.ccsds.section.CommentsContainer;
  23. import org.orekit.files.ccsds.section.Data;
  24. import org.orekit.utils.CartesianDerivativesFilter;
  25. import org.orekit.utils.TimeStampedPVCoordinates;

  26. /**
  27.  * The Ephemerides data blocks class contain list of orbital data points.
  28.  * <p>
  29.  * Beware that the Orekit getters and setters all rely on SI units. The parsers
  30.  * and writers take care of converting these SI units into CCSDS mandatory units.
  31.  * The {@link org.orekit.utils.units.Unit Unit} class provides useful
  32.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  33.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
  34.  * already use CCSDS units instead of the API SI units. The general-purpose
  35.  * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
  36.  * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
  37.  * (with an 's') also provide some predefined units. These predefined units and the
  38.  * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
  39.  * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
  40.  * what the parsers and writers use for the conversions.
  41.  * </p>
  42.  * @author sports
  43.  */
  44. public class OemData extends CommentsContainer implements Data {

  45.     /** List of ephemerides data lines. */
  46.     private final List<TimeStampedPVCoordinates> ephemeridesDataLines;

  47.     /** Enumerate for selecting which derivatives to use in {@link #ephemeridesDataLines}. */
  48.     private CartesianDerivativesFilter cartesianDerivativesFilter;

  49.     /** List of covariance matrices. */
  50.     private final List<CartesianCovariance> covarianceMatrices;

  51.     /** EphemeridesBlock constructor. */
  52.     public OemData() {
  53.         ephemeridesDataLines       = new ArrayList<>();
  54.         covarianceMatrices         = new ArrayList<>();
  55.         cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PVA;
  56.     }

  57.     /** Add a data point.
  58.      * @param data data point to add
  59.      * @param hasAcceleration true if the current data point has acceleration data.
  60.      * @return always return {@code true}
  61.      */
  62.     public boolean addData(final TimeStampedPVCoordinates data, final boolean hasAcceleration) {
  63.         ephemeridesDataLines.add(data);
  64.         if (!hasAcceleration) {
  65.             // as soon as one point misses acceleration we consider it is not available at all
  66.             cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PV;
  67.         }
  68.         return true;
  69.     }

  70.     /** Add a covariance matrix.
  71.      * @param covarianceMatrix covariance matrix to dd
  72.      */
  73.     public void addCovarianceMatrix(final CartesianCovariance covarianceMatrix) {
  74.         covarianceMatrices.add(covarianceMatrix);
  75.     }

  76.     /** Get the list of Ephemerides data lines.
  77.      * @return a reference to the internal list of Ephemerides data lines
  78.      */
  79.     public List<TimeStampedPVCoordinates> getEphemeridesDataLines() {
  80.         return Collections.unmodifiableList(ephemeridesDataLines);
  81.     }

  82.     /** Get the derivatives available in the block.
  83.      * @return derivatives available in the block
  84.      */
  85.     public CartesianDerivativesFilter getAvailableDerivatives() {
  86.         return cartesianDerivativesFilter;
  87.     }

  88.     /** Get an unmodifiable view of the data points.
  89.      * @return unmodifiable view of the data points
  90.      */
  91.     public List<TimeStampedPVCoordinates> getCoordinates() {
  92.         return Collections.unmodifiableList(ephemeridesDataLines);
  93.     }

  94.     /** Get an unmodifiable view of Covariance Matrices.
  95.      * @return unmodifiable view of Covariance Matrices
  96.      */
  97.     public List<CartesianCovariance> getCovarianceMatrices() {
  98.         return Collections.unmodifiableList(covarianceMatrices);
  99.     }

  100. }