1   /* Copyright 2002-2020 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.ccsds;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.orekit.bodies.CelestialBodies;
24  import org.orekit.bodies.CelestialBody;
25  import org.orekit.time.TimeScale;
26  
27  /** This class gathers the meta-data present in the Attitude Data Message (ADM).
28   * @author Bryan Cazabonne
29   * @since 10.2
30   */
31  public class ADMMetaData {
32  
33      /** ADM file to which these meta-data belong. */
34      private final ADMFile admFile;
35  
36      /** Time System: used for metadata and attitude data data. */
37      private CcsdsTimeScale timeSystem;
38  
39      /** Spacecraft name for which the attitude data are provided. */
40      private String objectName;
41  
42      /** Object identifier of the object for which the attitude data are provided. */
43      private String objectID;
44  
45      /** Launch Year. */
46      private int launchYear;
47  
48      /** Launch number. */
49      private int launchNumber;
50  
51      /** Piece of launch (from "A" to "ZZZ"). */
52      private String launchPiece;
53  
54      /** Origin of reference frame. */
55      private String centerName;
56  
57      /** Celestial body corresponding to the center name. */
58      private CelestialBody centerBody;
59  
60      /** Tests whether the body corresponding to the center name can be
61       * created through {@link CelestialBodies} in order to obtain the
62       * corresponding gravitational coefficient. */
63      private boolean hasCreatableBody;
64  
65      /** Metadata comments. The list contains a string for each line of comment. */
66      private List<String> comment;
67  
68      /**
69       * Create a new meta-data.
70       * @param admFile ADM file to which these meta-data belong
71       */
72      public ADMMetaData(final ADMFile admFile) {
73          this.admFile = admFile;
74          comment = new ArrayList<String>();
75      }
76  
77      /**
78       * Get the ADM file to which these meta-data belong.
79       * @return ADM file to which these meta-data belong
80       */
81      public ADMFile getADMFile() {
82          return admFile;
83      }
84  
85      /**
86       * Get the Time System.
87       * @return the time system
88       */
89      public CcsdsTimeScale getTimeSystem() {
90          return timeSystem;
91      }
92  
93      /**
94       * Set the Time System.
95       * @param timeSystem the time system to be set
96       */
97      public void setTimeSystem(final CcsdsTimeScale timeSystem) {
98          this.timeSystem = timeSystem;
99      }
100 
101     /**
102      * Get the time scale.
103      * @return the time scale.
104      * @see #getTimeSystem()
105      */
106     public TimeScale getTimeScale() {
107         return getTimeSystem().getTimeScale(
108                 admFile.getConventions(),
109                 admFile.getDataContext().getTimeScales());
110     }
111 
112     /**
113      * Get the spacecraft name for which the attitude data are provided.
114      * @return the spacecraft name
115      */
116     public String getObjectName() {
117         return objectName;
118     }
119 
120     /**
121      * Set the spacecraft name for which the attitude data are provided.
122      * @param objectName the spacecraft name to be set
123      */
124     public void setObjectName(final String objectName) {
125         this.objectName = objectName;
126     }
127 
128     /**
129      * Get the spacecraft ID for which the attitude data are provided.
130      * @return the spacecraft ID
131      */
132     public String getObjectID() {
133         return objectID;
134     }
135 
136     /**
137      * Set the spacecraft ID for which the attitude data are provided.
138      * @param objectID the spacecraft ID to be set
139      */
140     public void setObjectID(final String objectID) {
141         this.objectID = objectID;
142     }
143 
144     /**
145      * Get the launch year.
146      * @return launch year
147      */
148     public int getLaunchYear() {
149         return launchYear;
150     }
151 
152     /**
153      * Set the launch year.
154      * @param launchYear launch year
155      */
156     public void setLaunchYear(final int launchYear) {
157         this.launchYear = launchYear;
158     }
159 
160     /**
161      * Get the launch number.
162      * @return launch number
163      */
164     public int getLaunchNumber() {
165         return launchNumber;
166     }
167 
168     /**
169      * Set the launch number.
170      * @param launchNumber launch number
171      */
172     public void setLaunchNumber(final int launchNumber) {
173         this.launchNumber = launchNumber;
174     }
175 
176     /**
177      * Get the piece of launch.
178      * @return piece of launch
179      */
180     public String getLaunchPiece() {
181         return launchPiece;
182     }
183 
184     /**
185      * Set the piece of launch.
186      * @param launchPiece piece of launch
187      */
188     public void setLaunchPiece(final String launchPiece) {
189         this.launchPiece = launchPiece;
190     }
191 
192     /** Get the origin of reference frame.
193      * @return the origin of reference frame.
194      */
195     public String getCenterName() {
196         return centerName;
197     }
198 
199     /** Set the origin of reference frame.
200      * @param centerName the origin of reference frame to be set
201      */
202     public void setCenterName(final String centerName) {
203         this.centerName = centerName;
204     }
205 
206     /**
207      * Get the {@link CelestialBody} corresponding to the center name.
208      * @return the center body
209      */
210     public CelestialBody getCenterBody() {
211         return centerBody;
212     }
213 
214     /**
215      * Set the {@link CelestialBody} corresponding to the center name.
216      * @param centerBody the {@link CelestialBody} to be set
217      */
218     public void setCenterBody(final CelestialBody centerBody) {
219         this.centerBody = centerBody;
220     }
221 
222     /**
223      * Get boolean testing whether the body corresponding to the centerName
224      * attribute can be created through the {@link CelestialBodies}.
225      * @return true if {@link CelestialBody} can be created from centerName
226      *         false otherwise
227      */
228     public boolean getHasCreatableBody() {
229         return hasCreatableBody;
230     }
231 
232     /**
233      * Set boolean testing whether the body corresponding to the centerName
234      * attribute can be created through the {@link CelestialBodies}.
235      * @param hasCreatableBody the boolean to be set.
236      */
237     public void setHasCreatableBody(final boolean hasCreatableBody) {
238         this.hasCreatableBody = hasCreatableBody;
239     }
240 
241     /** Get the meta-data comment.
242      * @return meta-data comment
243      */
244     public List<String> getComment() {
245         return Collections.unmodifiableList(comment);
246     }
247 
248     /** Set the meta-data comment.
249      * @param comment comment to set
250      */
251     public void setComment(final List<String> comment) {
252         this.comment = new ArrayList<String>(comment);
253     }
254 
255 }