SP3Segment.java

  1. /* Copyright Luc Maisonobe
  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.files.sp3;

  18. import java.util.ArrayList;
  19. import java.util.Collections;
  20. import java.util.List;

  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.files.general.EphemerisFile;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.propagation.BoundedPropagator;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.utils.CartesianDerivativesFilter;

  27. /** One segment of an {@link SP3Ephemeris}.
  28.  * @author Thomas Neidhart
  29.  * @author Evan Ward
  30.  * @author Luc Maisonobe
  31.  * @since 12.0
  32.  */
  33. public class SP3Segment implements EphemerisFile.EphemerisSegment<SP3Coordinate> {

  34.     /** Standard gravitational parameter in m³ / s². */
  35.     private final double mu;

  36.     /** Reference frame. */
  37.     private final Frame frame;

  38.     /** Number of points to use for interpolation. */
  39.     private final int interpolationSamples;

  40.     /** Available derivatives. */
  41.     private final CartesianDerivativesFilter filter;

  42.     /** Ephemeris Data. */
  43.     private final List<SP3Coordinate> coordinates;

  44.     /** Simple constructor.
  45.      * @param mu standard gravitational parameter to use for creating
  46.      * {@link org.orekit.orbits.Orbit Orbits} from the ephemeris data.
  47.      * @param frame reference frame
  48.      * @param interpolationSamples number of points to use for interpolation
  49.      * @param filter available derivatives
  50.      */
  51.     public SP3Segment(final double mu, final Frame frame,
  52.                       final int interpolationSamples, final CartesianDerivativesFilter filter) {
  53.         this.mu                   = mu;
  54.         this.frame                = frame;
  55.         this.interpolationSamples = interpolationSamples;
  56.         this.filter               = filter;
  57.         this.coordinates          = new ArrayList<>();
  58.     }

  59.     /** {@inheritDoc} */
  60.     @Override
  61.     public double getMu() {
  62.         return mu;
  63.     }

  64.     /** {@inheritDoc} */
  65.     @Override
  66.     public AbsoluteDate getStart() {
  67.         return coordinates.get(0).getDate();
  68.     }

  69.     /** {@inheritDoc} */
  70.     @Override
  71.     public AbsoluteDate getStop() {
  72.         return coordinates.get(coordinates.size() - 1).getDate();
  73.     }

  74.     /** {@inheritDoc} */
  75.     @Override
  76.     public Frame getFrame() {
  77.         return frame;
  78.     }

  79.     /** {@inheritDoc} */
  80.     @Override
  81.     public int getInterpolationSamples() {
  82.         return interpolationSamples;
  83.     }

  84.     /** {@inheritDoc} */
  85.     @Override
  86.     public CartesianDerivativesFilter getAvailableDerivatives() {
  87.         return filter;
  88.     }

  89.     /** {@inheritDoc} */
  90.     @Override
  91.     public List<SP3Coordinate> getCoordinates() {
  92.         return Collections.unmodifiableList(this.coordinates);
  93.     }

  94.     /** Adds a new P/V coordinate.
  95.      * @param coord the P/V coordinate of the satellite
  96.      */
  97.     public void addCoordinate(final SP3Coordinate coord) {
  98.         coordinates.add(coord);
  99.     }

  100.     /** {@inheritDoc} */
  101.     @Override
  102.     public BoundedPropagator getPropagator() {
  103.         return EphemerisFile.EphemerisSegment.super.getPropagator();
  104.     }

  105.     /** {@inheritDoc} */
  106.     @Override
  107.     public BoundedPropagator getPropagator(final AttitudeProvider attitudeProvider) {
  108.         return EphemerisFile.EphemerisSegment.super.getPropagator(attitudeProvider);
  109.     }

  110. }