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 gnomonic projection.
20 * <p>
21 * This is used to return the results for a gnomonic projection of a point
22 * (<i>lat</i>, <i>lon</i>) given a center point of projection (<i>lat0</i>,
23 * <i>lon0</i>). The returned GnomonicData objects always include the
24 * parameters provided to
25 * {@link Gnomonic#forward} and {@link Gnomonic#reverse}
26 * and it always includes the fields <i>x</i>, <i>y</i>, <i>azi</i>, and
27 * <i>rk</i>.
28 */
29 public class GnomonicData {
30
31 /**
32 * Latitude of center point of projection (degrees).
33 */
34 private double lat0;
35
36 /**
37 * Longitude of center point of projection (degrees).
38 */
39 private double lon0;
40
41 /**
42 * Latitude of point (degrees).
43 */
44 private double lat;
45
46 /**
47 * Longitude of point (degrees).
48 */
49 private double lon;
50
51 /**
52 * Easting of point (meters).
53 */
54 private double x;
55
56 /**
57 * Northing of point (meters).
58 */
59 private double y;
60
61 /**
62 * Azimuth of geodesic at point (degrees).
63 */
64 private double azi;
65
66 /**
67 * Reciprocal of azimuthal scale at point.
68 */
69 private double rk;
70
71 /**
72 * Initialize all the fields to Double.NaN.
73 */
74 @SuppressWarnings("WeakerAccess")
75 public GnomonicData() {
76 lat0 = lon0 = lat = lon = x = y = azi = rk = Double.NaN;
77 }
78
79 /**
80 * Constructor initializing all the fields for gnomonic projection of a
81 * point (<i>lat</i>, <i>lon</i>) given a center point of projection
82 * (<i>lat0</i>, <i>lon0</i>).
83 *
84 * @param lat0 latitude of center point of projection (degrees).
85 * @param lon0 longitude of center point of projection (degrees).
86 * @param lat latitude of point (degrees).
87 * @param lon longitude of point (degrees).
88 * @param x easting of point (meters).
89 * @param y northing of point (meters).
90 * @param azi azimuth of geodesic at point (degrees).
91 * @param rk reciprocal of azimuthal scale at point.
92 */
93 public GnomonicData(
94 final double lat0, final double lon0, final double lat, final double lon,
95 final double x, final double y, final double azi, final double rk) {
96 this.lat0 = lat0;
97 this.lon0 = lon0;
98 this.lat = lat;
99 this.lon = lon;
100 this.x = x;
101 this.y = y;
102 this.azi = azi;
103 this.rk = rk;
104 }
105
106 /**
107 * Gets latitude of center point of projection (degrees).
108 *
109 * @return latitude of center point of projection.
110 */
111 public double getLat0() {
112 return lat0;
113 }
114
115 /**
116 * Sets latitude of center point of projection (degrees).
117 *
118 * @param lat0 latitude of center point of projection.
119 */
120 public void setLat0(final double lat0) {
121 this.lat0 = lat0;
122 }
123
124 /**
125 * Gets longitude of center point of projection (degrees).
126 *
127 * @return longitude of center point of projection.
128 */
129 public double getLon0() {
130 return lon0;
131 }
132
133 /**
134 * Sets longitude of center point of projection (degrees).
135 *
136 * @param lon0 longitude of center point of projection.
137 */
138 public void setLon0(final double lon0) {
139 this.lon0 = lon0;
140 }
141
142 /**
143 * Gets latitude of point (degrees).
144 *
145 * @return latitude of point.
146 */
147 public double getLat() {
148 return lat;
149 }
150
151 /**
152 * Sets latitude of point (degrees).
153 *
154 * @param lat latitude of point.
155 */
156 public void setLat(final double lat) {
157 this.lat = lat;
158 }
159
160 /**
161 * Gets longitude of point (degrees).
162 *
163 * @return longitude of point.
164 */
165 public double getLon() {
166 return lon;
167 }
168
169 /**
170 * Sets longitude of point (degrees).
171 *
172 * @param lon longitude of point.
173 */
174 public void setLon(final double lon) {
175 this.lon = lon;
176 }
177
178 /**
179 * Gets easting of point (meters).
180 *
181 * @return easting of point.
182 */
183 public double getX() {
184 return x;
185 }
186
187 /**
188 * Sets easting of point (meters).
189 *
190 * @param x easting of point.
191 */
192 public void setX(final double x) {
193 this.x = x;
194 }
195
196 /**
197 * Gets northing of point (meters).
198 *
199 * @return northing of point.
200 */
201 public double getY() {
202 return y;
203 }
204
205 /**
206 * Sets northing of point (meters).
207 *
208 * @param y northing of point.
209 */
210 public void setY(final double y) {
211 this.y = y;
212 }
213
214 /**
215 * Gets azimuth of geodesic at point (degrees).
216 *
217 * @return azimuth of geodesic at point.
218 */
219 public double getAzi() {
220 return azi;
221 }
222
223 /**
224 * Sets azimuth of geodesic at point (degrees).
225 *
226 * @param azi azimuth of geodesic at point.
227 */
228 public void setAzi(final double azi) {
229 this.azi = azi;
230 }
231
232 /**
233 * Gets reciprocal of azimuthal scale at point.
234 *
235 * @return reciprocal of azimuthal scale at point.
236 */
237 public double getRk() {
238 return rk;
239 }
240
241 /**
242 * Sets reciprocal of azimuthal scale at point.
243 *
244 * @param rk reciprocal of azimuthal scale at point.
245 */
246 public void setRk(final double rk) {
247 this.rk = rk;
248 }
249 }