View Javadoc
1   /*
2    * Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.irurueta.navigation.geodesic;
17  
18  /**
19   * The results of geodesic calculations.
20   * This is used to return the results for a geodesic between point 1 (<i>lat1</i>, <i>lon1</i>)
21   * and point 2 (<i>lat2</i>, <i>lon2</i>).
22   * Fields that have not been set will be filled with Double.NaN.
23   * The returned GeodesicData objects always include the parameters provided to
24   * {@link Geodesic#direct(double, double, double, double)} and
25   * {@link Geodesic#inverse(double, double, double, double)} and it always includes the field
26   * <i>a12</i>.
27   */
28  public class GeodesicData {
29  
30      /**
31       * Latitude of point 1 (degrees).
32       */
33      private double lat1;
34  
35      /**
36       * Longitude of point 1 (degrees).
37       */
38      private double lon1;
39  
40      /**
41       * Azimuth at point 1 (degrees).
42       */
43      private double azi1;
44  
45      /**
46       * Latitude of point 2 (degrees).
47       */
48      private double lat2;
49  
50      /**
51       * Longitude of point 2 (degrees).
52       */
53      private double lon2;
54  
55      /**
56       * Azimuth at point 2 (degrees).
57       */
58      private double azi2;
59  
60      /**
61       * Distance between point 1 and point 2 (meters).
62       */
63      private double s12;
64  
65      /**
66       * Arc length on the auxiliary sphere between point 1 and point 2 (degrees).
67       */
68      private double a12;
69  
70      /**
71       * Reduced length of geodesic (meters).
72       */
73      private double m12;
74  
75      /**
76       * Geodesic scale of point 2 relative to point 1 (dimensionless).
77       */
78      private double scaleM12;
79  
80      /**
81       * Geodesic scale of point 1 relative to point 2 (dimensionless).
82       */
83      private double scaleM21;
84  
85      /**
86       * Area under the geodesic (meters<sup>2</sup>).
87       */
88      private double areaS12;
89  
90      /**
91       * Constructor.
92       * Initialize all the fields to Double.NaN.
93       */
94      public GeodesicData() {
95          lat1 = lon1 = azi1 = lat2 = lon2 = azi2 = s12 = a12 = m12 = scaleM12 = scaleM21 = areaS12 = Double.NaN;
96      }
97  
98      /**
99       * Gets latitude of point 1 (degrees).
100      *
101      * @return latitude of point 1.
102      */
103     public double getLat1() {
104         return lat1;
105     }
106 
107     /**
108      * Sets latitude of point 1 (degrees).
109      *
110      * @param lat1 latitude of point 1.
111      */
112     public void setLat1(final double lat1) {
113         this.lat1 = lat1;
114     }
115 
116     /**
117      * Gets longitude of point 1 (degrees).
118      *
119      * @return longitude of point 1.
120      */
121     public double getLon1() {
122         return lon1;
123     }
124 
125     /**
126      * Sets longitude of point 1 (degrees).
127      *
128      * @param lon1 longitude of point 1.
129      */
130     public void setLon1(final double lon1) {
131         this.lon1 = lon1;
132     }
133 
134     /**
135      * Gets azimuth at point 1 (degrees).
136      *
137      * @return azimuth at point 1.
138      */
139     public double getAzi1() {
140         return azi1;
141     }
142 
143     /**
144      * Sets azimuth at point 1 (degrees).
145      *
146      * @param azi1 azimuth at point 1.
147      */
148     public void setAzi1(final double azi1) {
149         this.azi1 = azi1;
150     }
151 
152     /**
153      * Gets latitude of point 2 (degrees).
154      *
155      * @return latitude of point 2.
156      */
157     public double getLat2() {
158         return lat2;
159     }
160 
161     /**
162      * Sets latitude of point 2 (degrees).
163      *
164      * @param lat2 latitude of point 2.
165      */
166     public void setLat2(final double lat2) {
167         this.lat2 = lat2;
168     }
169 
170     /**
171      * Gets longitude of point 2 (degrees).
172      *
173      * @return longitude of point 2.
174      */
175     public double getLon2() {
176         return lon2;
177     }
178 
179     /**
180      * Sets longitude of point 2 (degrees).
181      *
182      * @param lon2 longitude of point 2.
183      */
184     public void setLon2(final double lon2) {
185         this.lon2 = lon2;
186     }
187 
188     /**
189      * Gets azimuth at point 2 (degrees).
190      *
191      * @return azimuth at point 2.
192      */
193     public double getAzi2() {
194         return azi2;
195     }
196 
197     /**
198      * Sets azimuth at point 2 (degrees).
199      *
200      * @param azi2 azimuth at point 2.
201      */
202     public void setAzi2(final double azi2) {
203         this.azi2 = azi2;
204     }
205 
206     /**
207      * Gets distance between point 1 and point 2 (meters).
208      *
209      * @return distance between point 1 and point 2.
210      */
211     public double getS12() {
212         return s12;
213     }
214 
215     /**
216      * Sets distance between point 1 and point 2 (meters).
217      *
218      * @param s12 distance between point 1 and point 2.
219      */
220     public void setS12(final double s12) {
221         this.s12 = s12;
222     }
223 
224     /**
225      * Gets arc length on the auxiliary sphere between point 1 and point 2 (degrees).
226      *
227      * @return arc length on the auxiliary sphere between point 1 and point 2.
228      */
229     public double getA12() {
230         return a12;
231     }
232 
233     /**
234      * Sets arc length on the auxiliary sphere between point 1 and point 2 (degrees).
235      *
236      * @param a12 arc length on the auxiliary sphere between point 1 and point 2.
237      */
238     public void setA12(final double a12) {
239         this.a12 = a12;
240     }
241 
242     /**
243      * Gets reduced length of geodesic (meters).
244      *
245      * @return reduced length of geodesic.
246      */
247     public double getM12() {
248         return m12;
249     }
250 
251     /**
252      * Sets reduced length of geodesic (meters).
253      *
254      * @param m12 reduced length of geodesic.
255      */
256     public void setM12(final double m12) {
257         this.m12 = m12;
258     }
259 
260     /**
261      * Gets geodesic scale of point 2 relative to point 1 (dimensionless).
262      *
263      * @return geodesic scale of point 2 relative to point 1.
264      */
265     public double getScaleM12() {
266         return scaleM12;
267     }
268 
269     /**
270      * Sets geodesic scale of point 2 relative to point 1 (dimensionless).
271      *
272      * @param scaleM12 geodesic scale of point 2 relative to point 1.
273      */
274     public void setScaleM12(final double scaleM12) {
275         this.scaleM12 = scaleM12;
276     }
277 
278     /**
279      * Gets geodesic scale of point 1 relative to point 2 (dimensionless).
280      *
281      * @return geodesic scale of point 1 relative to point 2.
282      */
283     public double getScaleM21() {
284         return scaleM21;
285     }
286 
287     /**
288      * Sets geodesic scale of point 1 relative to point 2 (dimensionless).
289      *
290      * @param scaleM21 geodesic scale of point 1 relative to point 2.
291      */
292     public void setScaleM21(final double scaleM21) {
293         this.scaleM21 = scaleM21;
294     }
295 
296     /**
297      * Gets area under the geodesic (meter<sup>2</sup>).
298      *
299      * @return area under the geodesic.
300      */
301     public double getAreaS12() {
302         return areaS12;
303     }
304 
305     /**
306      * Sets area under the geodesic (meter<sup>2</sup>).
307      *
308      * @param areaS12 area under the geodesic.
309      */
310     public void setAreaS12(final double areaS12) {
311         this.areaS12 = areaS12;
312     }
313 }