1   /* Copyright 2002-2021 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.files.sinex;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import org.hipparchus.geometry.euclidean.threed.Vector3D;
23  import org.orekit.time.AbsoluteDate;
24  
25  /**
26   * Station model.
27   * @author Bryan Cazabonne
28   * @since 10.3
29   */
30  public class Station {
31  
32      /** Site code. */
33      private String siteCode;
34  
35      /** DOMES number. */
36      private String domes;
37  
38      /** Start of validity. */
39      private AbsoluteDate validFrom;
40  
41      /** End of validity. */
42      private AbsoluteDate validUntil;
43  
44      /** Eccentricity reference system. */
45      private ReferenceSystem eccRefSystem;
46  
47      /** Site antenna eccentricity (m). */
48      private Vector3D eccentricities;
49  
50      /** Station position. */
51      private Vector3D position;
52  
53      /** Station velocity. */
54      private Vector3D velocity;
55  
56      /** Coordinates reference epoch. */
57      private AbsoluteDate epoch;
58  
59      /**
60       * Constructor.
61       */
62      public Station() {
63          this.eccentricities = Vector3D.ZERO;
64          this.position       = Vector3D.ZERO;
65          this.velocity       = Vector3D.ZERO;
66      }
67  
68      /**
69       * Get the site code (station identifier).
70       * @return the site code
71       */
72      public String getSiteCode() {
73          return siteCode;
74      }
75  
76      /**
77       * Set the site code (station identifier).
78       * @param siteCode the site code to set
79       */
80      public void setSiteCode(final String siteCode) {
81          this.siteCode = siteCode;
82      }
83  
84      /**
85       * Get the site DOMES number.
86       * @return the DOMES number
87       */
88      public String getDomes() {
89          return domes;
90      }
91  
92      /**
93       * Set the DOMES number.
94       * @param domes the DOMES number to set
95       */
96      public void setDomes(final String domes) {
97          this.domes = domes;
98      }
99  
100     /**
101      * Get start of validity.
102      * @return start of validity
103      */
104     public AbsoluteDate getValidFrom() {
105         return validFrom;
106     }
107 
108     /**
109      * Set the start of validity.
110      * @param validFrom the start of validity to set
111      */
112     public void setValidFrom(final AbsoluteDate validFrom) {
113         this.validFrom = validFrom;
114     }
115 
116     /**
117      * Get end of validity.
118      * @return end of validity
119      */
120     public AbsoluteDate getValidUntil() {
121         return validUntil;
122     }
123 
124     /**
125      * Set the end of validity.
126      * @param validUntil the end of validity to set
127      */
128     public void setValidUntil(final AbsoluteDate validUntil) {
129         this.validUntil = validUntil;
130     }
131 
132     /**
133      * Get the reference system used to define the eccentricity vector (local or cartesian).
134      * @return the reference system used to define the eccentricity vector
135      */
136     public ReferenceSystem getEccRefSystem() {
137         return eccRefSystem;
138     }
139 
140     /**
141      * Set the reference system used to define the eccentricity vector (local or cartesian).
142      * @param eccRefSystem the reference system used to define the eccentricity vector
143      */
144     public void setEccRefSystem(final ReferenceSystem eccRefSystem) {
145         this.eccRefSystem = eccRefSystem;
146     }
147 
148     /**
149      * Get the station antenna eccentricities.
150      * <p>
151      * Vector convention: X-Y-Z or UP-NORTH-EAST
152      * </p>
153      * @return station antenna eccentricities (m)
154      */
155     public Vector3D getEccentricities() {
156         return eccentricities;
157     }
158 
159     /**
160      * Set the station antenna eccentricities.
161      * @param eccentricities the eccenticities to set (m)
162      */
163     public void setEccentricities(final Vector3D eccentricities) {
164         this.eccentricities = eccentricities;
165     }
166 
167     /**
168      * Get the station position.
169      * @return the station position (m)
170      */
171     public Vector3D getPosition() {
172         return position;
173     }
174 
175     /**
176      * Set the station position.
177      * @param position the position to set
178      */
179     public void setPosition(final Vector3D position) {
180         this.position = position;
181     }
182 
183     /**
184      * Get the station velocity.
185      * @return the station velocity (m/s)
186      */
187     public Vector3D getVelocity() {
188         return velocity;
189     }
190 
191     /**
192      * Set the station velocity.
193      * @param velocity the velocity to set
194      */
195     public void setVelocity(final Vector3D velocity) {
196         this.velocity = velocity;
197     }
198 
199     /**
200      * Get the coordinates reference epoch.
201      * @return the coordinates reference epoch
202      */
203     public AbsoluteDate getEpoch() {
204         return epoch;
205     }
206 
207     /**
208      * Set the coordinates reference epoch.
209      * @param epoch the epoch to set
210      */
211     public void setEpoch(final AbsoluteDate epoch) {
212         this.epoch = epoch;
213     }
214 
215     /** Eccentricity reference system. */
216     public enum ReferenceSystem {
217 
218         /** Local reference system Up, North, East. */
219         UNE("UNE"),
220 
221         /** Cartesian reference system X, Y, Z. */
222         XYZ("XYZ");
223 
224         /** Codes map. */
225         private static final Map<String, ReferenceSystem> CODES_MAP = new HashMap<>();
226         static {
227             for (final ReferenceSystem type : values()) {
228                 CODES_MAP.put(type.getName(), type);
229             }
230         }
231 
232         /** Name used to define the reference system in SINEX file. */
233         private final String name;
234 
235         /**
236          * Constructor.
237          * @param name name used to define the reference system in SINEX file
238          */
239         ReferenceSystem(final String name) {
240             this.name = name;
241         }
242 
243         /**
244          * Get the name used to define the reference system in SINEX file.
245          * @return the name
246          */
247         public String getName() {
248             return name;
249         }
250 
251         /**
252          * Get the eccentricity reference system corresponding to the given value.
253          * @param value given value
254          * @return the corresponding eccentricity reference system
255          */
256         public static ReferenceSystem getEccRefSystem(final String value) {
257             return CODES_MAP.get(value);
258         }
259 
260     }
261 
262 }
263