CCSDSFrame.java

  1. /* Copyright 2002-2018 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 org.orekit.bodies.CelestialBodyFactory;
  19. import org.orekit.errors.OrekitException;
  20. import org.orekit.errors.OrekitMessages;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.frames.FramesFactory;
  23. import org.orekit.frames.ITRFVersion;
  24. import org.orekit.frames.LOFType;
  25. import org.orekit.utils.IERSConventions;

  26. /** Frames used in CCSDS Orbit Data Messages.
  27.  * @author Steven Ports
  28.  * @since 6.1
  29.  */
  30. public enum CCSDSFrame {

  31.     /** Earth Mean Equator and Equinox of J2000. */
  32.     EME2000(null) {

  33.         /** {@inheritDoc} */
  34.         @Override
  35.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  36.             throws OrekitException {
  37.             return FramesFactory.getEME2000();
  38.         }

  39.     },

  40.     /** Geocentric Celestial Reference Frame. */
  41.     GCRF(null) {

  42.         /** {@inheritDoc} */
  43.         @Override
  44.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  45.             throws OrekitException {
  46.             return FramesFactory.getGCRF();
  47.         }

  48.     },

  49.     /** Greenwich Rotating Coordinates. */
  50.     GRC(null) {

  51.         /** {@inheritDoc} */
  52.         @Override
  53.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  54.             throws OrekitException {
  55.             if (conventions == null) {
  56.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  57.             }
  58.             return FramesFactory.getITRFEquinox(conventions, simpleEOP);
  59.         }

  60.     },

  61.     /** International Celestial Reference Frame. */
  62.     ICRF(null) {

  63.         /** {@inheritDoc} */
  64.         @Override
  65.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  66.             throws OrekitException {
  67.             return FramesFactory.getICRF();
  68.         }

  69.     },

  70.     /** International Terrestrial Reference Frame 2014. */
  71.     ITRF2014(null) {

  72.         /** {@inheritDoc} */
  73.         @Override
  74.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  75.                 throws OrekitException {
  76.             if (conventions == null) {
  77.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  78.             }
  79.             return FramesFactory.getITRF(ITRFVersion.ITRF_2014, conventions, simpleEOP);
  80.         }

  81.     },

  82.     /** International Terrestrial Reference Frame 2008. */
  83.     ITRF2008(null) {

  84.         /** {@inheritDoc} */
  85.         @Override
  86.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  87.                 throws OrekitException {
  88.             if (conventions == null) {
  89.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  90.             }
  91.             return FramesFactory.getITRF(ITRFVersion.ITRF_2008, conventions, simpleEOP);
  92.         }

  93.     },

  94.     /** International Terrestrial Reference Frame 2005. */
  95.     ITRF2005(null) {

  96.         /** {@inheritDoc} */
  97.         @Override
  98.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  99.             throws OrekitException {
  100.             if (conventions == null) {
  101.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  102.             }
  103.             return FramesFactory.getITRF(ITRFVersion.ITRF_2005, conventions, simpleEOP);
  104.         }

  105.     },

  106.     /** International Terrestrial Reference Frame 2000. */
  107.     ITRF2000(null) {

  108.         /** {@inheritDoc} */
  109.         @Override
  110.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  111.             throws OrekitException {
  112.             if (conventions == null) {
  113.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  114.             }
  115.             return FramesFactory.getITRF(ITRFVersion.ITRF_2000, conventions, simpleEOP);
  116.         }

  117.     },

  118.     /** International Terrestrial Reference Frame 1993. */
  119.     ITRF93(null) {

  120.         /** {@inheritDoc} */
  121.         @Override
  122.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  123.             throws OrekitException {
  124.             if (conventions == null) {
  125.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  126.             }
  127.             return FramesFactory.getITRF(ITRFVersion.ITRF_93, conventions, simpleEOP);
  128.         }

  129.     },

  130.     /** International Terrestrial Reference Frame 1997. */
  131.     ITRF97(null) {

  132.         /** {@inheritDoc} */
  133.         @Override
  134.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  135.             throws OrekitException {
  136.             if (conventions == null) {
  137.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  138.             }
  139.             return FramesFactory.getITRF(ITRFVersion.ITRF_97, conventions, simpleEOP);
  140.         }

  141.     },

  142.     /** Mars Centered Inertial. */
  143.     MCI(null) {

  144.         /** {@inheritDoc} */
  145.         @Override
  146.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  147.             throws OrekitException {
  148.             return CelestialBodyFactory.getMars().getInertiallyOrientedFrame();
  149.         }

  150.     },

  151.     /** True of Date, Rotating. */
  152.     TDR(null) {

  153.         /** {@inheritDoc} */
  154.         @Override
  155.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  156.             throws OrekitException {
  157.             if (conventions == null) {
  158.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  159.             }
  160.             return FramesFactory.getGTOD(conventions, simpleEOP);
  161.         }

  162.     },

  163.     /**
  164.      * True Equator Mean Equinox.
  165.      * TEME may be used only for OMMs based on NORAD
  166.      * Two Line Element sets, and in no other circumstances.
  167.      */
  168.     TEME(null) {

  169.         /** {@inheritDoc} */
  170.         @Override
  171.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  172.             throws OrekitException {
  173.             return FramesFactory.getTEME();
  174.         }

  175.     },

  176.     /** True of Date. */
  177.     TOD(null) {

  178.         /** {@inheritDoc} */
  179.         @Override
  180.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  181.             throws OrekitException {
  182.             if (conventions == null) {
  183.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  184.             }
  185.             return FramesFactory.getTOD(conventions, simpleEOP);
  186.         }

  187.     },

  188.     /** Radial, Transverse (along-track) and Normal. */
  189.     RTN(LOFType.QSW),

  190.     /** Another name for Radial, Transverse (along-track) and Normal. */
  191.     RSW(LOFType.QSW),

  192.     /** TNW : x-axis along the velocity vector, W along the orbital angular momentum vector and
  193.     N completes the right handed system. */
  194.     TNW(LOFType.TNW);

  195.     /** Type of Local Orbital Frame (may be null). */
  196.     private final LOFType lofType;

  197.     /** Simple constructor.
  198.      * @param lofType type of Local Orbital Frame (null if frame is not a Local Orbital Frame)
  199.      */
  200.     CCSDSFrame(final LOFType lofType) {
  201.         this.lofType = lofType;
  202.     }

  203.     /** Check if the frame is a Local Orbital frame.
  204.      * @return true if the frame is a Local Orbital Frame
  205.      */
  206.     public boolean isLof() {
  207.         return lofType != null;
  208.     }

  209.     /** Get the type of Local Orbital frame.
  210.      * <p>
  211.      * If the frame is not a Local Orbital frame (i.e. if this method returns null),
  212.      * then the {@link #getFrame(IERSConventions, boolean) getFrame} method must be used to
  213.      * retrieve the absolute frame.
  214.      * </p>
  215.      * @return type of Local Orbital Frame, or null if the frame is not a local orbital frame
  216.      * @see #isLof()
  217.      */
  218.     public LOFType getLofType() {
  219.         return lofType;
  220.     }

  221.     /**
  222.      * Get the frame corresponding to the CCSDS constant.
  223.      * @param conventions IERS conventions to use
  224.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  225.      * @return frame corresponding to the CCSDS constant
  226.      * @exception OrekitException if the frame cannot be retrieved or if it
  227.      * is a Local Orbital Frame
  228.      * @see #isLof()
  229.      */
  230.     public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP)
  231.         throws OrekitException {
  232.         throw new OrekitException(OrekitMessages.CCSDS_INVALID_FRAME, toString());
  233.     }

  234. }