* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_5;
+package org.altusmetrum.altoslib_11;
import java.lang.Math;
+import java.io.*;
-public class AltosGreatCircle implements Cloneable {
+public class AltosGreatCircle implements Cloneable, AltosHashable {
public double distance;
public double bearing;
public double range;
double sqr(double a) { return a * a; }
- static final double rad = Math.PI / 180;
- static final double earth_radius = 6371.2 * 1000; /* in meters */
+ public static final double rad = Math.PI / 180;
+ public static final double earth_radius = 6371.2 * 1000; /* in meters */
public static final int BEARING_LONG = AltosConvert.BEARING_LONG;
public static final int BEARING_SHORT = AltosConvert.BEARING_SHORT;
range = 0;
elevation = 0;
}
+
+ public AltosHashSet hashSet() {
+ AltosHashSet h = new AltosHashSet();
+
+ h.putDouble("distance", distance);
+ h.putDouble("bearing", bearing);
+ h.putDouble("range", range);
+ h.putDouble("elevation", elevation);
+
+ return h;
+ }
+
+ public AltosGreatCircle(AltosHashSet h) {
+ this();
+
+ distance = h.getDouble("distance", distance);
+ bearing = h.getDouble("bearing", bearing);
+ range = h.getDouble("range", range);
+ elevation = h.getDouble("elevation", elevation);
+ }
+
+ public static AltosGreatCircle fromHashSet(AltosHashSet h, AltosGreatCircle def) {
+ if (h == null)
+ return def;
+
+ return new AltosGreatCircle(h);
+ }
}