2 * Copyright © 2014 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altoslib_8;
21 import java.lang.Math;
23 import java.util.concurrent.*;
25 public abstract class AltosMapLine {
26 public AltosLatLon start, end;
28 static public int stroke_width = 6;
30 public abstract void paint(AltosMapTransform t);
32 private AltosLatLon lat_lon(AltosPointInt pt, AltosMapTransform t) {
33 return t.screen_lat_lon(pt);
36 public void dragged(AltosPointInt pt, AltosMapTransform t) {
40 public void pressed(AltosPointInt pt, AltosMapTransform t) {
41 start = lat_lon(pt, t);
45 public String line_dist() {
47 AltosGreatCircle g = new AltosGreatCircle(start.lat, start.lon,
49 double distance = g.distance;
51 if (AltosConvert.imperial_units) {
52 distance = AltosConvert.meters_to_feet(distance);
53 if (distance < 10000) {
59 else if (distance < 100)
61 else if (distance < 1000)
67 if (distance < 10000) {
73 else if (distance < 1000)
79 return String.format(format, distance);