From cbd9dd989a662f41ddcb0c9e0f4453840687fd4a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 10 Feb 2013 15:34:56 -0800 Subject: altosui: Add map and GPS data to graph window. Trac #50 See where the rocket landed without having to replay the whole flight. Signed-off-by: Keith Packard --- altosui/AltosGraphUI.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'altosui/AltosGraphUI.java') diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java index b376f7de..ac20f84b 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -21,8 +21,24 @@ public class AltosGraphUI extends AltosUIFrame JTabbedPane pane; AltosGraph graph; AltosUIEnable enable; + AltosSiteMap map; + AltosState state; + + boolean fill_map(AltosRecordIterable records) { + boolean any_gps = false; + for (AltosRecord record : records) { + state = new AltosState(record, state); + if (state.data.gps != null) { + map.show(state, 0); + any_gps = true; + } + } + return any_gps; + } AltosGraphUI(AltosRecordIterable records, String file) throws InterruptedException, IOException { + state = null; + pane = new JTabbedPane(); enable = new AltosUIEnable(); @@ -31,17 +47,24 @@ public class AltosGraphUI extends AltosUIFrame graph.setDataSet(new AltosGraphDataSet(records)); + map = new AltosSiteMap(); + pane.add("Flight Graph", graph.panel); pane.add("Configure Graph", enable); AltosFlightStatsTable stats = new AltosFlightStatsTable(new AltosFlightStats(records)); pane.add("Flight Statistics", stats); + if (fill_map(records)) + pane.add("Map", map); + setContentPane (pane); pack(); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); + if (state != null) + map.centre(state); } } -- cgit v1.2.3