1   /* Copyright 2002-2025 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.estimation.sequential;
18  
19  import org.hipparchus.filtering.kalman.Measurement;
20  import org.hipparchus.linear.MatrixUtils;
21  import org.hipparchus.linear.RealMatrix;
22  import org.hipparchus.linear.RealVector;
23  import org.orekit.estimation.measurements.ObservedMeasurement;
24  import org.orekit.time.AbsoluteDate;
25  
26  
27  /** Decorator adding {@link Measurement} API to an {@link ObservedMeasurement}.
28   * @author Luc Maisonobe
29   * @since 9.2
30   */
31  public class MeasurementDecorator implements Measurement {
32  
33      /** Wrapped observed measurement. */
34      private final ObservedMeasurement<?> observedMeasurement;
35  
36      /** Covariance. */
37      private final RealMatrix covariance;
38  
39      /** Reference date. */
40      private final AbsoluteDate reference;
41  
42      /** Simple constructor.
43       * @param observedMeasurement observed measurement
44       * @param covariance measurement covariance
45       * @param reference reference date
46       */
47      public MeasurementDecorator(final ObservedMeasurement<?> observedMeasurement,
48                                  final RealMatrix covariance, final AbsoluteDate reference) {
49          this.observedMeasurement = observedMeasurement;
50          this.covariance          = covariance;
51          this.reference           = reference;
52      }
53  
54      /** Get the observed measurement.
55       * @return observed measurement
56       */
57      public ObservedMeasurement<?> getObservedMeasurement() {
58          return observedMeasurement;
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      public double getTime() {
64          return observedMeasurement.getDate().durationFrom(reference);
65      }
66  
67      /** {@inheritDoc} */
68      @Override
69      public RealVector getValue() {
70          return MatrixUtils.createRealVector(observedMeasurement.getObservedValue());
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public RealMatrix getCovariance() {
76          return covariance;
77      }
78  
79  }