1 /* Copyright 2002-2021 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.frames;
18
19 import org.hipparchus.CalculusFieldElement;
20 import org.orekit.time.AbsoluteDate;
21 import org.orekit.time.FieldAbsoluteDate;
22 import org.orekit.utils.PVCoordinatesProvider;
23
24 /** Class for frames moving with an orbiting satellite.
25 *
26 * <p>There are several local orbital frames available. They are specified
27 * by the {@link LOFType} enumerate.</p>
28 *
29 * <p> Do not use the {@link #getTransformTo(Frame, FieldAbsoluteDate)} method as it is
30 * not implemented.
31 *
32 * @author Luc Maisonobe
33 * @see org.orekit.propagation.SpacecraftState#toTransform()
34 */
35 public class LocalOrbitalFrame extends Frame {
36
37 /** Serializable UID. */
38 private static final long serialVersionUID = -4469440345574964950L;
39
40 /** Build a new instance.
41 *
42 * <p> It is highly recommended that {@code provider} use an analytic formulation and
43 * not numerical integration as large integration errors may result from many short
44 * propagations.
45 *
46 * @param parent parent frame (must be non-null)
47 * @param type frame type
48 * @param provider provider used to compute frame motion.
49 * @param name name of the frame
50 * @exception IllegalArgumentException if the parent frame is null
51 */
52 public LocalOrbitalFrame(final Frame parent, final LOFType type,
53 final PVCoordinatesProvider provider,
54 final String name)
55 throws IllegalArgumentException {
56 super(parent, new LocalProvider(type, provider, parent, name), name, false);
57 }
58
59 /** Local provider for transforms. */
60 private static class LocalProvider implements TransformProvider {
61
62 /** Serializable UID. */
63 private static final long serialVersionUID = 20170421L;
64
65 /** Frame type. */
66 private final LOFType type;
67
68 /** Provider used to compute frame motion. */
69 private final PVCoordinatesProvider provider;
70
71 /** Reference frame. */
72 private final Frame reference;
73
74 /** Name of the frame. */
75 private final String name;
76
77 /** Simple constructor.
78 * @param type frame type
79 * @param provider provider used to compute frame motion
80 * @param reference reference frame
81 * @param name name of the frame
82 */
83 LocalProvider(final LOFType type, final PVCoordinatesProvider provider,
84 final Frame reference, final String name) {
85 this.type = type;
86 this.provider = provider;
87 this.reference = reference;
88 this.name = name;
89 }
90
91 /** {@inheritDoc} */
92 public Transform getTransform(final AbsoluteDate date) {
93 return type.transformFromInertial(date, provider.getPVCoordinates(date, reference));
94 }
95
96 /**
97 * This method is not implemented.
98 *
99 * <p> {@inheritDoc}
100 *
101 * @throws UnsupportedOperationException always.
102 */
103 public <T extends CalculusFieldElement<T>> FieldTransform<T> getTransform(
104 final FieldAbsoluteDate<T> date) throws UnsupportedOperationException {
105 throw new UnsupportedOperationException(
106 "FieldTransforms are not supported for a LocalOrbitalFrame: " + name +
107 ". Please contact orekit-developers@orekit.org if you " +
108 "would like to add this feature.");
109 }
110
111 }
112
113 }