X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=telegps%2FTeleGPS.java;h=5df47202067e805c6467af2d40ada4628c725fd8;hp=24cc379fcec9a1879068d5154de8fcfc60c3c4fb;hb=cdbc29d6d86c69e70b0f105d273ee8ddd7ae290e;hpb=297eb795b24ec31f6599f48bc8c3769557a7ec6f diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 24cc379f..5df47202 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -307,26 +307,14 @@ public class TeleGPS void graph() { AltosDataChooser chooser = new AltosDataChooser(this); AltosRecordSet set = chooser.runDialog(); - if (set == null) - return; - try { - new TeleGPSGraphUI(set, chooser.file()); - } catch (InterruptedException ie) { - } catch (IOException ie) { - } + graph_file(this, set, chooser.file()); } public void graph_flights(AltosEepromList list) { for (AltosEepromLog log : list) { if (log.file != null) { AltosRecordSet set = record_set(log.file); - if (set != null) { - try { - new TeleGPSGraphUI(set, log.file); - } catch (InterruptedException ie) { - } catch (IOException ie) { - } - } + graph_file(this, set, log.file); } } } @@ -650,18 +638,32 @@ public class TeleGPS return new AltosReplayReader(set, file); } - static boolean process_graph(File file) { - AltosRecordSet set = record_set(file); + private static boolean graph_file(TeleGPS telegps, AltosRecordSet set, File file) { if (set == null) return false; + if (!set.valid()) { + JOptionPane.showMessageDialog(telegps, + String.format("Failed to parse file %s", file), + "Graph Failed", + JOptionPane.ERROR_MESSAGE); + return false; + } try { new TeleGPSGraphUI(set, file); - } catch (Exception e) { + } catch (IOException e) { + System.out.printf("Exception %s\n", e.toString()); + } catch (InterruptedException e) { + System.out.printf("Exception %s\n", e.toString()); return false; } return true; } + static boolean process_graph(File file) { + AltosRecordSet set = record_set(file); + return graph_file(null, set, file); + } + static boolean process_replay(File file) { AltosReplayReader new_reader = replay_file(file); if (new_reader == null)