From 93b55d4e2de9ae040e85547afc0e47ab26b46141 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sat, 6 May 2017 08:35:52 -0700 Subject: [PATCH] elide GPS and map related content --- teststand/Makefile.am | 1 - teststand/TestStand.java | 20 --- teststand/TestStandGraphUI.java | 15 --- teststand/TestStandInfo.java | 215 -------------------------------- 4 files changed, 251 deletions(-) delete mode 100644 teststand/TestStandInfo.java diff --git a/teststand/Makefile.am b/teststand/Makefile.am index 72eb338d..da5f9670 100644 --- a/teststand/Makefile.am +++ b/teststand/Makefile.am @@ -15,7 +15,6 @@ teststand_JAVA= \ TestStand.java \ TestStandStatus.java \ TestStandStatusUpdate.java \ - TestStandInfo.java \ TestStandState.java \ TestStandConfig.java \ TestStandConfigUI.java \ diff --git a/teststand/TestStand.java b/teststand/TestStand.java index e8f12590..5d9fe781 100644 --- a/teststand/TestStand.java +++ b/teststand/TestStand.java @@ -73,8 +73,6 @@ public class TestStand JTabbedPane pane; - AltosUIMap map; - TestStandInfo gps_info; TestStandState gps_state; AltosInfoTable info_table; @@ -84,7 +82,6 @@ public class TestStand final static String new_command = "new"; final static String graph_command = "graph"; final static String export_command = "export"; - final static String load_maps_command = "loadmaps"; final static String preferences_command = "preferences"; final static String close_command = "close"; final static String exit_command = "exit"; @@ -92,7 +89,6 @@ public class TestStand static final String[][] file_menu_entries = new String[][] { { "Graph Data", graph_command }, { "Export Data", export_command }, - { "Load Maps", load_maps_command }, { "Preferences", preferences_command }, { "Close", close_command }, { "Exit", exit_command }, @@ -169,10 +165,6 @@ public class TestStand new TestStandPreferences(this, voice()); } - void load_maps() { - new AltosUIMapPreload(this); - } - void disconnect() { setTitle("TestStand"); stop_display(); @@ -315,10 +307,6 @@ public class TestStand preferences(); return; } - if (load_maps_command.equals(ev.getActionCommand())) { - load_maps(); - return; - } if (close_command.equals(ev.getActionCommand())) { close(); return; @@ -559,14 +547,6 @@ public class TestStand /* Make the tabbed pane use the rest of the window space */ bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH)); - map = new AltosUIMap(); - pane.add(map.getName(), map); - displays.add(map); - - gps_info = new TestStandInfo(); - pane.add(gps_info.getName(), gps_info); - displays.add(gps_info); - gps_state = new TestStandState(); pane.add(gps_state.getName(), gps_state); displays.add(gps_state); diff --git a/teststand/TestStandGraphUI.java b/teststand/TestStandGraphUI.java index b86dab9a..b6d88f82 100644 --- a/teststand/TestStandGraphUI.java +++ b/teststand/TestStandGraphUI.java @@ -39,19 +39,11 @@ public class TestStandGraphUI extends AltosUIFrame JTabbedPane pane; AltosGraph graph; AltosUIEnable enable; - AltosUIMap map; AltosState state; AltosFlightStats stats; AltosGraphDataSet graphDataSet; AltosFlightStatsTable statsTable; - void fill_map(AltosStateIterable states) { - for (AltosState state : states) { - if (state.gps != null && state.gps.locked && state.gps.nsat >= 4) - map.show(state, null); - } - } - private void close() { setVisible(false); dispose(); @@ -70,13 +62,9 @@ public class TestStandGraphUI extends AltosUIFrame graph = new AltosGraph(enable, stats, graphDataSet); statsTable = new AltosFlightStatsTable(stats); - map = new AltosUIMap(); - pane.add("Graph", graph.panel); pane.add("Configure Graph", enable); pane.add("Statistics", statsTable); - fill_map(states); - pane.add("Map", map); setContentPane (pane); @@ -95,8 +83,5 @@ public class TestStandGraphUI extends AltosUIFrame setVisible(true); - if (state != null) - map.centre(state); - } } diff --git a/teststand/TestStandInfo.java b/teststand/TestStandInfo.java deleted file mode 100644 index 7f76fab9..00000000 --- a/teststand/TestStandInfo.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright © 2017 Bdale Garbee - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -package org.altusmetrum.teststand; - -import java.util.*; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import org.altusmetrum.altoslib_11.*; -import org.altusmetrum.altosuilib_11.*; - -public class TestStandInfo extends AltosUIFlightTab { - - JLabel cur, max; - - abstract class Value extends AltosUIUnitsIndicator { - public abstract void show(AltosState state, AltosListenerState listener_state); - - public Value (Container container, int y, AltosUnits units, String text) { - super(container, y, units, text, 1, false, 2); - } - } - - abstract class DualValue extends AltosUIUnitsIndicator { - public DualValue (Container container, int y, AltosUnits units, String text) { - super(container, y, units, text, 2, false, 1); - } - } - - abstract class ValueHold extends DualValue { - public void reset() { - super.reset(); - } - public ValueHold (Container container, int y, AltosUnits units, String text) { - super(container, y, units, text); - } - } - - class Altitude extends ValueHold { - public double value(AltosState state, int i) { - if (i == 0) - return state.altitude(); - else - return state.max_altitude(); - } - - public Altitude (Container container, int y) { - super (container, y, AltosConvert.height, "Altitude"); - } - } - - class AscentRate extends ValueHold { - public double value(AltosState state, int i) { - if (i == 0) - return state.gps_ascent_rate(); - else - return state.max_gps_ascent_rate(); - } - public AscentRate (Container container, int y) { - super (container, y, AltosConvert.speed, "Ascent Rate"); - } - } - - class GroundSpeed extends ValueHold { - public double value(AltosState state, int i) { - if (i == 0) - return state.gps_ground_speed(); - else - return state.max_gps_ground_speed(); - } - public GroundSpeed (Container container, int y) { - super (container, y, AltosConvert.speed, "Ground Speed"); - } - } - - class Course extends AltosUIIndicator { - - public void show (AltosState state, AltosListenerState listener_state) { - double course = state.gps_course(); - if (course == AltosLib.MISSING) - show("Missing", "Missing"); - else - show( String.format("%3.0f°", course), - AltosConvert.bearing_to_words( - AltosConvert.BEARING_LONG, - course)); - } - public Course (Container container, int y) { - super (container, y, "Course", 2, false, 1); - } - } - - class Lat extends AltosUIIndicator { - - String pos(double p, String pos, String neg) { - String h = pos; - if (p < 0) { - h = neg; - p = -p; - } - int deg = (int) Math.floor(p); - double min = (p - Math.floor(p)) * 60.0; - return String.format("%s %4d° %9.6f", h, deg, min); - } - - public void show (AltosState state, AltosListenerState listener_state) { - if (state.gps != null && state.gps.connected && state.gps.lat != AltosLib.MISSING) - show(pos(state.gps.lat,"N", "S")); - else - show("Missing"); - } - public Lat (Container container, int y) { - super (container, y, "Latitude", 1, false, 2); - } - } - - class Lon extends AltosUIIndicator { - - String pos(double p, String pos, String neg) { - String h = pos; - if (p < 0) { - h = neg; - p = -p; - } - int deg = (int) Math.floor(p); - double min = (p - Math.floor(p)) * 60.0; - return String.format("%s %4d° %9.6f", h, deg, min); - } - - public void show (AltosState state, AltosListenerState listener_state) { - if (state.gps != null && state.gps.connected && state.gps.lon != AltosLib.MISSING) - show(pos(state.gps.lon,"E", "W")); - else - show("Missing"); - } - public Lon (Container container, int y) { - super (container, y, "Longitude", 1, false, 2); - } - } - - class GPSLocked extends AltosUIIndicator { - - public void show (AltosState state, AltosListenerState listener_state) { - if (state == null || state.gps == null) - hide(); - else { - int soln = state.gps.nsat; - int nsat = state.gps.cc_gps_sat != null ? state.gps.cc_gps_sat.length : 0; - show("%4d in solution", soln, - "%4d in view", nsat); - set_lights(state.gps.locked && soln >= 4); - } - } - public GPSLocked (Container container, int y) { - super (container, y, "GPS Locked", 2, true, 1); - } - } - - public void font_size_changed(int font_size) { - cur.setFont(AltosUILib.label_font); - max.setFont(AltosUILib.label_font); - super.font_size_changed(font_size); - } - - public void labels(Container container, int y) { - GridBagLayout layout = (GridBagLayout)(container.getLayout()); - GridBagConstraints c; - - cur = new JLabel("Current"); - cur.setFont(AltosUILib.label_font); - c = new GridBagConstraints(); - c.gridx = 2; c.gridy = y; - c.insets = new Insets(AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad, AltosUILib.tab_elt_pad); - layout.setConstraints(cur, c); - add(cur); - - max = new JLabel("Maximum"); - max.setFont(AltosUILib.label_font); - c.gridx = 3; c.gridy = y; - layout.setConstraints(max, c); - add(max); - } - - public String getName() { - return "Location"; - } - - public TestStandInfo() { - int y = 0; - labels(this, y++); - add(new Altitude(this, y++)); - add(new GroundSpeed(this, y++)); - add(new AscentRate(this, y++)); - add(new Course(this, y++)); - add(new Lat(this, y++)); - add(new Lon(this, y++)); - add(new GPSLocked(this, y++)); - } -} -- 2.47.2