1   /* Copyright 2002-2024 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.cdm;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.files.ccsds.ndm.odm.StateVectorKey;
21  import org.orekit.files.ccsds.section.CommentsContainer;
22  
23  /**
24   * Container for state vector data.
25   * @author Melina Vanel
26   * @since 11.2
27   */
28  public class StateVector extends CommentsContainer {
29  
30      /** Object Position Vector X component. */
31      private double x;
32  
33      /** Object Position Vector Y component. */
34      private double y;
35  
36      /** Object Position Vector Z component. */
37      private double z;
38  
39      /** Object Velocity Vector X component. */
40      private double xDot;
41  
42      /** Object Velocity Vector Y component. */
43      private double yDot;
44  
45      /** Object Velocity Vector Z component. */
46      private double zDot;
47  
48      /** Simple constructor.
49       */
50      public StateVector() {
51          x         = Double.NaN;
52          y         = Double.NaN;
53          z         = Double.NaN;
54          xDot      = Double.NaN;
55          yDot      = Double.NaN;
56          zDot      = Double.NaN;
57      }
58  
59      /** {@inheritDoc} */
60      @Override
61      public void validate(final double version) {
62          super.validate(version);
63          checkNotNaN(x, StateVectorKey.X.name());
64          checkNotNaN(y, StateVectorKey.Y.name());
65          checkNotNaN(z, StateVectorKey.Z.name());
66          checkNotNaN(xDot, StateVectorKey.X_DOT.name());
67          checkNotNaN(yDot, StateVectorKey.Y_DOT.name());
68          checkNotNaN(zDot, StateVectorKey.Z_DOT.name());
69  
70      }
71  
72      /**
73       * Set object Position Vector X component.
74       * @param X object Position Vector X component (in m)
75       */
76      public void setX(final double X) {
77          refuseFurtherComments();
78          this.x = X;
79      }
80  
81      /**
82       * Set object Position Vector Y component.
83       * @param Y object Position Vector Y component (in m)
84       */
85      public void setY(final double Y) {
86          refuseFurtherComments();
87          this.y = Y;
88      }
89  
90      /**
91       * Set object Position Vector Z component.
92       * @param Z object Position Vector Z component (in m)
93       */
94      public void setZ(final double Z) {
95          refuseFurtherComments();
96          this.z = Z;
97      }
98  
99      /**
100      * Set object Velocity Vector X component.
101      * @param Xdot object Velocity Vector X component (in m/s)
102      */
103     public void setXdot(final double Xdot) {
104         refuseFurtherComments();
105         this.xDot = Xdot;
106     }
107 
108     /**
109      * Set object Velocity Vector Y component.
110      * @param Ydot object Velocity Vector Y component (in m/s)
111      */
112     public void setYdot(final double Ydot) {
113         refuseFurtherComments();
114         this.yDot = Ydot;
115     }
116 
117     /**
118      * Set object Velocity Vector Z component.
119      * @param Zdot object Velocity Vector Z component (in m/s)
120      */
121     public void setZdot(final double Zdot) {
122         refuseFurtherComments();
123         this.zDot = Zdot;
124     }
125 
126     /**
127      * Get object Position Vector.
128      * @return object Position Vector (in m)
129      */
130     public Vector3D getPositionVector() {
131         return new Vector3D(x, y, z);
132     }
133 
134     /**
135      * Get object Velocity Vector.
136      * @return object Velocity Vector (in m/s)
137      */
138     public Vector3D getVelocityVector() {
139         return new Vector3D(xDot, yDot, zDot);
140     }
141 
142 
143 }