BoundedPVCoordinatesProvider.java

  1. /* Copyright 2022-2025 Romain Serra
  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.utils;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.orekit.frames.Frame;
  20. import org.orekit.time.AbsoluteDate;
  21. import org.orekit.time.TimeInterval;

  22. /**
  23.  * Interface for bounded PV coordinates providers.
  24.  *
  25.  * @author Romain Serra
  26.  * @since 13.1
  27.  * @see PVCoordinatesProvider
  28.  */
  29. public interface BoundedPVCoordinatesProvider extends PVCoordinatesProvider {

  30.     /** Get the first date of the range.
  31.      * @return the first date of the range
  32.      */
  33.     AbsoluteDate getMinDate();

  34.     /** Get the last date of the range.
  35.      * @return the last date of the range
  36.      */
  37.     AbsoluteDate getMaxDate();

  38.     /**
  39.      * Bound a given coordinates provider.
  40.      * @param interval time interval
  41.      * @param provider input provider
  42.      * @return bounded provider
  43.      */
  44.     static BoundedPVCoordinatesProvider of( final PVCoordinatesProvider provider, final TimeInterval interval) {
  45.         return new BoundedPVCoordinatesProvider() {
  46.             @Override
  47.             public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) {
  48.                 return provider.getPVCoordinates(date, frame);
  49.             }

  50.             @Override
  51.             public Vector3D getPosition(final AbsoluteDate date, final Frame frame) {
  52.                 return provider.getPosition(date, frame);
  53.             }

  54.             @Override
  55.             public AbsoluteDate getMinDate() {
  56.                 return interval.getStartDate();
  57.             }

  58.             @Override
  59.             public AbsoluteDate getMaxDate() {
  60.                 return interval.getEndDate();
  61.             }
  62.         };
  63.     }
  64. }