OemMetadata.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 org.orekit.files.ccsds.ndm.odm.OdmCommonMetadata;
  19. import org.orekit.time.AbsoluteDate;

  20. /** Metadata for Orbit Ephemeris Messages.
  21.  * @author Luc Maisonobe
  22.  * @since 11.0
  23.  */
  24. public class OemMetadata extends OdmCommonMetadata {

  25.     /** Start of total time span covered by ephemerides data and covariance data. */
  26.     private AbsoluteDate startTime;

  27.     /** End of total time span covered by ephemerides data and covariance data. */
  28.     private AbsoluteDate stopTime;

  29.     /** Start of useable time span covered by ephemerides data, it may be
  30.      * necessary to allow for proper interpolation. */
  31.     private AbsoluteDate useableStartTime;

  32.     /** End of useable time span covered by ephemerides data, it may be
  33.      * necessary to allow for proper interpolation. */
  34.     private AbsoluteDate useableStopTime;

  35.     /** The interpolation method to be used. */
  36.     private InterpolationMethod interpolationMethod;

  37.     /** The interpolation degree. */
  38.     private int interpolationDegree;

  39.     /** Simple constructor.
  40.      * @param defaultInterpolationDegree default interpolation degree
  41.      */
  42.     public OemMetadata(final int defaultInterpolationDegree) {
  43.         this.interpolationDegree = defaultInterpolationDegree;
  44.     }

  45.     /** {@inheritDoc} */
  46.     @Override
  47.     public void validate(final double version) {
  48.         checkMandatoryEntriesExceptDates(version);
  49.         checkNotNull(startTime, OemMetadataKey.START_TIME.name());
  50.         checkNotNull(stopTime,  OemMetadataKey.STOP_TIME.name());
  51.     }

  52.     /** Check is mandatory entries EXCEPT DATES have been initialized.
  53.      * <p>
  54.      * This method should throw an exception if some mandatory entry is missing
  55.      * </p>
  56.      * @param version format version
  57.      */
  58.     void checkMandatoryEntriesExceptDates(final double version) {
  59.         super.validate(version);
  60.     }

  61.     /** Get start of total time span covered by ephemerides data and
  62.      * covariance data.
  63.      * @return the start time
  64.      */
  65.     public AbsoluteDate getStartTime() {
  66.         return startTime;
  67.     }

  68.     /** Set start of total time span covered by ephemerides data and
  69.      * covariance data.
  70.      * @param startTime the time to be set
  71.      */
  72.     public void setStartTime(final AbsoluteDate startTime) {
  73.         refuseFurtherComments();
  74.         this.startTime = startTime;
  75.     }

  76.     /** Get end of total time span covered by ephemerides data and covariance
  77.      * data.
  78.      * @return the stop time
  79.      */
  80.     public AbsoluteDate getStopTime() {
  81.         return stopTime;
  82.     }

  83.     /** Set end of total time span covered by ephemerides data and covariance
  84.      * data.
  85.      * @param stopTime the time to be set
  86.      */
  87.     public void setStopTime(final AbsoluteDate stopTime) {
  88.         refuseFurtherComments();
  89.         this.stopTime = stopTime;
  90.     }

  91.     /** Get start of useable time span covered by ephemerides data, it may be
  92.      * necessary to allow for proper interpolation.
  93.      * @return the useable start time
  94.      */
  95.     public AbsoluteDate getUseableStartTime() {
  96.         return useableStartTime;
  97.     }

  98.     /** Set start of useable time span covered by ephemerides data, it may be
  99.      * necessary to allow for proper interpolation.
  100.      * @param useableStartTime the time to be set
  101.      */
  102.     public void setUseableStartTime(final AbsoluteDate useableStartTime) {
  103.         refuseFurtherComments();
  104.         this.useableStartTime = useableStartTime;
  105.     }

  106.     /** Get end of useable time span covered by ephemerides data, it may be
  107.      * necessary to allow for proper interpolation.
  108.      * @return the useable stop time
  109.      */
  110.     public AbsoluteDate getUseableStopTime() {
  111.         return useableStopTime;
  112.     }

  113.     /** Set end of useable time span covered by ephemerides data, it may be
  114.      * necessary to allow for proper interpolation.
  115.      * @param useableStopTime the time to be set
  116.      */
  117.     public void setUseableStopTime(final AbsoluteDate useableStopTime) {
  118.         refuseFurtherComments();
  119.         this.useableStopTime = useableStopTime;
  120.     }

  121.     /** Get the interpolation method to be used.
  122.      * @return the interpolation method
  123.      */
  124.     public InterpolationMethod getInterpolationMethod() {
  125.         return interpolationMethod;
  126.     }

  127.     /** Set the interpolation method to be used.
  128.      * @param interpolationMethod the interpolation method to be set
  129.      */
  130.     public void setInterpolationMethod(final InterpolationMethod interpolationMethod) {
  131.         refuseFurtherComments();
  132.         this.interpolationMethod = interpolationMethod;
  133.     }

  134.     /** Get the interpolation degree.
  135.      * @return the interpolation degree
  136.      */
  137.     public int getInterpolationDegree() {
  138.         return interpolationDegree;
  139.     }

  140.     /** Set the interpolation degree.
  141.      * @param interpolationDegree the interpolation degree to be set
  142.      */
  143.     public void setInterpolationDegree(final int interpolationDegree) {
  144.         refuseFurtherComments();
  145.         this.interpolationDegree = interpolationDegree;
  146.     }

  147.     /** Copy the instance, making sure mandatory fields have been initialized.
  148.      * @param version format version
  149.      * @return a new copy
  150.      */
  151.     OemMetadata copy(final double version) {

  152.         checkMandatoryEntriesExceptDates(version);

  153.         // allocate new instance
  154.         final OemMetadata copy = new OemMetadata(getInterpolationDegree());

  155.         // copy comments
  156.         for (String comment : getComments()) {
  157.             copy.addComment(comment);
  158.         }

  159.         // copy object
  160.         copy.setObjectName(getObjectName());
  161.         copy.setObjectID(getObjectID());
  162.         copy.setCenter(getCenter());

  163.         // copy frames
  164.         copy.setFrameEpoch(getFrameEpoch());
  165.         copy.setReferenceFrame(getReferenceFrame());

  166.         // copy time system only (ignore times themselves)
  167.         copy.setTimeSystem(getTimeSystem());

  168.         // copy interpolation (degree has already been set up at construction)
  169.         if (getInterpolationMethod() != null) {
  170.             copy.setInterpolationMethod(getInterpolationMethod());
  171.         }

  172.         return copy;

  173.     }

  174. }