ADMMetaData.java

  1. /* Copyright 2002-2020 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;

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

  21. import org.orekit.bodies.CelestialBodies;
  22. import org.orekit.bodies.CelestialBody;
  23. import org.orekit.time.TimeScale;

  24. /** This class gathers the meta-data present in the Attitude Data Message (ADM).
  25.  * @author Bryan Cazabonne
  26.  * @since 10.2
  27.  */
  28. public class ADMMetaData {

  29.     /** ADM file to which these meta-data belong. */
  30.     private final ADMFile admFile;

  31.     /** Time System: used for metadata and attitude data data. */
  32.     private CcsdsTimeScale timeSystem;

  33.     /** Spacecraft name for which the attitude data are provided. */
  34.     private String objectName;

  35.     /** Object identifier of the object for which the attitude data are provided. */
  36.     private String objectID;

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

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

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

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

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

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

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

  53.     /**
  54.      * Create a new meta-data.
  55.      * @param admFile ADM file to which these meta-data belong
  56.      */
  57.     public ADMMetaData(final ADMFile admFile) {
  58.         this.admFile = admFile;
  59.         comment = new ArrayList<String>();
  60.     }

  61.     /**
  62.      * Get the ADM file to which these meta-data belong.
  63.      * @return ADM file to which these meta-data belong
  64.      */
  65.     public ADMFile getADMFile() {
  66.         return admFile;
  67.     }

  68.     /**
  69.      * Get the Time System.
  70.      * @return the time system
  71.      */
  72.     public CcsdsTimeScale getTimeSystem() {
  73.         return timeSystem;
  74.     }

  75.     /**
  76.      * Set the Time System.
  77.      * @param timeSystem the time system to be set
  78.      */
  79.     public void setTimeSystem(final CcsdsTimeScale timeSystem) {
  80.         this.timeSystem = timeSystem;
  81.     }

  82.     /**
  83.      * Get the time scale.
  84.      * @return the time scale.
  85.      * @see #getTimeSystem()
  86.      */
  87.     public TimeScale getTimeScale() {
  88.         return getTimeSystem().getTimeScale(
  89.                 admFile.getConventions(),
  90.                 admFile.getDataContext().getTimeScales());
  91.     }

  92.     /**
  93.      * Get the spacecraft name for which the attitude data are provided.
  94.      * @return the spacecraft name
  95.      */
  96.     public String getObjectName() {
  97.         return objectName;
  98.     }

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

  106.     /**
  107.      * Get the spacecraft ID for which the attitude data are provided.
  108.      * @return the spacecraft ID
  109.      */
  110.     public String getObjectID() {
  111.         return objectID;
  112.     }

  113.     /**
  114.      * Set the spacecraft ID for which the attitude data are provided.
  115.      * @param objectID the spacecraft ID to be set
  116.      */
  117.     public void setObjectID(final String objectID) {
  118.         this.objectID = objectID;
  119.     }

  120.     /**
  121.      * Get the launch year.
  122.      * @return launch year
  123.      */
  124.     public int getLaunchYear() {
  125.         return launchYear;
  126.     }

  127.     /**
  128.      * Set the launch year.
  129.      * @param launchYear launch year
  130.      */
  131.     public void setLaunchYear(final int launchYear) {
  132.         this.launchYear = launchYear;
  133.     }

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

  141.     /**
  142.      * Set the launch number.
  143.      * @param launchNumber launch number
  144.      */
  145.     public void setLaunchNumber(final int launchNumber) {
  146.         this.launchNumber = launchNumber;
  147.     }

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

  155.     /**
  156.      * Set the piece of launch.
  157.      * @param launchPiece piece of launch
  158.      */
  159.     public void setLaunchPiece(final String launchPiece) {
  160.         this.launchPiece = launchPiece;
  161.     }

  162.     /** Get the origin of reference frame.
  163.      * @return the origin of reference frame.
  164.      */
  165.     public String getCenterName() {
  166.         return centerName;
  167.     }

  168.     /** Set the origin of reference frame.
  169.      * @param centerName the origin of reference frame to be set
  170.      */
  171.     public void setCenterName(final String centerName) {
  172.         this.centerName = centerName;
  173.     }

  174.     /**
  175.      * Get the {@link CelestialBody} corresponding to the center name.
  176.      * @return the center body
  177.      */
  178.     public CelestialBody getCenterBody() {
  179.         return centerBody;
  180.     }

  181.     /**
  182.      * Set the {@link CelestialBody} corresponding to the center name.
  183.      * @param centerBody the {@link CelestialBody} to be set
  184.      */
  185.     public void setCenterBody(final CelestialBody centerBody) {
  186.         this.centerBody = centerBody;
  187.     }

  188.     /**
  189.      * Get boolean testing whether the body corresponding to the centerName
  190.      * attribute can be created through the {@link CelestialBodies}.
  191.      * @return true if {@link CelestialBody} can be created from centerName
  192.      *         false otherwise
  193.      */
  194.     public boolean getHasCreatableBody() {
  195.         return hasCreatableBody;
  196.     }

  197.     /**
  198.      * Set boolean testing whether the body corresponding to the centerName
  199.      * attribute can be created through the {@link CelestialBodies}.
  200.      * @param hasCreatableBody the boolean to be set.
  201.      */
  202.     public void setHasCreatableBody(final boolean hasCreatableBody) {
  203.         this.hasCreatableBody = hasCreatableBody;
  204.     }

  205.     /** Get the meta-data comment.
  206.      * @return meta-data comment
  207.      */
  208.     public List<String> getComment() {
  209.         return Collections.unmodifiableList(comment);
  210.     }

  211.     /** Set the meta-data comment.
  212.      * @param comment comment to set
  213.      */
  214.     public void setComment(final List<String> comment) {
  215.         this.comment = new ArrayList<String>(comment);
  216.     }

  217. }