1 /* Copyright 2002-2015 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 19 import org.orekit.errors.OrekitException; 20 import org.orekit.time.AbsoluteDate; 21 import org.orekit.utils.PVCoordinatesProvider; 22 23 /** Class for frames moving with an orbiting satellite. 24 * <p>There are several local orbital frames available. They are specified 25 * by the {@link LOFType} enumerate.</p> 26 * @author Luc Maisonobe 27 */ 28 public class LocalOrbitalFrame extends Frame { 29 30 /** Serializable UID. */ 31 private static final long serialVersionUID = -4469440345574964950L; 32 33 /** Build a new instance. 34 * @param parent parent frame (must be non-null) 35 * @param type frame type 36 * @param provider provider used to compute frame motion 37 * @param name name of the frame 38 * @exception IllegalArgumentException if the parent frame is null 39 */ 40 public LocalOrbitalFrame(final Frame parent, final LOFType type, 41 final PVCoordinatesProvider provider, 42 final String name) 43 throws IllegalArgumentException { 44 super(parent, new LocalProvider(type, provider, parent), name, false); 45 } 46 47 /** Local provider for transforms. */ 48 private static class LocalProvider implements TransformProvider { 49 50 /** Serializable UID. */ 51 private static final long serialVersionUID = 386815086579675823L; 52 53 /** Frame type. */ 54 private final LOFType type; 55 56 /** Provider used to compute frame motion. */ 57 private final PVCoordinatesProvider provider; 58 59 /** Reference frame. */ 60 private final Frame reference; 61 62 /** Simple constructor. 63 * @param type frame type 64 * @param provider provider used to compute frame motion 65 * @param reference reference frame 66 */ 67 public LocalProvider(final LOFType type, final PVCoordinatesProvider provider, 68 final Frame reference) { 69 this.type = type; 70 this.provider = provider; 71 this.reference = reference; 72 } 73 74 /** {@inheritDoc} */ 75 public Transform getTransform(final AbsoluteDate date) throws OrekitException { 76 return type.transformFromInertial(date, provider.getPVCoordinates(date, reference)); 77 } 78 79 } 80 81 }