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