X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosGraphUI.java;h=042f9277c2cf40e8335d9b46d9f5bda727b7c9e1;hp=5314a3b6fb025e837593fc7b6653c3eac8683db5;hb=60666630789b6925d7e16160ebdc88ccd23f51de;hpb=4d497c1be534e2b206edec3c096198c8ea64cebe diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java index 5314a3b6..042f9277 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -24,8 +24,8 @@ import java.util.ArrayList; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_11.*; -import org.altusmetrum.altosuilib_11.*; +import org.altusmetrum.altoslib_12.*; +import org.altusmetrum.altosuilib_12.*; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; @@ -34,7 +34,7 @@ import org.jfree.ui.RefineryUtilities; public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, AltosUnitsListener { JTabbedPane pane; - AltosGraphNew graph; + AltosGraph graph; AltosUIEnable enable; AltosUIMap map; AltosFlightStats stats; @@ -44,19 +44,28 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt void fill_map(AltosFlightSeries flight_series) { boolean any_gps = false; - - for (AltosGPSTimeValue gtv : flight_series.gps_series) { - AltosGPS gps = gtv.gps; - if (gps != null && - gps.locked && - gps.nsat >= 4) { - if (map == null) - map = new AltosUIMap(); - map.show(gps, AltosLib.ao_flight_pad); - this.gps = gps; - has_gps = true; + AltosGPSTimeValue gtv_last = null; + + if (flight_series.gps_series != null) { + for (AltosGPSTimeValue gtv : flight_series.gps_series) { + AltosGPS gps = gtv.gps; + if (gps != null && + gps.locked && + gps.nsat >= 4) { + if (map == null) + map = new AltosUIMap(); + map.show(gps, (int) flight_series.value_before(AltosFlightSeries.state_name, gtv.time)); + this.gps = gps; + gtv_last = gtv; + has_gps = true; + } } } + if (gtv_last != null) { + int state = (int) flight_series.value_after(AltosFlightSeries.state_name, gtv_last.time); + if (state == AltosLib.ao_flight_landed) + map.show(gtv_last.gps, state); + } } public void font_size_changed(int font_size) { @@ -86,11 +95,11 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt set.capture_series(flight_series); - flight_series.fill_in(); + flight_series.finish(); stats = new AltosFlightStats(flight_series); - graph = new AltosGraphNew(enable, stats, flight_series, cal_data); + graph = new AltosGraph(enable, stats, flight_series); statsTable = new AltosFlightStatsTable(stats);