1 /* Copyright 2002-2026 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
18 package org.orekit.files.ccsds.ndm.odm.oem;
19
20 import org.orekit.files.ccsds.definitions.CcsdsFrameMapper;
21 import org.orekit.files.ccsds.ndm.odm.OdmCommonMetadata;
22 import org.orekit.frames.Frame;
23 import org.orekit.time.AbsoluteDate;
24
25 /** Metadata for Orbit Ephemeris Messages.
26 * @author Luc Maisonobe
27 * @since 11.0
28 */
29 public class OemMetadata extends OdmCommonMetadata {
30
31 /** Start of total time span covered by ephemerides data and covariance data. */
32 private AbsoluteDate startTime;
33
34 /** End of total time span covered by ephemerides data and covariance data. */
35 private AbsoluteDate stopTime;
36
37 /** Start of useable time span covered by ephemerides data, it may be
38 * necessary to allow for proper interpolation. */
39 private AbsoluteDate useableStartTime;
40
41 /** End of useable time span covered by ephemerides data, it may be
42 * necessary to allow for proper interpolation. */
43 private AbsoluteDate useableStopTime;
44
45 /** The interpolation method to be used. */
46 private InterpolationMethod interpolationMethod;
47
48 /** The interpolation degree. */
49 private int interpolationDegree;
50
51 /**
52 * Simple constructor.
53 *
54 * @param defaultInterpolationDegree default interpolation degree
55 * @param frameMapper for creating a {@link Frame}.
56 * @since 13.1.5
57 */
58 public OemMetadata(final int defaultInterpolationDegree,
59 final CcsdsFrameMapper frameMapper) {
60 super(frameMapper);
61 this.interpolationDegree = defaultInterpolationDegree;
62 }
63
64 /** {@inheritDoc} */
65 @Override
66 public void validate(final double version) {
67 checkMandatoryEntriesExceptDates(version);
68 checkNotNull(startTime, OemMetadataKey.START_TIME.name());
69 checkNotNull(stopTime, OemMetadataKey.STOP_TIME.name());
70 }
71
72 /** Check is mandatory entries EXCEPT DATES have been initialized.
73 * <p>
74 * This method should throw an exception if some mandatory entry is missing
75 * </p>
76 * @param version format version
77 */
78 void checkMandatoryEntriesExceptDates(final double version) {
79 super.validate(version);
80 }
81
82 /** Get start of total time span covered by ephemerides data and
83 * covariance data.
84 * @return the start time
85 */
86 public AbsoluteDate getStartTime() {
87 return startTime;
88 }
89
90 /** Set start of total time span covered by ephemerides data and
91 * covariance data.
92 * @param startTime the time to be set
93 */
94 public void setStartTime(final AbsoluteDate startTime) {
95 refuseFurtherComments();
96 this.startTime = startTime;
97 }
98
99 /** Get end of total time span covered by ephemerides data and covariance
100 * data.
101 * @return the stop time
102 */
103 public AbsoluteDate getStopTime() {
104 return stopTime;
105 }
106
107 /** Set end of total time span covered by ephemerides data and covariance
108 * data.
109 * @param stopTime the time to be set
110 */
111 public void setStopTime(final AbsoluteDate stopTime) {
112 refuseFurtherComments();
113 this.stopTime = stopTime;
114 }
115
116 /** Get start of useable time span covered by ephemerides data, it may be
117 * necessary to allow for proper interpolation.
118 * @return the useable start time
119 */
120 public AbsoluteDate getUseableStartTime() {
121 return useableStartTime;
122 }
123
124 /** Set start of useable time span covered by ephemerides data, it may be
125 * necessary to allow for proper interpolation.
126 * @param useableStartTime the time to be set
127 */
128 public void setUseableStartTime(final AbsoluteDate useableStartTime) {
129 refuseFurtherComments();
130 this.useableStartTime = useableStartTime;
131 }
132
133 /** Get end of useable time span covered by ephemerides data, it may be
134 * necessary to allow for proper interpolation.
135 * @return the useable stop time
136 */
137 public AbsoluteDate getUseableStopTime() {
138 return useableStopTime;
139 }
140
141 /** Set end of useable time span covered by ephemerides data, it may be
142 * necessary to allow for proper interpolation.
143 * @param useableStopTime the time to be set
144 */
145 public void setUseableStopTime(final AbsoluteDate useableStopTime) {
146 refuseFurtherComments();
147 this.useableStopTime = useableStopTime;
148 }
149
150 /** Get the interpolation method to be used.
151 * @return the interpolation method
152 */
153 public InterpolationMethod getInterpolationMethod() {
154 return interpolationMethod;
155 }
156
157 /** Set the interpolation method to be used.
158 * @param interpolationMethod the interpolation method to be set
159 */
160 public void setInterpolationMethod(final InterpolationMethod interpolationMethod) {
161 refuseFurtherComments();
162 this.interpolationMethod = interpolationMethod;
163 }
164
165 /** Get the interpolation degree.
166 * @return the interpolation degree
167 */
168 public int getInterpolationDegree() {
169 return interpolationDegree;
170 }
171
172 /** Set the interpolation degree.
173 * @param interpolationDegree the interpolation degree to be set
174 */
175 public void setInterpolationDegree(final int interpolationDegree) {
176 refuseFurtherComments();
177 this.interpolationDegree = interpolationDegree;
178 }
179
180 /** Copy the instance, making sure mandatory fields have been initialized.
181 * @param version format version
182 * @return a new copy
183 */
184 OemMetadata copy(final double version) {
185
186 checkMandatoryEntriesExceptDates(version);
187
188 // allocate new instance
189 final OemMetadata copy = new OemMetadata(
190 getInterpolationDegree(),
191 getFrameMapper());
192
193 // copy comments
194 for (String comment : getComments()) {
195 copy.addComment(comment);
196 }
197
198 // copy object
199 copy.setObjectName(getObjectName());
200 copy.setObjectID(getObjectID());
201 copy.setCenter(getCenter());
202
203 // copy frames
204 copy.setFrameEpoch(getFrameEpoch());
205 copy.setReferenceFrame(getReferenceFrame());
206
207 // copy time system only (ignore times themselves)
208 copy.setTimeSystem(getTimeSystem());
209
210 // copy interpolation (degree has already been set up at construction)
211 if (getInterpolationMethod() != null) {
212 copy.setInterpolationMethod(getInterpolationMethod());
213 }
214
215 return copy;
216
217 }
218
219 }
220
221
222