LocalOrbitalFrame.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.frames;

  18. import org.orekit.errors.OrekitException;
  19. import org.orekit.time.AbsoluteDate;
  20. import org.orekit.utils.PVCoordinatesProvider;

  21. /** Class for frames moving with an orbiting satellite.
  22.  * <p>There are several local orbital frames available. They are specified
  23.  * by the {@link LOFType} enumerate.</p>
  24.  * @author Luc Maisonobe
  25.  */
  26. public class LocalOrbitalFrame extends Frame {

  27.     /** Serializable UID. */
  28.     private static final long serialVersionUID = -4469440345574964950L;

  29.     /** Build a new instance.
  30.      * @param parent parent frame (must be non-null)
  31.      * @param type frame type
  32.      * @param provider provider used to compute frame motion
  33.      * @param name name of the frame
  34.      * @exception IllegalArgumentException if the parent frame is null
  35.      */
  36.     public LocalOrbitalFrame(final Frame parent, final LOFType type,
  37.                              final PVCoordinatesProvider provider,
  38.                              final String name)
  39.         throws IllegalArgumentException {
  40.         super(parent, new LocalProvider(type, provider, parent), name, false);
  41.     }

  42.     /** Local provider for transforms. */
  43.     private static class LocalProvider implements TransformProvider {

  44.         /** Serializable UID. */
  45.         private static final long serialVersionUID = 386815086579675823L;

  46.         /** Frame type. */
  47.         private final LOFType type;

  48.         /** Provider used to compute frame motion. */
  49.         private final PVCoordinatesProvider provider;

  50.         /** Reference frame. */
  51.         private final Frame reference;

  52.         /** Simple constructor.
  53.          * @param type frame type
  54.          * @param provider provider used to compute frame motion
  55.          * @param reference reference frame
  56.          */
  57.         public LocalProvider(final LOFType type, final PVCoordinatesProvider provider,
  58.                              final Frame reference) {
  59.             this.type      = type;
  60.             this.provider  = provider;
  61.             this.reference = reference;
  62.         }

  63.         /** {@inheritDoc} */
  64.         public Transform getTransform(final AbsoluteDate date) throws OrekitException {
  65.             return type.transformFromInertial(date, provider.getPVCoordinates(date, reference));
  66.         }

  67.     }

  68. }