CenterName.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 org.orekit.annotation.DefaultDataContext;
  19. import org.orekit.bodies.CelestialBodies;
  20. import org.orekit.bodies.CelestialBody;
  21. import org.orekit.data.DataContext;

  22. /** Orbit central bodies for which a Celestial body can be created.
  23.  * @author sports
  24.  * @since 6.1
  25.  */
  26. public enum CenterName {
  27.     /** Solar system barycenter aggregated body. */
  28.     SOLAR_SYSTEM_BARYCENTER {

  29.         /** {@inheritDoc}
  30.          * @param celestialBodies*/
  31.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  32.             return celestialBodies.getSolarSystemBarycenter();
  33.         }
  34.     },
  35.     /** Sun body. */
  36.     SUN {

  37.         /** {@inheritDoc}
  38.          * @param celestialBodies*/
  39.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  40.             return celestialBodies.getSun();
  41.         }
  42.     },
  43.     /** Mercury body. */
  44.     MERCURY {

  45.         /** {@inheritDoc}
  46.          * @param celestialBodies*/
  47.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  48.             return celestialBodies.getMercury();
  49.         }
  50.     },
  51.     /** Venus body. */
  52.     VENUS {

  53.         /** {@inheritDoc}
  54.          * @param celestialBodies*/
  55.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  56.             return celestialBodies.getVenus();
  57.         }
  58.     },
  59.     /** Earth-Moon barycenter bodies pair. */
  60.     EARTH_MOON {

  61.         /** {@inheritDoc}
  62.          * @param celestialBodies*/
  63.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  64.             return celestialBodies.getEarthMoonBarycenter();
  65.         }
  66.     },
  67.     /** Earth body. */
  68.     EARTH {

  69.         /** {@inheritDoc}
  70.          * @param celestialBodies*/
  71.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  72.             return celestialBodies.getEarth();
  73.         }
  74.     },
  75.     /** Moon body. */
  76.     MOON {

  77.         /** {@inheritDoc}
  78.          * @param celestialBodies*/
  79.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  80.             return celestialBodies.getMoon();
  81.         }
  82.     },
  83.     /** Mars body. */
  84.     MARS {

  85.         /** {@inheritDoc}
  86.          * @param celestialBodies*/
  87.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  88.             return celestialBodies.getMars();
  89.         }
  90.     },
  91.     /** Jupiter body. */
  92.     JUPITER {

  93.         /** {@inheritDoc}
  94.          * @param celestialBodies*/
  95.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  96.             return celestialBodies.getJupiter();
  97.         }
  98.     },
  99.     /** Saturn body. */
  100.     SATURN {

  101.         /** {@inheritDoc}
  102.          * @param celestialBodies*/
  103.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  104.             return celestialBodies.getSaturn();
  105.         }
  106.     },
  107.     /** Uranus body. */
  108.     URANUS {

  109.         /** {@inheritDoc}
  110.          * @param celestialBodies*/
  111.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  112.             return celestialBodies.getUranus();
  113.         }
  114.     },
  115.     /** Neptune body. */
  116.     NEPTUNE {

  117.         /** {@inheritDoc}
  118.          * @param celestialBodies*/
  119.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  120.             return celestialBodies.getNeptune();
  121.         }
  122.     },
  123.     /** Pluto body. */
  124.     PLUTO {

  125.         /** {@inheritDoc}
  126.          * @param celestialBodies*/
  127.         public CelestialBody getCelestialBody(final CelestialBodies celestialBodies) {
  128.             return celestialBodies.getPluto();
  129.         }
  130.     };

  131.     /**
  132.      * Get the celestial body corresponding to the CCSDS constant.
  133.      *
  134.      * <p>This method uses the {@link DataContext#getDefault() default data context}.
  135.      *
  136.      * @return celestial body corresponding to the CCSDS constant
  137.      * @see #getCelestialBody(CelestialBodies)
  138.      */
  139.     @DefaultDataContext
  140.     public CelestialBody getCelestialBody() {
  141.         return getCelestialBody(DataContext.getDefault().getCelestialBodies());
  142.     }

  143.     /**
  144.      * Get the celestial body corresponding to the CCSDS constant.
  145.      *
  146.      * @param celestialBodies the set of celestial bodies to use.
  147.      * @return celestial body corresponding to the CCSDS constant
  148.      * @since 10.1
  149.      */
  150.     public abstract CelestialBody getCelestialBody(CelestialBodies celestialBodies);

  151. }