1   /* Copyright 2013-2019 CS Systèmes d'Information
2    * Licensed to CS Systèmes d'Information (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.adjustment.measurements;
18  
19  import java.util.Collections;
20  import java.util.Map;
21  import java.util.Set;
22  
23  import org.orekit.bodies.GeodeticPoint;
24  import org.orekit.rugged.linesensor.SensorPixel;
25  
26  /** Container for mapping between sensor pixels and ground points.
27   * @see SensorMapping
28   * @author Luc Maisonobe
29   * @author Lucie Labat-Allee
30   * @author Guylaine Prat
31   * @since 2.0
32   */
33  public class SensorToGroundMapping {
34  
35      /** Default name for Rugged. */
36      private static final String RUGGED = "Rugged";
37  
38      /** Name of the sensor to which mapping applies. */
39      private final String sensorName;
40  
41      /** Mapping from sensor to ground. */
42      private final SensorMapping<GeodeticPoint> groundMapping;
43  
44  
45      /** Build a new instance (with default Rugged name).
46       * @param sensorName name of the sensor to which mapping applies
47       */
48      public SensorToGroundMapping(final String sensorName) {
49          this(RUGGED, sensorName);
50      }
51  
52      /** Build a new instance with a specific Rugged name.
53       * @param ruggedName name of the Rugged to which mapping applies
54       * @param sensorName name of the sensor to which mapping applies
55       */
56      public SensorToGroundMapping(final String ruggedName, final String sensorName) {
57  
58          this.sensorName     = sensorName;
59          this.groundMapping = new SensorMapping<GeodeticPoint>(sensorName, ruggedName);
60      }
61  
62      /** Get the name of the sensor to which mapping applies.
63       * @return name of the sensor to which mapping applies
64       */
65      public String getSensorName() {
66          return sensorName;
67      }
68  
69      /** Get the name of the Rugged to which mapping applies.
70       * @return name of the Rugged to which mapping applies
71       */
72      public String getRuggedName() {
73          return this.groundMapping.getRuggedName();
74      }
75  
76      /** Add a mapping between one sensor pixel and one ground point.
77       * @param pixel sensor pixel
78       * @param groundPoint ground point corresponding to the sensor pixel
79       */
80      public void addMapping(final SensorPixel pixel, final GeodeticPoint groundPoint) {
81          groundMapping.addMapping(pixel, groundPoint);
82      }
83  
84      /** Get all the mapping entries.
85       * @return an unmodifiable view of all mapping entries
86       */
87      public Set<Map.Entry<SensorPixel, GeodeticPoint>> getMapping() {
88          return Collections.unmodifiableSet(groundMapping.getMapping());
89      }
90  }