1   /* Copyright 2002-2026 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.propagation.analytical.gnss;
18  
19  import org.orekit.attitudes.FrameAlignedProvider;
20  import org.orekit.frames.Frame;
21  import org.orekit.orbits.PositionAngleType;
22  import org.orekit.propagation.Propagator;
23  import org.orekit.propagation.analytical.gnss.data.GNSSOrbitalElements;
24  import org.orekit.propagation.conversion.AbstractAnalyticalPropagatorBuilder;
25  
26  /**
27   * Builder for {@link GNSSPropagator}.
28   * @author Pascal Parraud
29   * @author Luc Maisonobe
30   * @since 11.0
31   */
32  public class GNSSPropagatorBuilder extends AbstractAnalyticalPropagatorBuilder<GNSSPropagator> {
33  
34      /** The GNSS propagation model orbital elements. */
35      private final GNSSOrbitalElements<?> orbitalElements;
36  
37      /** The body-fixed frame. */
38      private final Frame bodyFixed;
39  
40      /** Initializes the builder.
41       * <p>The GNSS orbital elements and frames are the only requested parameters to build a GNSSPropagator.</p>
42       * <p>The attitude provider is set by default to be aligned with the provided inertial frame.<br>
43       * The mass is set by default to the
44       *  {@link org.orekit.propagation.Propagator#DEFAULT_MASS DEFAULT_MASS}.
45       * </p>
46       *
47       * @param orbitalElements orbital elements
48       * @param inertial inertial frame, use to provide the propagated orbit
49       * @param bodyFixed body fixed frame, corresponding to the navigation message
50       */
51      public GNSSPropagatorBuilder(final GNSSOrbitalElements<?> orbitalElements,
52                                   final Frame inertial, final Frame bodyFixed) {
53          super(new GNSSPropagator(orbitalElements, inertial, bodyFixed,
54                                   FrameAlignedProvider.of(inertial),
55                                   Propagator.DEFAULT_MASS).
56                getInitialState().
57                getOrbit(),
58                PositionAngleType.TRUE,
59                1.0,
60                false,
61                FrameAlignedProvider.of(inertial),
62                Propagator.DEFAULT_MASS);
63          this.orbitalElements = orbitalElements;
64          this.bodyFixed       = bodyFixed;
65          addSupportedParameters(orbitalElements.getParametersDrivers());
66      }
67  
68      /**  {@inheritDoc} */
69      @Override
70      public GNSSPropagator buildPropagator(final double[] normalizedParameters) {
71          setParameters(normalizedParameters);
72          return new GNSSPropagator(orbitalElements, getFrame(), bodyFixed, getAttitudeProvider(), getMass());
73      }
74  
75  }