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.files.rinex.navigation.parsers.ionosphere;
18  
19  import org.orekit.files.rinex.navigation.IonosphereBaseMessage;
20  import org.orekit.files.rinex.navigation.IonosphereNavICKlobucharMessage;
21  import org.orekit.files.rinex.navigation.RinexNavigation;
22  import org.orekit.files.rinex.navigation.parsers.ParseInfo;
23  import org.orekit.files.rinex.navigation.parsers.RecordLineParser;
24  import org.orekit.utils.units.Unit;
25  
26  /** Parser for NavIC Klobuchar ionosphere.
27   * @author Luc Maisonobe
28   * @since 14.0
29   */
30  public class NavICKlobucharParser
31      extends RecordLineParser {
32  
33      /** Container for parsing data. */
34      private final ParseInfo parseInfo;
35  
36      /** Container for NavIC Klobuchar message. */
37      private final IonosphereNavICKlobucharMessage message;
38  
39      /** Simple constructor.
40       * @param parseInfo container for parsing data
41       * @param message container for navigation message
42       */
43      public NavICKlobucharParser(final ParseInfo parseInfo, final IonosphereNavICKlobucharMessage message) {
44          this.parseInfo = parseInfo;
45          this.message   = message;
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public void parseLine00() {
51          message.setTransmitTime(parseInfo.parseDate(message.getSystem()));
52          message.setIOD(parseInfo.parseDouble2(Unit.ONE));
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      public void parseLine01() {
58          message.setAlphaI(0, parseInfo.parseDouble1(IonosphereBaseMessage.S_PER_SC_N0));
59          message.setAlphaI(1, parseInfo.parseDouble2(IonosphereBaseMessage.S_PER_SC_N1));
60          message.setAlphaI(2, parseInfo.parseDouble3(IonosphereBaseMessage.S_PER_SC_N2));
61          message.setAlphaI(3, parseInfo.parseDouble4(IonosphereBaseMessage.S_PER_SC_N3));
62      }
63  
64      /** {@inheritDoc} */
65      @Override
66      public void parseLine02() {
67          message.setBetaI(0, parseInfo.parseDouble1(IonosphereBaseMessage.S_PER_SC_N0));
68          message.setBetaI(1, parseInfo.parseDouble2(IonosphereBaseMessage.S_PER_SC_N1));
69          message.setBetaI(2, parseInfo.parseDouble3(IonosphereBaseMessage.S_PER_SC_N2));
70          message.setBetaI(3, parseInfo.parseDouble4(IonosphereBaseMessage.S_PER_SC_N3));
71      }
72  
73      /** {@inheritDoc} */
74      @Override
75      public void parseLine03() {
76          message.setLonMin(parseInfo.parseDouble1(Unit.DEGREE));
77          message.setLonMax(parseInfo.parseDouble2(Unit.DEGREE));
78          message.setModipMin(parseInfo.parseDouble3(Unit.DEGREE));
79          message.setModipMax(parseInfo.parseDouble4(Unit.DEGREE));
80          parseInfo.closePendingRecord();
81      }
82  
83      /** {@inheritDoc} */
84      @Override
85      public void closeRecord(final RinexNavigation file) {
86          file.addNavICKlobucharMessage(message);
87      }
88  
89  }