1   /* Copyright 2013-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.rugged.intersection;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.rugged.api.AlgorithmId;
21  import org.orekit.rugged.errors.DumpManager;
22  import org.orekit.rugged.utils.ExtendedEllipsoid;
23  import org.orekit.rugged.utils.NormalizedGeodeticPoint;
24  
25  /** Intersection ignoring Digital Elevation Model.
26   * <p>
27   * This dummy implementation simply uses the ellipsoid itself.
28   * </p>
29   * @author Luc Maisonobe
30   * @author Guylaine Prat
31   */
32  public class IgnoreDEMAlgorithm implements IntersectionAlgorithm {
33  
34      /** Algorithm Id.
35       * @since 2.2 */
36      private final AlgorithmId algorithmId;
37  
38      /** Simple constructor.
39       */
40      public IgnoreDEMAlgorithm() {
41          this.algorithmId = AlgorithmId.IGNORE_DEM_USE_ELLIPSOID;
42      }
43  
44      /** {@inheritDoc} */
45      @Override
46      public NormalizedGeodeticPoint intersection(final ExtendedEllipsoid ellipsoid,
47                                                  final Vector3D position, final Vector3D los) {
48          DumpManager.dumpAlgorithm(this.algorithmId);
49          return ellipsoid.pointOnGround(position, los, 0.0);
50      }
51  
52      /** {@inheritDoc} */
53      @Override
54      public NormalizedGeodeticPoint refineIntersection(final ExtendedEllipsoid ellipsoid,
55                                                        final Vector3D position, final Vector3D los,
56                                                        final NormalizedGeodeticPoint closeGuess) {
57          DumpManager.dumpAlgorithm(this.algorithmId);
58          return intersection(ellipsoid, position, los);
59      }
60  
61      /** {@inheritDoc}
62       * <p>
63       * As this algorithm ignored the Digital Elevation Model,
64       * this method always returns 0.0.
65       * </p>
66       */
67      @Override
68      public double getElevation(final double latitude, final double longitude) {
69          DumpManager.dumpAlgorithm(this.algorithmId);
70          return 0.0;
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public AlgorithmId getAlgorithmId() {
76          return this.algorithmId;
77      }
78  }