ODMMetaData.java

  1. /* Copyright 2002-2013 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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;

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

  21. import org.orekit.bodies.CelestialBody;
  22. import org.orekit.files.general.OrbitFile;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.time.AbsoluteDate;

  25. /** This class gathers the meta-data present in the Orbital Data Message (ODM).
  26.  * @author sports
  27.  * @since 6.1
  28.  */
  29. public class ODMMetaData {

  30.     /** ODM file to which these meta-data belong. */
  31.     private final ODMFile odmFile;

  32.     /** Time System: used for metadata, orbit state and covariance data. */
  33.     private OrbitFile.TimeSystem timeSystem;

  34.     /** Spacecraft name for which the orbit state is provided. */
  35.     private String objectName;

  36.     /** Object identifier of the object for which the orbit state is provided. */
  37.     private String objectID;

  38.     /** Launch Year. */
  39.     private int launchYear;

  40.     /** Launch number. */
  41.     private int launchNumber;

  42.     /** Piece of launch (from "A" to "ZZZ"). */
  43.     private String launchPiece;

  44.     /** Origin of reference frame. */
  45.     private String centerName;

  46.     /** Celestial body corresponding to the center name. */
  47.     private CelestialBody centerBody;

  48.     /** Tests whether the body corresponding to the center name can be
  49.      * created through the {@link org.orekit.bodies.CelestialBodyFactory} in order to obtain the
  50.      * corresponding gravitational coefficient. */
  51.     private boolean hasCreatableBody;

  52.     /** Reference frame in which data are given: used for state vector
  53.      * and Keplerian elements data (and for the covariance reference frame if none is given). */
  54.     private Frame refFrame;

  55.     /** Epoch of reference frame, if not intrinsic to the definition of the
  56.      * reference frame. */
  57.     private String frameEpochString;

  58.     /** Epoch of reference frame, if not intrinsic to the definition of the
  59.      * reference frame. */
  60.     private AbsoluteDate frameEpoch;

  61.     /** Metadata comments. The list contains a string for each line of comment. */
  62.     private List<String> comment;

  63.     /** Create a new meta-data.
  64.      * @param odmFile ODM file to which these meta-data belong
  65.      */
  66.     ODMMetaData(final ODMFile odmFile) {
  67.         this.odmFile = odmFile;
  68.         comment = new ArrayList<String>();
  69.     };

  70.     /** Get the ODM file to which these meta-data belong.
  71.      * @return ODM file to which these meta-data belong
  72.      */
  73.     public ODMFile getODMFile() {
  74.         return odmFile;
  75.     }

  76.     /** Get the Time System that: for OPM, is used for metadata, state vector,
  77.      * maneuver and covariance data, for OMM, is used for metadata, orbit state
  78.      * and covariance data, for OEM, is used for metadata, ephemeris and
  79.      * covariance data.
  80.      * @return the time system
  81.      */
  82.     public OrbitFile.TimeSystem getTimeSystem() {
  83.         return timeSystem;
  84.     }

  85.     /** Set the Time System that: for OPM, is used for metadata, state vector,
  86.      * maneuver and covariance data, for OMM, is used for metadata, orbit state
  87.      * and covariance data, for OEM, is used for metadata, ephemeris and
  88.      * covariance data.
  89.      * @param timeSystem the time system to be set
  90.      */
  91.     void setTimeSystem(final OrbitFile.TimeSystem timeSystem) {
  92.         this.timeSystem = timeSystem;
  93.     }

  94.     /** Get the spacecraft name for which the orbit state is provided.
  95.      * @return the spacecraft name
  96.      */
  97.     public String getObjectName() {
  98.         return objectName;
  99.     }

  100.     /** Set the spacecraft name for which the orbit state is provided.
  101.      * @param objectName the spacecraft name to be set
  102.      */
  103.     void setObjectName(final String objectName) {
  104.         this.objectName = objectName;
  105.     }

  106.     /** Get the spacecraft ID for which the orbit state is provided.
  107.      * @return the spacecraft ID
  108.      */
  109.     public String getObjectID() {
  110.         return objectID;
  111.     }

  112.     /** Set the spacecraft ID for which the orbit state is provided.
  113.      * @param objectID the spacecraft ID to be set
  114.      */
  115.     void setObjectID(final String objectID) {
  116.         this.objectID = objectID;
  117.     }

  118.     /** Set the launch year.
  119.      * @param launchYear launch year
  120.      */
  121.     void setLaunchYear(final int launchYear) {
  122.         this.launchYear = launchYear;
  123.     }

  124.     /** Get the launch year.
  125.      * @return launch year
  126.      */
  127.     public int getLaunchYear() {
  128.         return launchYear;
  129.     }

  130.     /** Set the launch number.
  131.      * @param launchNumber launch number
  132.      */
  133.     void setLaunchNumber(final int launchNumber) {
  134.         this.launchNumber = launchNumber;
  135.     }

  136.     /** Get the launch number.
  137.      * @return launch number
  138.      */
  139.     public int getLaunchNumber() {
  140.         return launchNumber;
  141.     }

  142.     /** Set the piece of launch.
  143.      * @param launchPiece piece of launch
  144.      */
  145.     void setLaunchPiece(final String launchPiece) {
  146.         this.launchPiece = launchPiece;
  147.     }

  148.     /** Get the piece of launch.
  149.      * @return piece of launch
  150.      */
  151.     public String getLaunchPiece() {
  152.         return launchPiece;
  153.     }

  154.     /** Get the origin of reference frame.
  155.      * @return the origin of reference frame.
  156.      */
  157.     public String getCenterName() {
  158.         return centerName;
  159.     }

  160.     /** Set the origin of reference frame.
  161.      * @param centerName the origin of reference frame to be set
  162.      */
  163.     void setCenterName(final String centerName) {
  164.         this.centerName = centerName;
  165.     }

  166.     /** Get the {@link CelestialBody} corresponding to the center name.
  167.      * @return the center body
  168.      */
  169.     public CelestialBody getCenterBody() {
  170.         return centerBody;
  171.     }

  172.     /** Set the {@link CelestialBody} corresponding to the center name.
  173.      * @param centerBody the {@link CelestialBody} to be set
  174.      */
  175.     void setCenterBody(final CelestialBody centerBody) {
  176.         this.centerBody = centerBody;
  177.     }

  178.     /** Get boolean testing whether the body corresponding to the centerName
  179.      * attribute can be created through the {@link org.orekit.bodies.CelestialBodyFactory}.
  180.      * @return true if {@link CelestialBody} can be created from centerName
  181.      *         false otherwise
  182.      */
  183.     public boolean getHasCreatableBody() {
  184.         return hasCreatableBody;
  185.     }

  186.     /** Set boolean testing whether the body corresponding to the centerName
  187.      * attribute can be created through the {@link org.orekit.bodies.CelestialBodyFactory}.
  188.      * @param hasCreatableBody the boolean to be set.
  189.      */
  190.     void setHasCreatableBody(final boolean hasCreatableBody) {
  191.         this.hasCreatableBody = hasCreatableBody;
  192.     }

  193.     /** Get the reference frame in which data are given: used for state vector
  194.      * and Keplerian elements data (and for the covariance reference frame if none is given).
  195.      * @return the reference frame
  196.      */
  197.     public Frame getFrame() {
  198.         return refFrame;
  199.     }

  200.     /** Set the reference frame in which data are given: used for state vector
  201.      * and Keplerian elements data (and for the covariance reference frame if none is given).
  202.      * @param refFrame the reference frame to be set
  203.      */
  204.     void setRefFrame(final Frame refFrame) {
  205.         this.refFrame = refFrame;
  206.     }

  207.     /** Get epoch of reference frame, if not intrinsic to the definition of the
  208.      * reference frame.
  209.      * @return epoch of reference frame
  210.      */
  211.     public String getFrameEpochString() {
  212.         return frameEpochString;
  213.     }

  214.     /** Set epoch of reference frame, if not intrinsic to the definition of the
  215.      * reference frame.
  216.      * @param frameEpochString the epoch of reference frame to be set
  217.      */
  218.     void setFrameEpochString(final String frameEpochString) {
  219.         this.frameEpochString = frameEpochString;
  220.     }

  221.     /** Get epoch of reference frame, if not intrinsic to the definition of the
  222.      * reference frame.
  223.      * @return epoch of reference frame
  224.      */
  225.     public AbsoluteDate getFrameEpoch() {
  226.         return frameEpoch;
  227.     }

  228.     /** Set epoch of reference frame, if not intrinsic to the definition of the
  229.      * reference frame.
  230.      * @param frameEpoch the epoch of reference frame to be set
  231.      */
  232.     void setFrameEpoch(final AbsoluteDate frameEpoch) {
  233.         this.frameEpoch = frameEpoch;
  234.     }

  235.     /** Set epoch of reference frame for MET and MRT Time systems, if not intrinsic to the definition of the
  236.      * reference frame.
  237.      * @param offset the offset between the frame epoch and the initial date
  238.      * */
  239.     void setFrameEpoch(final double offset) {
  240.         this.frameEpoch = odmFile.getMissionReferenceDate().shiftedBy(offset);
  241.     }

  242.     /** Get the meta-data comment.
  243.      * @return meta-data comment
  244.      */
  245.     public List<String> getComment() {
  246.         return Collections.unmodifiableList(comment);
  247.     }

  248.     /** Set the meta-data comment.
  249.      * @param comment comment to set
  250.      */
  251.     void setComment(final List<String> comment) {
  252.         this.comment = new ArrayList<String>(comment);
  253.     }

  254. }