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 package org.orekit.files.ccsds.ndm.adm;
18
19 import org.orekit.bodies.CelestialBodies;
20 import org.orekit.bodies.CelestialBody;
21 import org.orekit.files.ccsds.definitions.BodyFacade;
22 import org.orekit.files.ccsds.definitions.CcsdsFrameMapper;
23 import org.orekit.files.ccsds.section.Metadata;
24 import org.orekit.frames.Frame;
25
26 /** This class gathers the meta-data present in the Attitude Data Message (ADM).
27 * @author Bryan Cazabonne
28 * @since 10.2
29 */
30 public class AdmMetadata extends Metadata {
31
32 /** Spacecraft name for which the attitude data are provided. */
33 private String objectName;
34
35 /** Object identifier of the object for which the attitude data are provided. */
36 private String objectID;
37
38 /** Body at origin of reference frame. */
39 private BodyFacade center;
40
41 /**
42 * Simple constructor.
43 *
44 * @param frameMapper for creating an Orekit {@link Frame}.
45 * @since 13.1.5
46 */
47 public AdmMetadata(final CcsdsFrameMapper frameMapper) {
48 super(null, frameMapper);
49 }
50
51 /** {@inheritDoc} */
52 @Override
53 public void validate(final double version) {
54 super.validate(version);
55 checkNotNull(objectName, AdmMetadataKey.OBJECT_NAME.name());
56 checkNotNull(objectID, AdmCommonMetadataKey.OBJECT_ID.name());
57 }
58
59 /**
60 * Get the spacecraft name for which the attitude data are provided.
61 * @return the spacecraft name
62 */
63 public String getObjectName() {
64 return objectName;
65 }
66
67 /**
68 * Set the spacecraft name for which the attitude data are provided.
69 * @param objectName the spacecraft name to be set
70 */
71 public void setObjectName(final String objectName) {
72 refuseFurtherComments();
73 this.objectName = objectName;
74 }
75
76 /**
77 * Get the spacecraft ID for which the attitude data are provided.
78 * @return the spacecraft ID
79 */
80 public String getObjectID() {
81 return objectID;
82 }
83
84 /**
85 * Set the spacecraft ID for which the attitude data are provided.
86 * @param objectID the spacecraft ID to be set
87 */
88 public void setObjectID(final String objectID) {
89 refuseFurtherComments();
90 this.objectID = objectID;
91 }
92
93 /** Get the launch year.
94 * @return launch year
95 */
96 public int getLaunchYear() {
97 return getLaunchYear(objectID);
98 }
99
100 /** Get the launch number.
101 * @return launch number
102 */
103 public int getLaunchNumber() {
104 return getLaunchNumber(objectID);
105 }
106
107 /** Get the piece of launch.
108 * @return piece of launch
109 */
110 public String getLaunchPiece() {
111 return getLaunchPiece(objectID);
112 }
113
114 /** Get the body at origin of reference frame.
115 * @return the body at origin of reference frame.
116 */
117 public BodyFacade getCenter() {
118 return center;
119 }
120
121 /** Set the body at origin of reference frame.
122 * @param center body at origin of reference frame
123 */
124 public void setCenter(final BodyFacade center) {
125 refuseFurtherComments();
126 this.center = center;
127 }
128
129 /**
130 * Get boolean testing whether the body corresponding to the centerName
131 * attribute can be created through the {@link CelestialBodies}.
132 * @return true if {@link CelestialBody} can be created from centerName
133 * false otherwise
134 */
135 public boolean getHasCreatableBody() {
136 return center != null && center.getBody() != null;
137 }
138
139 }