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 * Bit masks for what geodesic calculations to do.
20 * These masks do double duty. They specify (via the <i>outmask</i> parameter) which
21 * results to return in the {@link GeodesicData} object returned by the general routines
22 * {@link Geodesic#direct(double, double, double, double, int)} and
23 * {@link Geodesic#inverse(double, double, double, double, int)} routines.
24 * They also signify (via the <i>caps</i> parameter) to the
25 * {@link GeodesicLine} constructor
26 * and to {@link Geodesic#line(double, double, double, int)} what capabilities
27 * should be included in the {@link GeodesicLine} object.
28 */
29 public class GeodesicMask {
30 protected static final int CAP_C1 = 1;
31
32 protected static final int CAP_C1P = 1 << 1;
33
34 protected static final int CAP_C2 = 1 << 2;
35
36 protected static final int CAP_C3 = 1 << 3;
37
38 protected static final int CAP_C4 = 1 << 4;
39
40 protected static final int OUT_ALL = 0x7F80;
41
42 // include LONG_UNROLL
43 protected static final int OUT_MASK = 0xFF80;
44
45 private static final int CAP_ALL = 0x1F;
46
47 /**
48 * No capabilities, no output.
49 */
50 public static final int NONE = 0;
51
52 /**
53 * Calculate latitude <i>lat2</i>. (It's not necessary to include this as a capability to
54 * {@link GeodesicLine} because this is included by default.)
55 */
56 public static final int LATITUDE = 1 << 7;
57
58 /**
59 * Calculate longitude <i>lon2</i>.
60 */
61 public static final int LONGITUDE = 1 << 8 | CAP_C3;
62
63 /**
64 * Calculate azimuths <i>azi1</i> and <i>azi2</i>. (It's not necessary to include this
65 * as a capability to {@link GeodesicLine} because this is included by default.)
66 */
67 public static final int AZIMUTH = 1 << 9;
68
69 /**
70 * Calculate distance <i>s12</i>.
71 */
72 public static final int DISTANCE = 1 << 10 | CAP_C1;
73
74 /**
75 * All of the above, the "standard" output and capabilities.
76 */
77 public static final int STANDARD = LATITUDE | LONGITUDE | AZIMUTH | DISTANCE;
78
79 /**
80 * Allow distance <i>s12</i> to be used as <i>input</i> in the direct geodesic problem.
81 */
82 public static final int DISTANCE_IN = 1 << 11 | CAP_C1 | CAP_C1P;
83
84 /**
85 * Calculate reduced length <i>m12</i>.
86 */
87 public static final int REDUCED_LENGTH = 1 << 12 | CAP_C1 | CAP_C2;
88
89 /**
90 * Calculate geodesic scales <i>M12</i> and <i>M21</i>.
91 */
92 public static final int GEODESIC_SCALE = 1 << 13 | CAP_C1 | CAP_C2;
93
94 /**
95 * Calculate area <i>S12</i>.
96 */
97 public static final int AREA = 1 << 14 | CAP_C4;
98
99 /**
100 * All capabilities, calculate everything. (LONG_UNROLL is not included in this mask.)
101 */
102 public static final int ALL = OUT_ALL | CAP_ALL;
103
104 /**
105 * Unroll <i>lon2</i>.
106 */
107 public static final int LONG_UNROLL = 1 << 15;
108
109 /**
110 * Constructor.
111 * Prevents instantiation.
112 */
113 private GeodesicMask() {
114 }
115 }