OemData.java

  1. /* Copyright 2002-2024 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.  * @author sports
  29.  */
  30. public class OemData extends CommentsContainer implements Data {

  31.     /** List of ephemerides data lines. */
  32.     private List<TimeStampedPVCoordinates> ephemeridesDataLines;

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

  35.     /** List of covariance matrices. */
  36.     private List<CartesianCovariance> covarianceMatrices;

  37.     /** EphemeridesBlock constructor. */
  38.     public OemData() {
  39.         ephemeridesDataLines       = new ArrayList<>();
  40.         covarianceMatrices         = new ArrayList<>();
  41.         cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PVA;
  42.     }

  43.     /** Add a data point.
  44.      * @param data data point to add
  45.      * @param hasAcceleration true if the current data point has acceleration data.
  46.      * @return always return {@code true}
  47.      */
  48.     public boolean addData(final TimeStampedPVCoordinates data, final boolean hasAcceleration) {
  49.         ephemeridesDataLines.add(data);
  50.         if (!hasAcceleration) {
  51.             // as soon as one point misses acceleration we consider it is not available at all
  52.             cartesianDerivativesFilter = CartesianDerivativesFilter.USE_PV;
  53.         }
  54.         return true;
  55.     }

  56.     /** Add a covariance matrix.
  57.      * @param covarianceMatrix covariance matrix to dd
  58.      */
  59.     public void addCovarianceMatrix(final CartesianCovariance covarianceMatrix) {
  60.         covarianceMatrices.add(covarianceMatrix);
  61.     }

  62.     /** Get the list of Ephemerides data lines.
  63.      * @return a reference to the internal list of Ephemerides data lines
  64.      */
  65.     public List<TimeStampedPVCoordinates> getEphemeridesDataLines() {
  66.         return Collections.unmodifiableList(ephemeridesDataLines);
  67.     }

  68.     /** Get the derivatives available in the block.
  69.      * @return derivatives available in the block
  70.      */
  71.     public CartesianDerivativesFilter getAvailableDerivatives() {
  72.         return cartesianDerivativesFilter;
  73.     }

  74.     /** Get an unmodifiable view of the data points.
  75.      * @return unmodifiable view of the data points
  76.      */
  77.     public List<TimeStampedPVCoordinates> getCoordinates() {
  78.         return Collections.unmodifiableList(ephemeridesDataLines);
  79.     }

  80.     /** Get an unmodifiable view of Covariance Matrices.
  81.      * @return unmodifiable view of Covariance Matrices
  82.      */
  83.     public List<CartesianCovariance> getCovarianceMatrices() {
  84.         return Collections.unmodifiableList(covarianceMatrices);
  85.     }

  86. }